From 4c7b0e25d21a012eec5cdae827fc5cf837408253 Mon Sep 17 00:00:00 2001 From: iris_cx Date: Mon, 10 Jul 2023 01:54:59 +0000 Subject: [PATCH 01/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfile=5Fpoms?= =?UTF-8?q?=5Fapi'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfile_poms_api | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/jenkinsfile_poms_api b/jenkinsfile_poms_api index 671e0e5..ebebd08 100644 --- a/jenkinsfile_poms_api +++ b/jenkinsfile_poms_api @@ -1,18 +1,25 @@ -pipeline { - agent { - node{ - label 'jnlp-slave' +podTemplate { + node('pod-templ-jenkins-slave-common') { + + env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${PEP}/${JOB_NAME}" + env.IMAGE_NAME_SHORT = "${PEP}/${JOB_NAME}" + env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/HumanResource.git" + + stage('Run shell') { + git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + + /kaniko/executor --context=${BUILD_WORKSPACE} + --dockerfile=./api/Dockerfile + --destination=${IMAGE_NAME}:${IMAGE_VERSION} + --cache=false --cleanup + ''' + } + + buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" + buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" + } } - } - - stages { - stage('Testing hrm api......') { - steps { - buildName '#${BUILD_NUMBER} ~/pep/${JOB_NAME}:${IMAGE_VERSION}' - buildDescription 'harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}' - sh 'nerdctl build -t harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION} ./api' - sh 'nerdctl push harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}' - } - } - } } \ No newline at end of file From 054093a682a56b8a689d27902133f53baef90aec Mon Sep 17 00:00:00 2001 From: iris_cx Date: Mon, 10 Jul 2023 01:55:26 +0000 Subject: [PATCH 02/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfile=5Fpoms?= =?UTF-8?q?=5Fweb'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfile_poms_web | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/jenkinsfile_poms_web b/jenkinsfile_poms_web index 8f06fda..81fa832 100644 --- a/jenkinsfile_poms_web +++ b/jenkinsfile_poms_web @@ -1,18 +1,25 @@ -pipeline { - agent { - node{ - label 'jnlp-slave' +podTemplate { + node('pod-templ-jenkins-slave-common') { + + env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${PEP}/${JOB_NAME}" + env.IMAGE_NAME_SHORT = "${PEP}/${JOB_NAME}" + env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/HumanResource.git" + + stage('Run shell') { + git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + + /kaniko/executor --context=${BUILD_WORKSPACE} + --dockerfile=./web/Dockerfile + --destination=${IMAGE_NAME}:${IMAGE_VERSION} + --cache=false --cleanup + ''' + } + + buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" + buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" + } } - } - - stages { - stage('Testing hrm-web ......') { - steps { - buildName "#${BUILD_NUMBER} ~/pep/${JOB_NAME}:${IMAGE_VERSION}" - buildDescription "harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}" - sh 'nerdctl build -t harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION} ./web' - sh 'nerdctl push harbor.anxinyun.cn/pep/${JOB_NAME}:${IMAGE_VERSION}' - } - } - } } \ No newline at end of file From 734890b2fd2e350abb619767638960ad90aa8100 Mon Sep 17 00:00:00 2001 From: iris_cx Date: Mon, 10 Jul 2023 01:58:12 +0000 Subject: [PATCH 03/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'web/Dockerfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index a9a3af6..63f069b 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -28,17 +28,17 @@ FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder -COPY . /var/app +COPY ./web/ /var/app WORKDIR /var/app EXPOSE 8080 -RUN npm config set registry=http://10.8.30.22:7000 +RUN npm config set registry=https://nexus.ngaiot.com/repository/fs-npm/ RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json RUN npm cache clean -f -RUN npm install --registry http://10.8.30.22:7000 +RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ RUN npm run build RUN rm -rf client/src RUN rm -rf node_modules -RUN npm install --production --force --registry http://10.8.30.22:7000 +RUN npm install --production --force --registry https://nexus.ngaiot.com/repository/fs-npm/ FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20 COPY --from=builder --chown=node /var/app /home/node/app WORKDIR /home/node/app From 4328b0666a1c4fa692532f0af6a1cdc1e480d769 Mon Sep 17 00:00:00 2001 From: iris_cx Date: Mon, 10 Jul 2023 02:00:42 +0000 Subject: [PATCH 04/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'api/Dockerfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/Dockerfile | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index 1cf0525..66887fc 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,38 +1,31 @@ -# FROM repository.anxinyun.cn/devops/node:12-dev as builder - -# COPY . /var/app - -# WORKDIR /var/app - -# EXPOSE 8080 - -# RUN npm config set registry=http://10.8.30.22:7000 -# RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json -# RUN npm cache clean -f -# RUN rm -rf package-lock.json -# RUN npm install --registry http://10.8.30.22:7000 - -# FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 - -# COPY --from=builder --chown=node /var/app /home/node/app - -# WORKDIR /home/node/app +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder +COPY ./api/ /var/app +WORKDIR /var/app +EXPOSE 8080 +RUN npm config set registry=https://nexus.ngaiot.com/repository/fs-npm/ +RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json +RUN npm cache clean -f +RUN rm -rf package-lock.json +RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ -# CMD ["node", "server.js"] +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 +COPY --from=builder --chown=node /var/app /home/node/app +WORKDIR /home/node/app +CMD ["node", "server.js"] # 旧版本构建方式 -FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 +# FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 -MAINTAINER liuxinyi "liu.xinyi@free-sun.com.cn" +# MAINTAINER liuxinyi "liu.xinyi@free-sun.com.cn" -COPY . /var/app +# COPY . /var/app -WORKDIR /var/app +# WORKDIR /var/app -RUN npm cache clean -f && npm install --production --force --registry http://10.8.30.22:7000 +# RUN npm cache clean -f && npm install --production --force --registry http://10.8.30.22:7000 -RUN rm -rf package-lock.json +# RUN rm -rf package-lock.json -CMD [ "node", "server.js" ] \ No newline at end of file +# CMD [ "node", "server.js" ] \ No newline at end of file From 5ea0f52f2f18fd7a1ec6ca14fda610760293703e Mon Sep 17 00:00:00 2001 From: sunyue Date: Mon, 10 Jul 2023 02:21:38 +0000 Subject: [PATCH 05/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfile=5Fpoms?= =?UTF-8?q?=5Fapi'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfile_poms_api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkinsfile_poms_api b/jenkinsfile_poms_api index ebebd08..87c22fe 100644 --- a/jenkinsfile_poms_api +++ b/jenkinsfile_poms_api @@ -6,7 +6,7 @@ podTemplate { env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/HumanResource.git" stage('Run shell') { - git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" container('image-builder') { sh''' From dbb1448ffd4725a4ab4d09988df60602b425849b Mon Sep 17 00:00:00 2001 From: sunyue Date: Mon, 10 Jul 2023 02:22:09 +0000 Subject: [PATCH 06/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfile=5Fpoms?= =?UTF-8?q?=5Fweb'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfile_poms_web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkinsfile_poms_web b/jenkinsfile_poms_web index 81fa832..0bc1179 100644 --- a/jenkinsfile_poms_web +++ b/jenkinsfile_poms_web @@ -6,7 +6,7 @@ podTemplate { env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/HumanResource.git" stage('Run shell') { - git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" container('image-builder') { sh''' From 916a4d56a3f6b39edc6ff1dc1826b565ca1fa754 Mon Sep 17 00:00:00 2001 From: sunyue Date: Mon, 10 Jul 2023 02:28:28 +0000 Subject: [PATCH 07/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'web/Dockerfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Dockerfile b/web/Dockerfile index 63f069b..4f8d7ce 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -39,7 +39,7 @@ RUN npm run build RUN rm -rf client/src RUN rm -rf node_modules RUN npm install --production --force --registry https://nexus.ngaiot.com/repository/fs-npm/ -FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20 +FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 COPY --from=builder --chown=node /var/app /home/node/app WORKDIR /home/node/app CMD ["node", "server.js"] \ No newline at end of file From a49d69a88717f7a9a06891beef22269b3040bf07 Mon Sep 17 00:00:00 2001 From: sunyue Date: Mon, 10 Jul 2023 02:38:07 +0000 Subject: [PATCH 08/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfile=5Fpoms?= =?UTF-8?q?=5Fapi'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfile_poms_api | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/jenkinsfile_poms_api b/jenkinsfile_poms_api index 87c22fe..57984cb 100644 --- a/jenkinsfile_poms_api +++ b/jenkinsfile_poms_api @@ -1,25 +1,21 @@ podTemplate { node('pod-templ-jenkins-slave-common') { - - env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${PEP}/${JOB_NAME}" - env.IMAGE_NAME_SHORT = "${PEP}/${JOB_NAME}" - env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/HumanResource.git" - - stage('Run shell') { - git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" - - container('image-builder') { - sh''' - - /kaniko/executor --context=${BUILD_WORKSPACE} - --dockerfile=./api/Dockerfile - --destination=${IMAGE_NAME}:${IMAGE_VERSION} - --cache=false --cleanup - ''' - } - - buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" - buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" - } - } + + env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${PEP}/${JOB_NAME}" + env.IMAGE_NAME_SHORT = "${PEP}/${JOB_NAME}" + env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/HumanResource.git" + + stage('Run shell') { + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./api/Dockerfile --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup + ''' + } + + buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" + buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" + } + } } \ No newline at end of file From 2ab45e83558503b9dd826c490c2f479257b310e5 Mon Sep 17 00:00:00 2001 From: sunyue Date: Mon, 10 Jul 2023 03:13:37 +0000 Subject: [PATCH 09/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfile=5Fpoms?= =?UTF-8?q?=5Fapi'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfile_poms_api | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkinsfile_poms_api b/jenkinsfile_poms_api index 57984cb..9f992d8 100644 --- a/jenkinsfile_poms_api +++ b/jenkinsfile_poms_api @@ -1,8 +1,8 @@ podTemplate { node('pod-templ-jenkins-slave-common') { - env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${PEP}/${JOB_NAME}" - env.IMAGE_NAME_SHORT = "${PEP}/${JOB_NAME}" + env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${pep}/${JOB_NAME}" + env.IMAGE_NAME_SHORT = "${pep}/${JOB_NAME}" env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/HumanResource.git" stage('Run shell') { From 2b748d1973c1f57b4d167b12ddf5e5ff5954e5aa Mon Sep 17 00:00:00 2001 From: sunyue Date: Mon, 10 Jul 2023 03:17:09 +0000 Subject: [PATCH 10/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfile=5Fpoms?= =?UTF-8?q?=5Fweb'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfile_poms_web | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/jenkinsfile_poms_web b/jenkinsfile_poms_web index 0bc1179..c883be7 100644 --- a/jenkinsfile_poms_web +++ b/jenkinsfile_poms_web @@ -1,25 +1,25 @@ podTemplate { node('pod-templ-jenkins-slave-common') { - - env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${PEP}/${JOB_NAME}" - env.IMAGE_NAME_SHORT = "${PEP}/${JOB_NAME}" + + env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${PEP}/${JOB_NAME}" + env.IMAGE_NAME_SHORT = "${PEP}/${JOB_NAME}" env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/HumanResource.git" - - stage('Run shell') { - git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" - - container('image-builder') { - sh''' - /kaniko/executor --context=${BUILD_WORKSPACE} - --dockerfile=./web/Dockerfile - --destination=${IMAGE_NAME}:${IMAGE_VERSION} - --cache=false --cleanup - ''' - } - - buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" - buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" - } - } + stage('Run shell') { + git branch: 'master', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" + + container('image-builder') { + sh''' + pwd + ls -al + + /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./web/Dockerfilenew --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup + + ''' + } + + buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" + buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" + } + } } \ No newline at end of file From e324e27f795f18dd7a27a430d5f751ce6493dd71 Mon Sep 17 00:00:00 2001 From: sunyue Date: Mon, 10 Jul 2023 03:21:57 +0000 Subject: [PATCH 11/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'jenkinsfile=5Fpoms?= =?UTF-8?q?=5Fweb'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkinsfile_poms_web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkinsfile_poms_web b/jenkinsfile_poms_web index c883be7..14ff77f 100644 --- a/jenkinsfile_poms_web +++ b/jenkinsfile_poms_web @@ -13,7 +13,7 @@ podTemplate { pwd ls -al - /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./web/Dockerfilenew --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup + /kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./web/Dockerfile --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup ''' }