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

fix: handle Docker image tags with SHA256 hash #313

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mkusaka
Copy link

@mkusaka mkusaka commented Nov 18, 2024

Description

Fixes an issue where Docker images with SHA256 hashes in their tags were being incorrectly validated, resulting in false "Missing image tag" errors. The fix modifies the tag parsing logic to properly handle tags that include SHA256 hashes by extracting only the version number portion for validation purposes.

For example, with an image like cimg/node:22.11.0@sha256:76aae59c6259672ab68819b8960de5ef571394681089eab2b576f85f080c73ba, the system now correctly extracts 22.11.0 as the tag for validation while preserving the full reference.

version: 2.1

jobs:
  build:
    docker:
      - image: cimg/node:22.11.0@sha256:76aae59c6259672ab68819b8960de5ef571394681089eab2b576f85f080c73ba
    steps:
      - checkout
      - run:
          name: Install Dependencies
          command: npm install
workflows:
  build:
    jobs:
      - build

image

Implementation details

  • Modified parseDockerImageValue in dockerImageParser.go to split tags at "@" and use only the version part for validation
  • Added test case in dockerImageParser_test.go to verify correct handling of tags with SHA256 hashes
  • Preserves the full image reference including SHA256 hash in FullPath field

Split Docker image tags at '@' to properly validate version numbers when SHA256 hash is present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant