From b667f4c020fc2df4ae85922b0bd867f1f203d945 Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 15:25:54 +0800 Subject: [PATCH 01/16] Update Jenkinsfile-online --- Jenkinsfile-online | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 2ca69e7f..5d4f9089 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -14,8 +14,8 @@ pipeline { GITHUB_CREDENTIAL_ID = 'github-id' KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig' REGISTRY = 'docker.io' - DOCKERHUB_NAMESPACE = 'docker_username' - GITHUB_ACCOUNT = 'kubesphere' + DOCKERHUB_NAMESPACE = 'scarlet' + GITHUB_ACCOUNT = 'ylsb' APP_NAME = 'devops-java-sample' } From f614254d303c62f74ca2bb1c78da388efa387278 Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 17:38:22 +0800 Subject: [PATCH 02/16] Update Jenkinsfile-online --- Jenkinsfile-online | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 5d4f9089..3a9844b8 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -38,6 +38,10 @@ pipeline { steps { container ('maven') { sh 'mvn -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package' + curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo + yum -y install podman + mv /usr/bin/docker /usr/bin/docker_ce + ln -s /usr/bin/podman /usr/bin/docker sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .' withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) { sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin' From 9ea8faedb468c8a04c3c41cdd5928c3562fb7cc4 Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 17:43:47 +0800 Subject: [PATCH 03/16] Update Jenkinsfile-online --- Jenkinsfile-online | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 3a9844b8..ccf82134 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -33,7 +33,18 @@ pipeline { } } } - + stage ('install podman') { + steps { + container ('maven') { + sh ''' + curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo + yum -y install podman + mv /usr/bin/docker /usr/bin/docker_ce + ln -s /usr/bin/podman /usr/bin/docker + ''' + } + } + } stage ('build & push') { steps { container ('maven') { From 3e202b00831f916c7cd8be6e355d091cbc52394c Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 17:48:51 +0800 Subject: [PATCH 04/16] Update Jenkinsfile-online --- Jenkinsfile-online | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index ccf82134..007338dc 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -49,10 +49,6 @@ pipeline { steps { container ('maven') { sh 'mvn -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package' - curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo - yum -y install podman - mv /usr/bin/docker /usr/bin/docker_ce - ln -s /usr/bin/podman /usr/bin/docker sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .' withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) { sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin' From f6522e0bf1ed6e5e3b4bdf770055fd2446bcc2b1 Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 17:54:30 +0800 Subject: [PATCH 05/16] Update Jenkinsfile-online --- Jenkinsfile-online | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 007338dc..05ba880c 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -39,7 +39,7 @@ pipeline { sh ''' curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo yum -y install podman - mv /usr/bin/docker /usr/bin/docker_ce + #mv /usr/bin/docker /usr/bin/docker_ce ln -s /usr/bin/podman /usr/bin/docker ''' } From eee3e952b5952f1df3ea4c18f770605541ebce1c Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 18:03:32 +0800 Subject: [PATCH 06/16] Update Dockerfile-online --- Dockerfile-online | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile-online b/Dockerfile-online index 9e99459f..f51ccf21 100644 --- a/Dockerfile-online +++ b/Dockerfile-online @@ -1,5 +1,5 @@ -FROM java:openjdk-8-jre-alpine - +#FROM java:openjdk-8-jre-alpine +FROM openjdk:openjdk-8-jre-alpine WORKDIR /home COPY target/*.jar /home From ba131f24b18cc361f12d32d3b5b979a533fb2e8d Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 18:08:43 +0800 Subject: [PATCH 07/16] Update Dockerfile-online --- Dockerfile-online | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile-online b/Dockerfile-online index f51ccf21..5a3d240e 100644 --- a/Dockerfile-online +++ b/Dockerfile-online @@ -1,5 +1,5 @@ #FROM java:openjdk-8-jre-alpine -FROM openjdk:openjdk-8-jre-alpine +FROM openjdk:8-jre-alpine WORKDIR /home COPY target/*.jar /home From 25f97410eb8e22c592f5f54b6541b7cf374b7217 Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 18:15:29 +0800 Subject: [PATCH 08/16] Update Jenkinsfile-online --- Jenkinsfile-online | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 05ba880c..934fff35 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -10,8 +10,8 @@ pipeline { } environment { - DOCKER_CREDENTIAL_ID = 'dockerhub-id' - GITHUB_CREDENTIAL_ID = 'github-id' + DOCKER_CREDENTIAL_ID = 'dockerhub' + GITHUB_CREDENTIAL_ID = 'github-token' KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig' REGISTRY = 'docker.io' DOCKERHUB_NAMESPACE = 'scarlet' From c314671a03b2029241febc331a126649201ee65b Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 18:18:46 +0800 Subject: [PATCH 09/16] Update Jenkinsfile-online --- Jenkinsfile-online | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 934fff35..05ba880c 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -10,8 +10,8 @@ pipeline { } environment { - DOCKER_CREDENTIAL_ID = 'dockerhub' - GITHUB_CREDENTIAL_ID = 'github-token' + DOCKER_CREDENTIAL_ID = 'dockerhub-id' + GITHUB_CREDENTIAL_ID = 'github-id' KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig' REGISTRY = 'docker.io' DOCKERHUB_NAMESPACE = 'scarlet' From e08dabd4b184e37498bfffa33f140fff05ddec0b Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 18:38:17 +0800 Subject: [PATCH 10/16] Update Jenkinsfile-online --- Jenkinsfile-online | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 05ba880c..47be5957 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -37,8 +37,8 @@ pipeline { steps { container ('maven') { sh ''' - curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo - yum -y install podman + #curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo + #yum -y install podman #mv /usr/bin/docker /usr/bin/docker_ce ln -s /usr/bin/podman /usr/bin/docker ''' From 6abc81bfb0ad810b09921f7ea9a64040f03b23fa Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 18:52:17 +0800 Subject: [PATCH 11/16] Update devops-sample-svc.yaml --- deploy/dev-ol/devops-sample-svc.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/dev-ol/devops-sample-svc.yaml b/deploy/dev-ol/devops-sample-svc.yaml index 24fff6f3..3756c64e 100644 --- a/deploy/dev-ol/devops-sample-svc.yaml +++ b/deploy/dev-ol/devops-sample-svc.yaml @@ -5,7 +5,7 @@ metadata: app: kubesphere component: ks-sample-dev name: ks-sample-dev - namespace: kubesphere-sample-dev + namespace: kubesphere-devops-worker spec: ports: - name: http @@ -18,4 +18,4 @@ spec: component: ks-sample-dev tier: backend sessionAffinity: None - type: NodePort \ No newline at end of file + type: NodePort From 2e910809742b8e5088c7c552971269dd13b34a8b Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 18:52:36 +0800 Subject: [PATCH 12/16] Update devops-sample.yaml --- deploy/dev-ol/devops-sample.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/dev-ol/devops-sample.yaml b/deploy/dev-ol/devops-sample.yaml index e0a259a4..f75b02bb 100644 --- a/deploy/dev-ol/devops-sample.yaml +++ b/deploy/dev-ol/devops-sample.yaml @@ -6,7 +6,7 @@ metadata: component: ks-sample-dev tier: backend name: ks-sample-dev - namespace: kubesphere-sample-dev + namespace: kubesphere-devops-worker spec: progressDeadlineSeconds: 600 replicas: 1 From 61995b54576cb49e7a4b87e2d05369348fe1e053 Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 19:16:44 +0800 Subject: [PATCH 13/16] Update Jenkinsfile-online --- Jenkinsfile-online | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 47be5957..c389a092 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -107,7 +107,16 @@ pipeline { } steps { input(id: 'deploy-to-production', message: 'deploy to production?') - kubernetesDeploy(configs: 'deploy/prod-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID") + #kubernetesDeploy(configs: 'deploy/prod-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID") + container ('maven') { + withCredentials([ + kubeconfigFile( + credentialsId: env.KUBECONFIG_CREDENTIAL_ID, + variable: 'KUBECONFIG') + ]) { + sh 'envsubst < deploy/prod-ol/devops-sample.yaml | kubectl apply -f -' + } + } } } } From 6ef47e999beb404848a277625761771d68f3be7a Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 19:17:17 +0800 Subject: [PATCH 14/16] Update Jenkinsfile-online --- Jenkinsfile-online | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index c389a092..9b7ad7f3 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -114,7 +114,7 @@ pipeline { credentialsId: env.KUBECONFIG_CREDENTIAL_ID, variable: 'KUBECONFIG') ]) { - sh 'envsubst < deploy/prod-ol/devops-sample.yaml | kubectl apply -f -' + sh 'envsubst < deploy/dev-ol/devops-sample.yaml | kubectl apply -f -' } } } From ea162fbba5ec15f9d780a04e09f083407f244bd3 Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 12 Jan 2023 19:19:56 +0800 Subject: [PATCH 15/16] Update Jenkinsfile-online --- Jenkinsfile-online | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 9b7ad7f3..33fe2451 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -107,7 +107,6 @@ pipeline { } steps { input(id: 'deploy-to-production', message: 'deploy to production?') - #kubernetesDeploy(configs: 'deploy/prod-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID") container ('maven') { withCredentials([ kubeconfigFile( From 28bd8c85aebc3c9505de5ee02c8e6b0eeb26c5fe Mon Sep 17 00:00:00 2001 From: ylsb Date: Thu, 19 Jan 2023 17:42:04 +0800 Subject: [PATCH 16/16] Update devops-sample-svc.yaml --- deploy/dev-ol/devops-sample-svc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/dev-ol/devops-sample-svc.yaml b/deploy/dev-ol/devops-sample-svc.yaml index 3756c64e..930a705a 100644 --- a/deploy/dev-ol/devops-sample-svc.yaml +++ b/deploy/dev-ol/devops-sample-svc.yaml @@ -12,7 +12,7 @@ spec: port: 8080 protocol: TCP targetPort: 8080 - nodePort: 30861 + nodePort: 30880 selector: app: kubesphere component: ks-sample-dev