-
Notifications
You must be signed in to change notification settings - Fork 572
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
Added dockerfile path to image label #212
Conversation
Signed-off-by: Jyotsna Singh <[email protected]>
e4d4ca8
to
720cd85
Compare
Codecov Report
@@ Coverage Diff @@
## master #212 +/- ##
==========================================
- Coverage 73.57% 72.84% -0.73%
==========================================
Files 4 4
Lines 140 151 +11
Branches 24 28 +4
==========================================
+ Hits 103 110 +7
Misses 22 22
- Partials 15 19 +4
Continue to review full report at Codecov.
|
@Josh-01 This is already available through the Docker meta action that has been introduced in the Handle tags and labels example: jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: username/repo
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }} This will produce the following labels for crazy-max/diun repo for example:
And will be handled through the GitHub package page to display the README of the repo. |
e325116
to
638eda3
Compare
Commit sha: 638eda3, Author: Jyotsna Signed-off-by: Jyotsna <[email protected]>
638eda3
to
ed4d53f
Compare
Hi @crazy-max , Thanks for pointing to the docker-meta-action. I went through the examples in the README, but while it may seem to be the solution - our use case is slightly different. In our case , we want to :
Through this change: I have edited the labels in my change, into 'source (OCI spec label)' and a custom label 'dockerfilePath' to comply with the OCI specs. |
Hi @Josh-01,
Sounds good to me to include |
Signed-off-by: Jyotsna <[email protected]>
762820b
to
be3385a
Compare
Hi @crazy-max , Thank you for your inputs - I will make the following changes:
Is there a some way to include the dockerfile-path in the image labels - as that is one of the key traceability fields we require ? Thanks! |
c5deda1
to
5d06edc
Compare
…er input Signed-off-by: Jyotsna <[email protected]>
5d06edc
to
f31af72
Compare
Signed-off-by: Jyotsna <[email protected]>
Signed-off-by: Jyotsna <[email protected]>
@Josh-01 After looking around this feature, it turns out that injecting OCI annotations by default at the creation of the image leads to a confidentiality issue because some private repo are not intended to be disclosed even if the Docker image is public. I'll talk to @tonistiigi about it and we'll give you a feedback. |
Hi @crazy-max / @tonistiigi , Here's a possible solution reg. the confidentiality issue: we could put an explicit flag input - 'traceData' (FALSE by default, optional), We want users to be able use the action for building images and also get the traceability information as seamlessly as possible - which a simple on/off input would effectively be doing. Thanks! |
Signed-off-by: Jyotsna <[email protected]>
Signed-off-by: Jyotsna <[email protected]>
Signed-off-by: Jyotsna <[email protected]>
Hi @crazy-max , @tonistiigi , |
Hi @crazy-max / @tonistiigi - What is your view on user providing consent as part of the explicit input provided ? Pls. let us know if you see any issues with this approach. |
Hi @crazy-max / @tonistiigi - Can you pls let us know if having an explicit flag as input(default NO) helps mitigate the confidentiality concerns ? |
Sorry for the huge delay on this PR but after consideration it seems more appropriate for this to be handled upstream. I think the OCI One solution would be to use our metadata action which you could embed into a workflow template if you want to make things as generic as possible. As I discussed with @clarkbw I think it's better to keep the actions in the current state (login + metadata + qemu + buildx + build-push) and merge them into a single step when nested composite actions will be available. But would need to focus on actions/runner#646 like I said in #208 (comment). |
Agree with this. It would be good to get this discussion going with the OCI group. For now you could append this as a tag to your existing workflows and still retain the OCI labels like so: jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Login to ${{ env.REGISTRY }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: |
${{ steps.meta.outputs.labels }}
docker-file=https://github.com/github/container-registry-playground.git#Dockerfile Perhaps you could use a script and output to determine the location of the |
This change is part of an effort to improve traceability of resources which are built and deployed using GitHub workflows. We want to save the dockerfile path - which is used in building the image - through this action.
Points to note: