Skip to content

Commit

Permalink
Merge branch 'bug/1066-globally-injected-variables-do-not-work-in-sub…
Browse files Browse the repository at this point in the history
…charts-dependencies' into ordrv-production-fix

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
serverhorror committed Mar 6, 2024
2 parents 2d055b6 + f5550e2 commit 93fcc0f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased
* Fix documentation refers to qs with prefix infra- however there are only inf- quickstarters ([#1060](https://github.com/opendevstack/ods-jenkins-shared-library/issues/1060))
* Fix Tailor deployment drifts for D, Q envs ([#1055](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1055))
* Fix Globally injected variables do not work in subcharts/dependencies ([#1066](https://github.com/opendevstack/ods-jenkins-shared-library/issues/1066))
* Update api version in ocp templates for image, buildconfig, route and deploymentconfig ([#1072](https://github.com/opendevstack/ods-jenkins-shared-library/issues/1072))

## [4.3.4] - 2024-02-20
Expand Down
12 changes: 12 additions & 0 deletions src/org/ods/component/HelmDeploymentStrategy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,21 @@ class HelmDeploymentStrategy extends AbstractDeploymentStrategy {
// we persist the original ones set from outside - here we just add ours
Map mergedHelmValues = [:]
mergedHelmValues << options.helmValues

// we add the global ones - this allows usage in subcharts
// TODO: is this really needed? - we could use *just* the global ones
// TODO: how do we know we are not overriding something the user defined?
options.helmValues.each { key, value ->
mergedHelmValues["global.${key}"] = value
}

mergedHelmValues['imageNamespace'] = targetProject
mergedHelmValues['imageTag'] = options.imageTag

// we also add the predefined ones as these are in use by the library
mergedHelmValues['global.imageNamespace'] = targetProject
mergedHelmValues['global.imageTag'] = options.imageTag

// deal with dynamic value files - which are env dependent
def mergedHelmValuesFiles = []
mergedHelmValuesFiles.addAll(options.helmValuesFiles)
Expand Down
5 changes: 4 additions & 1 deletion src/org/ods/orchestration/phases/DeployOdsComponent.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ class DeployOdsComponent {
Map<String, String> helmMergedValues = [
"imageTag": project.targetTag,
"imageNamespace": project.targetProject,
"componentId": deploymentMean.repoId
"componentId": deploymentMean.repoId,
"global.imageTag": project.targetTag,
"global.imageNamespace": project.targetProject,
"global.componentId": deploymentMean.repoId
]
// take the persisted ones.
helmMergedValues << deploymentMean.helmValues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class OdsComponentStageRolloutOpenShiftDeploymentSpec extends PipelineSpockTestB
buildArtifacts.size() > 0
buildArtifacts.deployments['bar-deploymentMean']['type'] == 'helm'

1 * openShiftService.helmUpgrade('foo-dev', 'bar', ['values.yaml'], ['registry':null, 'componentId':'bar', 'imageNamespace':'foo-dev', 'imageTag':'cd3e9082'], ['--install', '--atomic'], [], true)
1 * openShiftService.helmUpgrade('foo-dev', 'bar', ['values.yaml'], ['registry':null, 'componentId':'bar', 'global.registry':null, 'global.componentId':'bar', 'imageNamespace':'foo-dev', 'imageTag':'cd3e9082', 'global.imageNamespace':'foo-dev', 'global.imageTag':'cd3e9082'], ['--install', '--atomic'], [], true)
}

@Unroll
Expand Down

0 comments on commit 93fcc0f

Please sign in to comment.