adoptium / ci-jenkins-pipelines

jenkins pipeline build scripts
Apache License 2.0
19 stars 71 forks source link

avoids image name error when pulling from non-default registery #1076

Closed mahdipub closed 4 months ago

mahdipub commented 4 months ago

when pulling from a non-default registery, you will have local image in full name include docker registery in it. But the whole pipeline works with DEFAULT behaviour when pulling from dockerhub that creates local image with image name only. This change, adds a tag to pulled local image with image_name only and avoids issue in continue.

Signed-off-by: mahdi@ibm.com

github-actions[bot] commented 4 months ago

Thank you for creating a pull request!

Please check out the information below if you have not made a pull request here before (or if you need a reminder how things work).

Code Quality and Contributing Guidelines

If you have not done so already, please familiarise yourself with our Contributing Guidelines and Code Of Conduct, even if you have contributed before.

Tests

Github actions will run a set of jobs against your PR that will lint and unit test your changes. Keep an eye out for the results from these on the latest commit you submitted. For more information, please see our testing documentation.

In order to run the advanced pipeline tests (executing a set of mock pipelines), it requires an admin to post run tests on this PR. If you are not an admin, please ask for one's attention in #infrastructure on Slack or ping one here. To run full set of tests, use "run tests"; a subset of tests on specific jdk version, use "run tests quick 11,21"

sxa commented 4 months ago

Hi @mahdipub I'm struggling a bit to understand the description of this PR. Can you provide an example of what situation this is fixing? I just want to make sure this is clear before approving. We have some cider in first handling local images and I want to make sure this doesn't result in any conflicts :-)

mahdipub commented 4 months ago

Hi @mahdipub I'm struggling a bit to understand the description of this PR. Can you provide an example of what situation this is fixing? I just want to make sure this is clear before approving. We have some cider in first handling local images and I want to make sure this doesn't result in any conflicts :-)

@sxa Sure. Here is an example conf we set for an image which comes from local artifactory (not dockerhub): https://github.com/ibmruntimes/ci-jenkins-pipelines/blob/7098566e754a889b797b883e512303564cae1739/pipelines/jobs/configurations/jdk11u_pipeline_config.groovy#L124

### jdk11u_pipeline_config.groovy

     dockerImage: 'sys-rt-docker-local/semeru/s390_rhel7_build_image',
     dockerRegistry: 'https://docker-na.artifactory.swg-devops.com/',

When we pull image, if the registry is dockerhub, then local image name will be equal to dockerImage config entry. But when the registry is not dockerhub then, the image will be dockerRegistry + dockerImage. But the whole pipeline only refer dockerImage which works only when pulling from default registry. e.g here

This change tries to add a shortened tag equal to dockerImage to let other calls referring dockerImage to work without issue.