From cdd62311ad839e588bac4c8a1fafc733b4ffa75e Mon Sep 17 00:00:00 2001 From: Megha Mehta <76773785+mm2020-ind@users.noreply.github.com> Date: Mon, 8 Mar 2021 22:26:53 +0530 Subject: [PATCH 1/2] Create Jenkinsfile --- Jenkinsfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..ac50e9a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,35 @@ +node { + stage('SCM checkout') { + checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/radtac-craft/argocd-example-apps.git']]]) + } + + stage('Start argocd') { + withKubeConfig(credentialsId: 'KUBECONFIG', serverUrl: '') { + // sh 'kubectl get all' + sh 'kubectl port-forward svc/argocd-server -n argocd 8080:443&' + // sh 'argocd login 127.0.0.1:8080' + sh 'argocd login 127.0.0.1:8080 --config /Users/mac/.argocd/config --insecure --username admin --password admin' + sh 'argocd app list' + } + } + + stage('Create app') { + withKubeConfig(credentialsId: 'KUBECONFIG', serverUrl: '') { + sh """ + argocd app create prod-kustomize-guestbook \ + --repo https://github.com/radtac-craft/argocd-example-apps.git \ + --path kustomize-guestbook/overlays/prod \ + --dest-server https://kubernetes.default.svc \ + --dest-namespace prod-kustomize-guestbook + """ + sh 'argocd app sync prod-kustomize-guestbook' + sh 'argocd app wait prod-kustomize-guestbook --sync' + } + } + + stage('Verify app') { + withKubeConfig(credentialsId: 'KUBECONFIG', serverUrl: '') { + sh 'argocd app list' + } + } +} From fa8c5cb887c9ad8a2304a41792ae7e19dbf61a28 Mon Sep 17 00:00:00 2001 From: Megha Mehta <76773785+mm2020-ind@users.noreply.github.com> Date: Mon, 8 Mar 2021 22:29:25 +0530 Subject: [PATCH 2/2] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ac50e9a..961e45f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ node { } stage('Start argocd') { - withKubeConfig(credentialsId: 'KUBECONFIG', serverUrl: '') { + withKubeConfig(credentialsId: 'eksctl-kubeconfig', serverUrl: '') { // sh 'kubectl get all' sh 'kubectl port-forward svc/argocd-server -n argocd 8080:443&' // sh 'argocd login 127.0.0.1:8080' @@ -14,7 +14,7 @@ node { } stage('Create app') { - withKubeConfig(credentialsId: 'KUBECONFIG', serverUrl: '') { + withKubeConfig(credentialsId: 'eksctl-kubeconfig', serverUrl: '') { sh """ argocd app create prod-kustomize-guestbook \ --repo https://github.com/radtac-craft/argocd-example-apps.git \ @@ -28,7 +28,7 @@ node { } stage('Verify app') { - withKubeConfig(credentialsId: 'KUBECONFIG', serverUrl: '') { + withKubeConfig(credentialsId: 'eksctl-kubeconfig', serverUrl: '') { sh 'argocd app list' } }