Closed quenteum closed 6 months ago
I added a possible workaround: https://github.com/opendevstack/ods-jenkins-shared-library/pull/1026
This solves the problem as the images are imported before doing the rollout for each deployment. Then the deployment to qa/test works as expeted.
There is still the problem that the loop over all deployments does the helm rollout multiple times for every deployment in chart/ods-deployments.json. Only the first one has a real effect as it deploys everything.
I think it's not possible to change the structure of this json as it is used by many components but one idea i discussed with Martin Marcher would be to have only one DeploymentMean containing the deployments, so that we will do only on helm rollout containing all deployments.
Hello @quenteum thanks for the fix, we're closing down some of our existing work and will look into this soon.
Describe the bug We use a mono repo with multiple services inside. The build and the release to dev using the release-manager is working fine. When trying to release to qa/test we also had the bug https://github.com/opendevstack/ods-jenkins-shared-library/issues/1011. As i was verifying the bugfix https://github.com/opendevstack/ods-jenkins-shared-library/issues/1011 i have found another bug.
When releasing to qa/test only the image of the first deployment in the file chart/ods-deployments.json is imported:
Importing images - deployment: first-deployment, container: first-deployment, image: first-deployment@sha256:hash, source: source-ns
oc -n namespace-test tag source-ns/first-deployment@sha256:hash first-deployment:ods-generated-v20230728-3-0b353-Q Tag first-deployment:ods-generated-v20230728-3-0b353-Q set to source-ns/first-deployment@sha256:hash.
oc -n namespace-test tag first-deployment:ods-generated-v20230728-3-0b353-Q first-deployment:latest Tag first-deployment:latest set to first-deployment@sha256:hash.
After importing the image for the frist deployment the rollout using helm starts:
DEBUG: Helm Config for first-deployment -> [type:helm, selector:app=namespace-app, chartDir:chart, helmReleaseName:app, helmEnvBasedValuesFiles:[values.env.yaml], helmValuesFiles:[values.yaml], helmValues:[registry:image-registry.openshift-image-registry.svc:5000, componentId:app], helmDefaultFlags:[--install, --atomic], helmAdditionalFlags:[]]
As helm does an atomic rollout all deployment are rolled out together. The rollout fails as there is only the image for the first one is present in the system. The problem can be found in the file src/org/ods/orchestration/phases/DeployOdsComponent.groovy.
At the moment there is a loop deploymentDescriptor.deployments.each { String deploymentName, Map deployment -> which imports the image for every deployment and then also does a deployment for the deploymentMean applyTemplates(openShiftDir, deploymentMean) which then causes the error. I'll provide a workaround as PR.
To Reproduce Steps to reproduce the behavior:
Expected behavior All images should be imported before doing an atomic helm rollout. Separate the image import to qa/test from the deployment. Do the atomic helm deployment outside of the loop only once not for every deployment in chart/ods-deployments.json.
Affected version (please complete the following information):