From 93c974bddbfa93ccd13b2b1f6b5497c979ba8156 Mon Sep 17 00:00:00 2001 From: lucas Date: Thu, 17 Oct 2024 13:12:45 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0=20jenkinsfile=5Fima?= =?UTF-8?q?ge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/jenkinsfile_image | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/build/jenkinsfile_image b/build/jenkinsfile_image index 2c2ec1d..e5f3a61 100644 --- a/build/jenkinsfile_image +++ b/build/jenkinsfile_image @@ -1,24 +1,40 @@ 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 = "https://gitea.anxinyun.cn/lucas2/goUpload.git" - - stage('Run shell') { + + stage('Run shell') { git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" - container('golang-builder-1-23') { sh''' - echo "当前目===" - pwd - ls - echo "========" - /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=build/Dockerfile --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup + 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 + go build -a -v -o app.exe main.go + tar -cvf app.tar *.exe configFiles ''' } + + 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}" + buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" } } } \ No newline at end of file