-
Notifications
You must be signed in to change notification settings - Fork 22
Make the images available in ghcr.io #37
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Build and Push Docker Image to GHCR | ||
|
||
on: push | ||
|
||
permissions: | ||
contents: read # Required to checkout the repo code | ||
packages: write # Required to push packages to GHCR | ||
|
||
jobs: | ||
xcp-ng-build-env-82: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver: docker-container | ||
- uses: docker/login-action@v3 | ||
if: github.ref == 'refs/heads/master' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow | ||
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub | ||
- uses: docker/build-push-action@v5 # Using v5 for latest features | ||
with: | ||
context: ./src/xcp_ng_dev/ | ||
file: ./src/xcp_ng_dev/files/Dockerfile-8.x | ||
push: ${{ github.ref == 'refs/heads/master' }} | ||
tags: ghcr.io/${{ github.repository }}:8.2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We likely want those official floating tags to be set only when run on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The workflow is only configured on master. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actually it seems to be configured for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, there would be a reason for allowing it to run not just on master: detecting pipeline errors before they reach There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, that would be nice. Maybe push to the registry when on the master branch then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This comes at the cost of extra complexity: all steps now have a branch check. I'm surprised that the push action doesn't support logging in, or use protected deployments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit more complex not to upload, but we spare the complexity to clean up temporary images.
psafont marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cache-from: type=gha,scope=${{ github.ref_name }}-82 # Cache layers to speed up builds | ||
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-82 # Store layers in cache for future builds | ||
build-args: | | ||
XCP_NG_BRANCH=8.2 | ||
platforms: | | ||
linux/amd64 | ||
xcp-ng-build-env-83: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver: docker-container | ||
- uses: docker/login-action@v3 | ||
if: github.ref == 'refs/heads/master' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow | ||
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub | ||
- uses: docker/build-push-action@v5 # Using v5 for latest features | ||
with: | ||
context: ./src/xcp_ng_dev/ | ||
file: ./src/xcp_ng_dev/files/Dockerfile-8.x | ||
push: ${{ github.ref == 'refs/heads/master' }} | ||
tags: ghcr.io/${{ github.repository }}:8.3 | ||
cache-from: type=gha,scope=${{ github.ref_name }}-83 # Cache layers to speed up builds | ||
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-83 # Store layers in cache for future builds | ||
platforms: | | ||
linux/amd64 | ||
# TODO: uncomment once we have a public xcp-ng 9.0 repository | ||
# xcp-ng-build-env-90: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: docker/setup-buildx-action@v3 | ||
# with: | ||
# driver: docker-container | ||
# - uses: docker/login-action@v3 | ||
# if: github.ref == 'refs/heads/master' | ||
# with: | ||
# registry: ghcr.io | ||
# username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow | ||
# password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub | ||
# - uses: docker/build-push-action@v5 # Using v5 for latest features | ||
# with: | ||
# context: ./src/xcp_ng_dev/ | ||
# file: ./src/xcp_ng_dev/files/Dockerfile-9.x | ||
# platforms: | | ||
# linux/amd64/v2 | ||
glehmann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# push: ${{ github.ref == 'refs/heads/master' }} | ||
# tags: ghcr.io/${{ github.repository }}:9.0 | ||
# cache-from: type=gha,scope=${{ github.ref_name }}-90 # Cache layers to speed up builds | ||
# cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-90 # Store layers in cache for future builds |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the workflow do anything if it's not on master branch? I would rather limit the branches where it's run here rather than doing it per-step, now there are 4 places where this branch limitation needs to be placed (6 when the 9.0 is enabled, which is ripe for errors)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It builds the image on all the branches, but only uploads when on
master