From 4b779fb27b990a6b7fd86d2fac3f995136c43912 Mon Sep 17 00:00:00 2001 From: Fleur Kelpin Date: Sat, 29 Sep 2018 18:54:21 +0200 Subject: [PATCH] chore (Jenkinsfile): package and deploy --- .gitignore | 3 ++- Jenkinsfile | 19 +++++++++++++++++++ charts/molgenis-jenkins/values.yaml | 23 +++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 29b636a..e5aa5b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea -*.iml \ No newline at end of file +*.iml +target \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 85f139e..c63293d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,5 +12,24 @@ pipeline { } } } + stage('Package') { + steps { + container('chart-testing'){ + sh "mkdir target" + sh "for dir in charts/*; do helm package --destination target \"$dir\"; done" + } + } + } + stage('Deploy') { + steps { + container('vault') { + env.NEXUS_USER = sh(script: 'vault read -field=username secret/ops/account/nexus', returnStdout: true) + env.NEXUS_PWD = sh(script: 'vault read -field=password secret/ops/account/nexus', returnStdout: true) + } + container('alpine') { + sh "for chart in target/*; do curl -L -u ${NEXUS_USER}:${NEXUS_PWD} http://registry.molgenis.org/repository/helm/ --upload-file \"$chart\"; done" + } + } + } } } \ No newline at end of file diff --git a/charts/molgenis-jenkins/values.yaml b/charts/molgenis-jenkins/values.yaml index 1d61a89..583b472 100644 --- a/charts/molgenis-jenkins/values.yaml +++ b/charts/molgenis-jenkins/values.yaml @@ -593,6 +593,29 @@ jenkins: Command: cat WorkingDir: /home/jenkins TTY: true + alpine: + Image: "spotify/alpine" + Command: cat + WorkingDir: /home/jenkins + TTY: true + vault: + Image: "vault" + Command: cat + WorkingDir: /home/jenkins + TTY: true + EnvVars: + - type: Secret + key: VAULT_TOKEN + secretName: molgenis-pipeline-vault-secret + secretKey: token + - type: Secret + key: VAULT_SKIP_VERIFY + secretName: molgenis-pipeline-vault-secret + secretKey: skipVerify + - type: Secret + key: VAULT_ADDR + secretName: molgenis-pipeline-vault-secret + secretKey: addr NodeSelector: {} # secret contains configuration for the kubernetes secrets that jenkins can access