11def PROJECT_NAME = " simple-api"
22def gitUrl = " https://github.com/oscka/${ PROJECT_NAME} .git"
33def imgRegistry = " https://registry.hub.docker.com"
4- def gitOpsUrl = " github.com/oscka/simple-gitops.git"
4+ def gitOpsUrl = " https:// github.com/oscka/simple-gitops.git"
55def opsBranch = " main"
66// ///////////////////////////
77pipeline {
@@ -23,7 +23,7 @@ pipeline {
2323 sh " skaffold build -p dev -t ${ TAG} "
2424 }
2525 // mac local 일때만 사용 linux 환경에서는 docker.withRegistry 사용
26- sh " skaffold build -p dev -t ${ TAG} "
26+ // sh "skaffold build -p dev -t ${TAG}"
2727 }
2828 }
2929 }
@@ -35,20 +35,22 @@ pipeline {
3535 stage(' GitOps update' ) {
3636 steps{
3737 print " ======kustomization.yaml tag update====="
38- git url : " https://${ gitOpsUrl} " , branch : " main" , credentialsId : " git-credential"
39- script{
40- sh """
41- cd ./simple-api/blue-green
42- kustomize edit set image skaqud/simple-api:${ TAG}
38+ withCredentials([
39+ gitUsernamePassword(credentialsId : ' git-credential' , gitToolName : ' Default' )
40+ ]) {
41+ sh """
42+ git clone ${ gitOpsUrl}
43+ cd ./simple-gitops/simple-api/rolling-update-no-istio
44+ kustomize edit set image oscka/simple-api:${ TAG}
4345 # 로컬외에는 주석 제거한다
4446 git config --global user.email "admin@demo.com"
4547 git config --global user.name "admin"
4648 git add .
4749 git commit -am 'update image tag ${ TAG} '
48- git remote set-url --push origin https:// ${ gitOpsUrl}
50+ git remote set-url --push origin ${ gitOpsUrl}
4951 git push origin ${ opsBranch}
50- """
51- }
52+ """
53+ }
5254 print " git push finished !!!"
5355 }
5456 }
0 commit comments