You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

pipeline {
agent any
stages {
stage('Test') {
steps {
sh 'echo "Start Test"'
sh 'PATH=$PATH:/var/jenkins_home/go/bin && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go mod tidy'
sh 'PATH=$PATH:/var/jenkins_home/go/bin && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go test global/global_test.go'
}
}
stage('Compile') {
steps {
sh 'echo "Start Build"'
sh 'PATH=$PATH:/var/jenkins_home/go/bin && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ipregion.bin main.go'
}
}
stage('Deploy') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
//访问该currentBuild.result变量允许Pipeline确定是否有任何测试失败。在这种情况下值将是 UNSTABLE。
}
}
steps {
sh 'PATH=$PATH:/var/jenkins_home/go/bin && kubectl rollout restart deployment -n sre ipregion'
}
}
stage('Build') {
agent {
docker { image 'alpinelinux/docker-cli' }
}
steps {
sh 'echo "Start Build"'
sh 'docker build -t sre/ipregion:arm64 .'
}
}
}
}