Skip to content

Commit d456b92

Browse files
authored
Merge pull request #233 from cloudogu/feature/additional-run-args
adding additionalEnv param to jenkins config allowing setting custom …
2 parents 9369c50 + b605edf commit d456b92

File tree

15 files changed

+58
-20
lines changed

15 files changed

+58
-20
lines changed

Jenkinsfile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!groovy
2-
@Library('github.com/cloudogu/ces-build-lib@1.65.1')
2+
@Library('github.com/cloudogu/ces-build-lib@2.5.0')
33
import com.cloudogu.ces.cesbuildlib.*
44

55
String getDockerRegistryBaseUrl() { 'ghcr.io' }
@@ -115,24 +115,25 @@ node('high-cpu') {
115115
returnStdout: true
116116
).trim()
117117

118+
int ret=0
118119
new Docker(this).image(groovyImage)
119120
// Avoids errors ("unable to resolve class") probably due to missing HOME for container in JVM.
120121
.mountJenkinsUser()
121122
.inside("--network=${k3dNetwork}") {
122123
// removing m2 and grapes avoids issues where grapes primarily resolves local m2 and fails on missing versions
123124
sh "rm -rf .m2/"
124125
sh "rm -rf .groovy/grapes"
125-
int ret = sh(returnStatus: true,
126+
ret = sh(returnStatus: true,
126127
script: "groovy ./scripts/e2e.groovy --url http://${k3dAddress}:9090 --user admin --password admin --writeFailedLog --fail --retry 2")
127-
128-
if (ret > 0 ) {
129-
if (fileExists('playground-logs-of-failed-jobs')) {
130-
archiveArtifacts artifacts: 'playground-logs-of-failed-jobs/*.log'
131-
}
132-
unstable "Integration tests failed, see logs appended to jobs and cluster status in logs"
133-
sh "docker exec -it k3d-${clusterName}-server-0 kubectl get all -A"
134-
}
135128
}
129+
130+
if (ret > 0 ) {
131+
if (fileExists('playground-logs-of-failed-jobs')) {
132+
archiveArtifacts artifacts: 'playground-logs-of-failed-jobs/*.log'
133+
}
134+
unstable "Integration tests failed, see logs appended to jobs and cluster status in logs"
135+
sh "docker exec k3d-${clusterName}-server-0 kubectl get all -A"
136+
}
136137
}
137138

