diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 2ca69e7f..512cea64 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 = 'jsntmf' + GITHUB_ACCOUNT = 'jsntmf' APP_NAME = 'devops-java-sample' } @@ -63,10 +63,21 @@ pipeline { when{ branch 'master' } + steps { - input(id: 'deploy-to-dev', message: 'deploy to dev?') - kubernetesDeploy(configs: 'deploy/dev-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID") - } + input(id: 'deploy-to-dev', message: 'deploy to dev?') + container ('maven') { + withCredentials([ + kubeconfigFile( + credentialsId: env.KUBECONFIG_CREDENTIAL_ID, + variable: 'KUBECONFIG') + ]) { + sh 'echo "mafei -----$KUBECONFIG_CREDENTIAL_ID"' + sh 'envsubst < deploy/dev-ol/devops-sample.yaml | kubectl apply -f -' + sh 'envsubst < deploy/dev-ol/devops-sample-svc.yaml | kubectl apply -f -' + } + } + } } stage('push with tag'){ when{ @@ -78,8 +89,8 @@ pipeline { container ('maven') { input(id: 'release-image-with-tag', message: 'release image with tag?') withCredentials([usernamePassword(credentialsId: "$GITHUB_CREDENTIAL_ID", passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { - sh 'git config --global user.email "kubesphere@yunify.com" ' - sh 'git config --global user.name "kubesphere" ' + sh 'git config --global user.email "jsntmf@qq.com" ' + sh 'git config --global user.name "jsntmf" ' sh 'git tag -a $TAG_NAME -m "$TAG_NAME" ' sh 'git push http://$GIT_USERNAME:$GIT_PASSWORD@github.com/$GITHUB_ACCOUNT/devops-java-sample.git --tags --ipv4' }