-
Notifications
You must be signed in to change notification settings - Fork 109
Enable specifying whether or not to pull the docker image from ECR #6836
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
| # gracefully return the docker image name as it is. Pulling docker image in Linux | ||
| # job could then download the pre-built image as usual | ||
| if [[ ! -d "${DOCKER_BUILD_DIR}" ]] || [[ ! -f "${DOCKER_BUILD_DIR}/${DOCKER_BUILD_SCRIPT}" ]]; then | ||
| if [[ -d "${DOCKER_BUILD_DIR}" ]] && [[ -f "${DOCKER_BUILD_DIR}/${DOCKER_BUILD_SCRIPT}" ]] && [[ "${USE_CUSTOM_DOCKER_REGISTRY}" == "true" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Inverted the if statement for better readability
| echo "docker-image=${DOCKER_IMAGE_NAME}" >> "${GITHUB_OUTPUT}" | ||
| echo "There is no Docker build script in ${REPO_NAME} repo, skipping..." | ||
| echo "There is no Docker build script in ${REPO_NAME} repo, or not using custom registry, skipping..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was tripping me up. I tried to make it more clear and concise.
| echo "There is no Docker build script in ${REPO_NAME} repo, or not using custom registry, skipping..." | |
| echo "No Docker build script in ${REPO_NAME} repo or custom registry not used, skipping..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I changed the wording even more.
.github/workflows/linux_job_v2.yml
Outdated
| default: "" | ||
| type: string | ||
| use-custom-docker-registry: | ||
| description: "Use the custom ECR registry hosted on AWS. Only takes effect if there's a build.sh script in the docker-build-dir." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| description: "Use the custom ECR registry hosted on AWS. Only takes effect if there's a build.sh script in the docker-build-dir." | |
| description: "Use the custom ECR registry. Applies only if build.sh exists in docker-build-dir." |
.github/workflows/linux_job_v2.yml
Outdated
| - name: Calculate docker image | ||
| id: calculate-docker-image | ||
| uses: ./test-infra/.github/actions/calculate-docker-image | ||
| uses: pytorch/test-infra/.github/actions/calculate-docker-image@zainr/nova-gpu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: revert this before merging
.github/workflows/linux_job_v2.yml
Outdated
| - name: Calculate docker image | ||
| id: calculate-docker-image | ||
| uses: ./test-infra/.github/actions/calculate-docker-image | ||
| uses: pytorch/test-infra/.github/actions/calculate-docker-image@zainr/nova-gpu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this mostly for testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, I left a "todo: revert this" comment on it just a couple mins before you posted this :)
Removed now
git pus
We originally tried to simplify the number of parameters users had to pass in to linux_job_v2 by using the existence of the docker build script as a heuristic.
That worked for a while, but that heuristic is now starting to break. If a repo has an unrelated docker build script located in
.ci/docker/build.sh, we assume it wants to pull from our custom ECR path instead of docker hub.Our ideal end state would now look like:
That migration requires many repos to be edited with a fix however, so for now we're having the following non-breaking change:
Have an explicit parameter on linux_job_v2 that needs to be set if a repo wants to use our ECR registries. Set it to TRUE by default, with the calculate-docker-image logic being "If param is set to True AND special docker file exists" then we use the ECR registry. If either is false, use docker hub
No migrations needed in the short term. We can later migrate domain repos to explicitly set this setting and then change the default to FALSE, but that's P2
Testing: Ran this job against it, and it only failed due to an error in the script inputted to the workflow, which is ignorable