138139
stage('Push image') {

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ See [parameters](#additional-parameters) for examples.
832832
* `--jenkins-username`,
833833
* `--jenkins-password`
834834

835+
To apply additional global environments for jenkins you can use `--jenkins-additional-envs "KEY1=value1,KEY2=value2"` parameter.
836+
835837
Note that the [example applications](#example-applications) pipelines will only run on a Jenkins that uses agents that provide
836838
a docker host. That is, Jenkins must be able to run e.g. `docker ps` successfully on the agent.
837839

applications/argocd/nginx/helm-jenkins/Jenkinsfile.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ String getConfigRepositoryPRBaseUrl() { env.SCMM_URL }
66
String getConfigRepositoryPRRepo() { '${namePrefix}argocd/example-apps' }
77
<#noparse>
88
String getCesBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/ces-build-lib/" }
9-
String getCesBuildLibVersion() { '1.64.1' }
9+
String getCesBuildLibVersion() { '2.5.0' }
1010
String getGitOpsBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/gitops-build-lib" }
11-
String getGitOpsBuildLibVersion() { '0.4.0'}
11+
String getGitOpsBuildLibVersion() { '0.7.0'}
1212
String getHelmChartRepository() { "https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami" }
1313
String getHelmChartName() { "nginx" }
1414
String getHelmChartVersion() { "13.2.21" }

applications/argocd/petclinic/helm/Jenkinsfile.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ String getDockerRegistryProxyCredentials() { 'registry-proxy-user' }
1616

1717
<#noparse>
1818
String getCesBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/ces-build-lib/" }
19-
String getCesBuildLibVersion() { '2.2.0' }
19+
String getCesBuildLibVersion() { '2.5.0' }
2020
String getGitOpsBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/gitops-build-lib" }
21-
String getGitOpsBuildLibVersion() { '0.4.0'}
21+
String getGitOpsBuildLibVersion() { '0.7.0'}
2222
String getHelmChartRepository() { "${env.SCMM_URL}/repo/3rd-party-dependencies/spring-boot-helm-chart-with-dependency" }
2323
String getHelmChartVersion() { "1.0.0" }
2424
String getMainBranch() { 'main' }

applications/argocd/petclinic/plain-k8s/Jenkinsfile.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ String getDockerRegistryProxyCredentials() { 'registry-proxy-user' }
1616

1717
<#noparse>
1818
String getCesBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/ces-build-lib" }
19-
String getCesBuildLibVersion() { '2.2.0' }
19+
String getCesBuildLibVersion() { '2.5.0' }
2020
String getGitOpsBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/gitops-build-lib" }
21-
String getGitOpsBuildLibVersion() { '0.4.0'}
21+
String getGitOpsBuildLibVersion() { '0.7.0'}
2222

2323
loadLibraries()
2424

docs/configuration.schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,13 @@
474474
"additionalProperties" : false,
475475
"description" : "Common Config parameters for the Helm package manager: Name of Chart (chart), URl of Helm-Repository (repoURL) and Chart Version (version). Note: These config is intended to obtain the chart from a different source (e.g. in air-gapped envs), not to use a different version of a helm chart. Using a different helm chart or version to the one used in the GOP version will likely cause errors."
476476
},
477+
"jenkinsAdditionalEnvs" : {
478+
"type" : "object",
479+
"additionalProperties" : {
480+
"type" : "string"
481+
},
482+
"description" : "Set additional environments to Jenkins"
483+
},
477484
"mavenCentralMirror" : {
478485
"type" : "string",
479486
"description" : "URL for maven mirror, used by applications built in Jenkins"

exercises/nginx-validation/Jenkinsfile.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ String getConfigRepositoryPRBaseUrl() { env.SCMM_URL }
66
String getConfigRepositoryPRRepo() { '${namePrefix}argocd/example-apps' }
77
<#noparse>
88
String getCesBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/ces-build-lib/" }
9-
String getCesBuildLibVersion() { '1.64.1' }
9+
String getCesBuildLibVersion() { '2.5.0' }
1010
String getGitOpsBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/gitops-build-lib" }
11-
String getGitOpsBuildLibVersion() { '0.4.0'}
11+
String getGitOpsBuildLibVersion() { '0.7.0'}
1212
String getHelmChartRepository() { "https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami" }
1313
String getHelmChartName() { "nginx" }
1414
String getHelmChartVersion() { "13.2.21" }

exercises/petclinic-helm/Jenkinsfile.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ String getDockerRegistryProxyBaseUrl() { env.${namePrefixForEnvVars}REGISTRY_PRO
1515
</#if>
1616
<#noparse>
1717
String getCesBuildLibRepo() { "${env.SCMM_URL}/repo/3rd-party-dependencies/ces-build-lib/" }
18-
String getCesBuildLibVersion() { '2.2.0' }
18+
String getCesBuildLibVersion() { '2.5.0' }
1919
String getHelmChartRepository() { "${env.SCMM_URL}/repo/3rd-party-dependencies/spring-boot-helm-chart-with-dependency" }
2020
String getHelmChartVersion() { "1.0.0" }
2121
String getMainBranch() { 'main' }

src/main/groovy/com/cloudogu/gitops/cli/GitopsPlaygroundCli.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class GitopsPlaygroundCli implements Runnable {
6767
private String jenkinsMetricsPassword
6868
@Option(names = ['--maven-central-mirror'], description = MAVEN_CENTRAL_MIRROR_DESCRIPTION)
6969
private String mavenCentralMirror
70+
@Option(names = ["--jenkins-additional-envs"], description = JENKINS_ADDITIONAL_ENVS_DESCRIPTION, split = ",", required = false)
71+
Map<String, String> jenkinsAdditionalEnvs
7072

7173
// args group scm
7274
@Option(names = ['--scmm-url'], description = SCMM_URL_DESCRIPTION)
@@ -395,6 +397,7 @@ class GitopsPlaygroundCli implements Runnable {
395397
metricsUsername: jenkinsMetricsUsername,
396398
metricsPassword: jenkinsMetricsPassword,
397399
mavenCentralMirror: mavenCentralMirror,
400+
jenkinsAdditionalEnvs: jenkinsAdditionalEnvs,
398401
],
399402
scmm : [
400403
url : scmmUrl,

src/main/groovy/com/cloudogu/gitops/config/ApplicationConfigurator.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class ApplicationConfigurator {
7373
version: '5.5.11'
7474
],
7575
mavenCentralMirror: '',
76+
jenkinsAdditionalEnvs: [:]
7677
],
7778
scmm : [
7879
internal: true, // Set dynamically

0 commit comments

Comments
 (0)