Skip to content

Validate Docker image URLs before attempting to pull

Said Masoud requested to merge smasoud/gitlab-runner:validate-image-urls into master

What does this MR do?

Validates that Docker image URLs defined in .gitlab-ci.yml for a given job is valid and reachable from the job pod.

Why was this MR needed?

Consider the following snippet from .gitlab-ci.yml:

job:
    image: ${DOCKER_BUILDER_IMAGE_US}:${DOCKER_BUILDER_VERSION}

The Docker image URL is constructed using environment variables to enable flexibility with an in-house image. When one or both of these variables are not defined, the job pod times out trying to pull the image:

image

.....then eventually image

This MR fails the job immediately if the defined image is unreachable, or the URL is malformed: image

Are there points in the code the reviewer needs to double check?

Would like feedback on test robustness.

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Edited by Said Masoud

Merge request reports