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

ci: use git context #90

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
38 changes: 21 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ jobs:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
fetch-depth: 0
version: ${{ env.BUILDX_VERSION }}
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Docker meta
id: meta
Expand All @@ -44,16 +49,6 @@ jobs:
org.opencontainers.image.title=BuildKit Syft scanner
org.opencontainers.image.description=SBOM generation for BuildKit images
org.opencontainers.image.vendor=Docker Inc.
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.BUILDX_VERSION }}
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
Expand All @@ -65,19 +60,28 @@ jobs:
name: Build
uses: docker/bake-action@v4
with:
source: "{{defaultContext}}"
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
cwd://${{ steps.meta.outputs.bake-file }}
targets: image-all
push: ${{ github.event_name != 'pull_request' }}
set: |
*.cache-from=type=gha,scope=image
*.cache-to=type=gha,scope=image,mode=max
*.attest=type=sbom

dockerhub-readme:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
needs:
- build
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Update repo description
if: github.event_name != 'pull_request'
uses: peter-evans/dockerhub-description@v4
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ vars.DOCKERPUBLICBOT_USERNAME }}
password: ${{ secrets.DOCKERPUBLICBOT_DELETE_PAT }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ jobs:
- validate-license
- validate-vendor
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Run
uses: docker/bake-action@v4
with:
source: "{{defaultContext}}"
targets: ${{ matrix.target }}
1 change: 1 addition & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ variable "IMAGE_LOCAL" {

target "_common" {
args = {
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
GO_VERSION = GO_VERSION
GIT_REF = GITHUB_REF
}
Expand Down