Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

mahdipub
Copy link
Contributor

@mahdipub mahdipub commented Jul 9, 2024

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: [email protected]

Copy link

github-actions bot commented Jul 9, 2024

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
Copy link
Member

sxa commented Jul 15, 2024

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 :-)

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: [email protected]
@mahdipub mahdipub force-pushed the dockerPullFromNonDefaultReg branch from 95e4911 to c82bfce Compare July 15, 2024 15:45
@mahdipub
Copy link
Contributor Author

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.

Copy link
Member

@sxa sxa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Yes that makes sense. Thanks for the explanation - if you pull from another public repo you could just prefix the image with the registry host but since you need authentication that isn't possible.
LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants