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

feat(ci): Verify remaining toolboxes #779

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/build-fedora-toolbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
schedule:
- cron: '20 22 * * *' # 10:20pm everyday
pull_request:
merge_group:
merge_group:
workflow_dispatch:
env:
IMAGE_NAME: fedora-toolbox
Expand All @@ -24,11 +24,16 @@ jobs:
id-token: write
strategy:
fail-fast: false
steps:
steps:
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
uses: actions/checkout@v4


- name: Verify Fedora distrobox
uses: EyeCantCU/cosign-action/verify@v0.2.1
with:
containers: fedora-distrobox:latest

# Build metadata
- name: Image Metadata
uses: docker/metadata-action@v5
Expand All @@ -50,7 +55,7 @@ jobs:
tags: ${{ env.IMAGE_TAGS }}
labels: ${{ steps.meta.outputs.labels }}
oci: false

# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
# https://github.com/macbre/push-to-ghcr/issues/12
- name: Lowercase Registry
Expand All @@ -75,15 +80,15 @@ jobs:
password: ${{ env.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust
Comment on lines 81 to 82
Copy link
Member

@p5 p5 Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we have this here still? I don't believe it's required and provides even more security for in-transit communication

Content trust gives you the ability to verify both the integrity and the publisher of all the data received from a registry over any channel.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I had to guess, this is because it would require us to trust the container locally before pushing it to the registry. In Red Hat's own workflows, for push-to-registry, they disable content trust:

https://github.com/search?q=repo%3Aredhat-actions%2Fpush-to-registry%20--disable-content-trust&type=code

However, I do believe this is something that would be worth looking into. At the very least, we may be able to emulate this behavior by signing the container locally with cosign before a push, and then verifying it after

Copy link
Member

@p5 p5 Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to remove the flag if nobody remembers why it's there.
It works without it in my older workflow that use these actions. Have made a PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great!


- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Sign container
- uses: sigstore/cosign-installer@v3.3.0
if: github.event_name != 'pull_request'
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/build-ubuntu-toolbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
schedule:
- cron: '20 22 * * *' # 10:20pm everyday
pull_request:
merge_group:
merge_group:
workflow_dispatch:
env:
IMAGE_NAME: ubuntu-toolbox
Expand All @@ -24,11 +24,18 @@ jobs:
id-token: write
strategy:
fail-fast: false
steps:
steps:
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
uses: actions/checkout@v4


- name: Verify Ubuntu toolbox
uses: EyeCantCU/cosign-action/verify@v0.2.1
with:
containers: ubuntu-toolbox:22.04
pubkey: https://raw.githubusercontent.com/toolbx-images/images/main/quay.io-toolbx-images.pub
registry: quay.io/toolbx-images

# Build metadata
- name: Image Metadata
uses: docker/metadata-action@v5
Expand All @@ -50,7 +57,7 @@ jobs:
tags: ${{ env.IMAGE_TAGS }}
labels: ${{ steps.meta.outputs.labels }}
oci: false

# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
# https://github.com/macbre/push-to-ghcr/issues/12
- name: Lowercase Registry
Expand All @@ -75,15 +82,15 @@ jobs:
password: ${{ env.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Sign container
- uses: sigstore/cosign-installer@v3.3.0
if: github.event_name != 'pull_request'
Expand Down