podTemplate { node('pod-templ-jenkins-slave-golang') { env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${LOCAL}/${JOB_NAME}" env.IMAGE_NAME_SHORT = "${LOCAL}/${JOB_NAME}" env.CODE_ADDR = "${GIT_ADDRESS}/container/et-go.git" stage('Run shell') { git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" container('golang-builder-1-22') { sh''' git version git config --global --add url."https://builder:Fs7595!EAT@gitea.anxinyun.cn/".insteadOf "https://gitea.anxinyun.cn/" unset GOPROXY go env -w GOPROXY=https://goproxy.cn,direct go env -w GO111MODULE=on go env -w GOPRIVATE=gitea.ngaiot.com,gitea.anxinyun.cn go env -w GOSUMDB=sum.golang.org go env -w GOOS=linux go env -w GOARCH=arm64 go env go build -ldflags "-extldflags -static -X main.VERSION=$VERSION -X main.SVN_REVISION=$SVN_REVISION -X main.BUILD_NUMBER=$BUILD_NUMBER -X main.BUILD_TIME=$BUILD_TIME -X main.GO_VERSION=$GO_VERSION" -tags="et-go" -a -v -o app.exe containerApp/main.go tar -cvf app.tar *.exe *.yaml ''' } container('image-builder') { sh''' echo "当前目===" pwd ls echo "========" /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=build/Dockerfile_app --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup ''' } archiveArtifacts artifacts: 'app.tar', followSymlinks: false buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" } } }