Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nhinze23 committed Sep 11, 2024
2 parents 96b799c + ec374b6 commit b14b80e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.3.0](https://github.com/cloudogu/ces-build-lib/releases/tag/2.3.0) - 2024-09-11
### Changed
- change `k3d.configureComponents` so that `null` values disable single components so they won't be installed.
This is useful if default components like the blueprint-operator have to be disabled.
- Example:
`k3d.configureComponents(["k8s-minio": ["version": "latest", "helmRepositoryNamespace": "k8s"], "k8s-blueprint-operator": null])`


## [2.2.1](https://github.com/cloudogu/ces-build-lib/releases/tag/2.2.1) - 2024-05-16
### Fixed
- [#125] K3d setup waits now until all dogus are rolled out and the setup is really done.
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,15 @@ try {
// your image name may look like this: k3d-citest-123456/your/image:yourTag-1.2.3-dev
// the image name can be applied to your cluster as usual, f. i. with k3d.kubectl() with a customized K8s resource
}
stage('configure components'){
// add additional components
k3d.configureComponents(["k8s-minio" : ["version": "latest", "helmRepositoryNamespace": "k8s"],
"k8s-loki" : ["version": "latest", "helmRepositoryNamespace": "k8s"],
"k8s-promtail" : ["version": "latest", "helmRepositoryNamespace": "k8s"],
"k8s-blueprint-operator": null, // null values will delete components from the config
])
}
stage('execute k8s-ces-setup') {
k3d.setup('0.20.0')
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<groupId>com.cloudogu.ces</groupId>
<artifactId>ces-build-lib</artifactId>
<name>ces-build-lib</name>
<version>2.2.1</version>
<version>2.3.0</version>


<properties>
Expand Down
9 changes: 7 additions & 2 deletions src/com/cloudogu/ces/cesbuildlib/K3d.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,13 @@ class K3d {
void configureComponents(components = [:]) {
def evals = []
components.each { componentName, componentConfig ->
componentConfig.each { configKey, configValue ->
evals << ".components.${componentName}.${configKey} = \\\"${configValue}\\\""
def disableComponent=componentConfig == null
if (disableComponent) {
evals << ".components.${componentName} = null"
} else {
componentConfig.each { configKey, configValue ->
evals << ".components.${componentName}.${configKey} = \\\"${configValue}\\\""
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions test/com/cloudogu/ces/cesbuildlib/K3dTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -617,14 +617,16 @@ spec:
scriptMock.expectedShRetValueForScript.put("yq -i \".components.k8s-etcd.helmRepositoryNamespace = \\\"k8s\\\"\" k3d_values.yaml", "foo")
scriptMock.expectedShRetValueForScript.put("yq -i \".components.k8s-promtail.version = \\\"1.2.3\\\"\" k3d_values.yaml", "foo")
scriptMock.expectedShRetValueForScript.put("yq -i \".components.k8s-promtail.helmRepositoryNamespace = \\\"test_ns\\\"\" k3d_values.yaml", "foo")
scriptMock.expectedShRetValueForScript.put("yq -i \".components.k8s-blueprint-operator = null\" k3d_values.yaml", "foo")

// when
sut.configureComponents(["k8s-etcd" : ["version": "latest", "helmRepositoryNamespace": "k8s"],
"k8s-promtail": ["version": "1.2.3", "helmRepositoryNamespace": "test_ns"]])
"k8s-promtail": ["version": "1.2.3", "helmRepositoryNamespace": "test_ns"],
"k8s-blueprint-operator": null])

// then
assertThat(scriptMock.allActualArgs[0].trim()).isEqualTo("whoami".trim())
assertThat(scriptMock.allActualArgs[1].trim()).isEqualTo("cat /etc/passwd | grep jenkins".trim())
assertThat(scriptMock.allActualArgs[2].trim()).isEqualTo("yq -i \".components.k8s-etcd.version = \\\"latest\\\" | .components.k8s-etcd.helmRepositoryNamespace = \\\"k8s\\\" | .components.k8s-promtail.version = \\\"1.2.3\\\" | .components.k8s-promtail.helmRepositoryNamespace = \\\"test_ns\\\"\" k3d_values.yaml".trim())
assertThat(scriptMock.allActualArgs[2].trim()).isEqualTo("yq -i \".components.k8s-etcd.version = \\\"latest\\\" | .components.k8s-etcd.helmRepositoryNamespace = \\\"k8s\\\" | .components.k8s-promtail.version = \\\"1.2.3\\\" | .components.k8s-promtail.helmRepositoryNamespace = \\\"test_ns\\\" | .components.k8s-blueprint-operator = null\" k3d_values.yaml".trim())
}
}

0 comments on commit b14b80e

Please sign in to comment.