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

fix: Minor fix to docker bake github actions #529

Merged
merged 8 commits into from
Sep 28, 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- "dev"
tags:
- "v*"

jobs:
Bake-Push-Images:
Expand All @@ -13,12 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set branch name
id: variables
run: |
echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')" >> $GITHUB_OUTPUT
echo "git_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -29,7 +25,7 @@ jobs:
password: "${{ secrets.DOCKER_HUB_PASSWORD }}"

- name: Build and push agent images
uses: docker/bake-action@v3
uses: docker/bake-action@v5
with:
files: |
./docker-bake.hcl
Expand All @@ -38,9 +34,10 @@ jobs:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.TAG=${{ steps.variables.outputs.branch_name }}
*.args.GIT_SHA=${{ steps.variables.outputs.git_sha }}
env:
TAG: ${{ github.ref_name }}
GIT_SHA: ${{ github.sha }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/dev' }}
cancel-in-progress: true
39 changes: 39 additions & 0 deletions .github/workflows/docker-bake-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Bake images on PR
run-name: ${{ github.actor }} is baking images

on:
pull_request:

jobs:
Bake-Images:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: julepai
password: "${{ secrets.DOCKER_HUB_PASSWORD }}"

- name: Bake images
uses: docker/bake-action@v5
with:
files: |
./docker-bake.hcl
targets: agents-api
push: false
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
env:
TAG: pr-run-${{ github.run_number }}-${{ github.run_attempt }}
GIT_SHA: ${{ github.sha }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set git sha
id: variables
run: |
echo "git_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -28,7 +23,7 @@ jobs:
password: "${{ secrets.DOCKER_HUB_PASSWORD }}"

- name: Build and push agent images
uses: docker/bake-action@v3
uses: docker/bake-action@v5
with:
files: |
./docker-bake.hcl
Expand All @@ -37,8 +32,9 @@ jobs:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.TAG=latest
*.args.GIT_SHA=${{ steps.variables.outputs.git_sha }}
env:
TAG: latest
GIT_SHA: ${{ github.sha }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
Loading