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

[BUG] container images are built without the commit SHA #75

Closed
maiqueb opened this issue Nov 15, 2022 · 4 comments · Fixed by #76
Closed

[BUG] container images are built without the commit SHA #75

maiqueb opened this issue Nov 15, 2022 · 4 comments · Fixed by #76

Comments

@maiqueb
Copy link
Collaborator

maiqueb commented Nov 15, 2022

Describe the bug
When I check the commit SHA from a container image provided by this repo's package, I don't see the commit SHA from which the container image was built.

This NONE is the default value specified in the container image.

Expected behavior
The command below should output the commit ID from which the container image was built.

To Reproduce
Steps to reproduce the behavior:

skopeo inspect docker://ghcr.io/k8snetworkplumbingwg/multus-dynamic-networks-controller:latest-amd64 -f '{{ index .Labels "multi.GIT_SHA" }}'
NONE

Environment:

  • multus-dynamic-networks-controller version: N/A
  • Kubernetes version (use kubectl version): N/A
  • Network-attachment-definition: N/A
  • OS (e.g. from /etc/os-release): N/A
  • Controller configuration (criSocketPath / multusSocketPath): N/A
  • Kernel (e.g. uname -a): N/A
  • Others: N/A

Additional info / context
Add any other information / context about the problem here.

@maiqueb
Copy link
Collaborator Author

maiqueb commented Nov 15, 2022

Failing w/

[Invalid workflow file: .github/workflows/image-push.yaml#L47](https://github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller/actions/runs/3473197429/workflow)
The workflow is not valid. .github/workflows/image-push.yaml (Line: 47, Col: 13): A sequence was not expected

in this github action.

@maiqueb maiqueb reopened this Nov 15, 2022
@maiqueb
Copy link
Collaborator Author

maiqueb commented Nov 15, 2022

Still not working ...

skopeo inspect docker://ghcr.io/k8snetworkplumbingwg/multus-dynamic-networks-controller:latest-amd64 -f '{{ index .Labels "multi.GIT_SHA" }}'
NONE

@oshoval
Copy link
Member

oshoval commented Nov 16, 2022

Maybe worth to take a look here docker/build-push-action#557 ?
unless it is the same.. (worth to make sure indent and such)

Imo best just to take this and adapt your code to

      - name: Build and Push
        if: github.event_name != 'pull_request'
        uses: docker/build-push-action@v2
        with:
          context: .
          platforms: linux/amd64,linux/arm64,linux/arm/v7
          push: true
          target: production
          tags: ${{ env.docker_tags }}
          build-args: |
            commit_hash=${{ env.git_commit_hash }}
            commit_date=${{ env.git_commit_date }}

it can be for example the env.git_commit_hash that fixes it

@maiqueb
Copy link
Collaborator Author

maiqueb commented Nov 16, 2022

Fixed in #80 .

@maiqueb maiqueb closed this as completed Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants