Skip to content

Commit

Permalink
Merge pull request #90 from crazy-max/ci-git-context
Browse files Browse the repository at this point in the history
ci: use git context
  • Loading branch information
crazy-max authored Jan 8, 2025
2 parents 6276d5a + 44e09bd commit a0d8bfd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/buildkit-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ jobs:
create:
runs-on: ubuntu-latest
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
if: ${{ inputs.push }}
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERPUBLICBOT_USERNAME }}
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Create
run: |
Expand Down
52 changes: 28 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,22 @@ jobs:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
fetch-depth: 0
username: ${{ vars.DOCKERPUBLICBOT_USERNAME }}
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
-
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: Docker meta
id: meta
Expand All @@ -44,40 +56,32 @@ 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'
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERPUBLICBOT_USERNAME }}
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
-
name: Build
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
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
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
image=${{ env.BUILDKIT_IMAGE }}
-
name: Build and push Syft Scanner image
uses: docker/bake-action@v5
uses: docker/bake-action@v6
with:
targets: image-local
push: true
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ 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@v5
uses: docker/bake-action@v6
with:
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

0 comments on commit a0d8bfd

Please sign in to comment.