Compare commits

...

2 Commits

Author SHA1 Message Date
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 ${BUILD_TAG}"
sh "docker login --username=${dockerUser} --password=${dockerPassword}"
sh '''
make -C bridge docker
make -C coordinator docker
docker tag scrolltech/bridge:${BUILD_TAG}
docker tag scrolltech/coordinator:${BUILD_TAG}
docker push scrolltech/bridge:${BUILD_TAG}
docker push scrolltech/coordinator:${BUILD_TAG}
'''
}
}
}
}
}
}
post {
always {
cleanWs()
slackSend(message: "${JOB_BASE_NAME} ${GIT_COMMIT} #${BUILD_TAG} Tag build ${currentBuild.result}")
}
}
}