Skip to content

Handle docker image digest

Filip Aleksic requested to merge faleksic-digest-as-image-version into main

What does this MR do?

Previously docker image digest version would default to latest, with this change specifying the digest without the version will use that sha instead of the latest image.

Why was this MR needed?

The current implementation does not use any digest version and defaults to latest.

The docker pull mentions that to pull an image:

docker pull [OPTIONS] NAME[:TAG|@DIGEST], meaning it can be either a tag such as :latest or :v1.2.3, but it can also be a digest, where the digest is a sha256:64-chars-here type of format.

What's the best way to test this MR?

Perhaps with the following .gitlab-ci.yml:

connection-test-name-only:
  services:
    - name: redis
      alias: redis
  image: redis
  script:
  - redis-cli -h redis PING
  - redis-cli -h redis --version

connection-test-digest:
  services:
    - redis@sha256:d4c84914b872521e215f77d8845914c2268a96b0e35bacd5691e1f5e1f88b500
  image: redis
  script:
    - redis-cli -h redis PING
    - redis-cli -h redis --version

connection-test-tag-and-digest:
  services:
    - name: redis:bookworm@sha256:d4c84914b872521e215f77d8845914c2268a96b0e35bacd5691e1f5e1f88b500
      alias: redis
  image: redis:bookworm@sha256:d4c84914b872521e215f77d8845914c2268a96b0e35bacd5691e1f5e1f88b500
  script:
  - redis-cli -h redis PING

connection-test-tag:
  services:
    - name: redis:bookworm
      alias: redis
  image: redis:bookworm
  script:
  - redis-cli -h redis PING

What are the relevant issue numbers?

Fixes #31049

Merge request reports