Compare commits

...

5 Commits

Author SHA1 Message Date
vincent
6cd03544a3 test 2023-01-10 13:08:13 +08:00
vincent
6bf5329601 CHANGE tag ENV 2023-01-10 13:03:40 +08:00
vincent
2ec52c6780 tag 2023-01-10 12:57:57 +08:00
vincent
a3b784d768 test 2023-01-10 11:45:33 +08:00
vincent
eb28409382 add_tag_job 2023-01-10 11:40:30 +08:00

54
TagJenkinsfile Normal file
View File

@@ -0,0 +1,54 @@
imagePrefix = 'scrolltech'
credentialDocker = 'dockerhub'
pipeline {
agent any
options {
timeout (20)
}
tools {
go 'go-1.18'
nodejs "nodejs"
}
environment {
GO111MODULE = 'on'
PATH="/home/ubuntu/.cargo/bin:$PATH"
// LOG_DOCKER = 'true'
}
stages {
stage('Build') {
environment {
// Extract the username and password of our credentials into "DOCKER_CREDENTIALS_USR" and "DOCKER_CREDENTIALS_PSW".
// (NOTE 1: DOCKER_CREDENTIALS will be set to "your_username:your_password".)
// The new variables will always be YOUR_VARIABLE_NAME + _USR and _PSW.
// (NOTE 2: You can't print credentials in the pipeline for security reasons.)
DOCKER_CREDENTIALS = credentials('dockerhub')
}
steps {
withCredentials([usernamePassword(credentialsId: "${credentialDocker}", passwordVariable: 'dockerPassword', usernameVariable: 'dockerUser')]) {
// Use a scripted pipeline.
script {
stage('Push image') {
sh "echo ${$TAG_NAME}"
sh "docker login --username=${dockerUser} --password=${dockerPassword}"
sh '''
make -C bridge docker
make -C coordinator docker
docker tag scrolltech/bridge:${$TAG_NAME}
docker tag scrolltech/coordinator:${$TAG_NAME}
docker push scrolltech/bridge:${$TAG_NAME}
docker push scrolltech/coordinator:${$TAG_NAME}
'''
}
}
}
}
}
}
post {
always {
cleanWs()
slackSend(message: "${JOB_BASE_NAME} ${GIT_COMMIT} #${TAG_NAME} Tag build ${currentBuild.result}")
}
}
}