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

use workflow dispatch in docker build #1351

Merged
merged 27 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b1e93f5
update Release Action
hakuturu583 Aug 13, 2024
9c868b7
print event_name
hakuturu583 Aug 13, 2024
1e87af8
update push flag
hakuturu583 Aug 14, 2024
7463271
remove debug step
hakuturu583 Aug 14, 2024
ef19148
remove \n
hakuturu583 Aug 14, 2024
0c257cf
configure triggers
hakuturu583 Aug 15, 2024
8abcdf0
empty commit
hakuturu583 Aug 15, 2024
b48ee4d
change trigger
hakuturu583 Aug 19, 2024
ed4731a
modify tag
hakuturu583 Aug 21, 2024
d66b2ff
Merge remote-tracking branch 'origin/master' into feature/trigger_doc…
hakuturu583 Aug 21, 2024
c7d526c
change trigger
hakuturu583 Aug 21, 2024
1e0c013
usw workflow dispatch
hakuturu583 Aug 22, 2024
120d5fe
update Release actions
hakuturu583 Aug 22, 2024
119e0a1
add curl
hakuturu583 Aug 22, 2024
f38b561
change token
hakuturu583 Aug 22, 2024
c15d637
fix typo
hakuturu583 Aug 22, 2024
21732a0
fix typo
hakuturu583 Aug 22, 2024
a432ee7
Merge remote-tracking branch 'origin/master' into feature/use_workflo…
hakuturu583 Aug 22, 2024
477ff25
Merge branch 'master' into feature/use_workflow_dispatch_in_docker_build
hakuturu583 Aug 23, 2024
0bf70d7
Update .github/workflows/Docker.yaml
hakuturu583 Aug 23, 2024
2c9a7ae
Update .github/workflows/Docker.yaml
hakuturu583 Aug 23, 2024
571a6cc
use output
hakuturu583 Aug 23, 2024
c0681ca
update json
hakuturu583 Aug 26, 2024
b431e90
change argument
hakuturu583 Aug 26, 2024
7450367
remove escape
hakuturu583 Aug 26, 2024
c32adba
update Release Action
hakuturu583 Aug 26, 2024
6bc5e6f
Merge branch 'master' into feature/use_workflow_dispatch_in_docker_build
hakuturu583 Aug 26, 2024
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
81 changes: 81 additions & 0 deletions .github/workflows/Docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Docker
on:
pull_request:
paths:
- "**"
- "!docs/**"
- "!README.md"
- "!CONTRIBUTING.md"
hakuturu583 marked this conversation as resolved.
Show resolved Hide resolved
- "!.github/**"
- ".github/workflows/Docker.yaml"
- "!mkdocs.yml"
- "!pyproject.toml"
- "!poetry.lock"
workflow_dispatch:
inputs:
version:
description: version of the scenario_simulator_v2
required: true

jobs:
push_docker:
name: Push Docker Image
runs-on: ubuntu-22.04
timeout-minutes: 720
strategy:
matrix:
rosdistro: [humble]
arch: [amd64]
# Build test for arm64 CPU is broken.
# This is a temporary solution and will be repaired in the future.
# See also https://github.com/tier4/scenario_simulator_v2/pull/1295
# arch: [amd64, arm64]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install docker for ubuntu runner
uses: docker/setup-buildx-action@v3

- name: Install QEMU
uses: docker/setup-qemu-action@v3

- uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build (${{ matrix.arch }})
if: github.event_name == 'pull_request'
uses: docker/bake-action@v3
with:
files: |
./docker-bake.hcl
workdir: .
set: |
*.cache-to=type=gha,mode=max
*.cache-from=type=gha
push: false
targets: |
${{ matrix.rosdistro }}_base_${{ matrix.arch }}

- name: Build and push (${{ matrix.arch }})
if: github.event_name == 'workflow_dispatch'
HansRobo marked this conversation as resolved.
Show resolved Hide resolved
uses: docker/bake-action@v3
with:
files: |
./docker-bake.hcl
workdir: .
set: |
*.cache-to=type=gha,mode=max
*.cache-from=type=gha
*.tags=ghcr.io/tier4/scenario_simulator_v2:humble-${{ github.event.inputs.version }}
push: true
targets: |
${{ matrix.rosdistro }}_base_${{ matrix.arch }}
58 changes: 11 additions & 47 deletions .github/workflows/Release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: levonet/action-restore-branch@master

- name: Install bloom
run: apt update && apt install -y python3-bloom git
run: apt update && apt install -y python3-bloom git curl

- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -142,50 +142,14 @@ jobs:
repo: context.repo.repo,
ref: `heads/${context.payload.pull_request.head.ref}`,
})
push_docker:
needs: release
name: Push Docker Image
runs-on: ubuntu-22.04
timeout-minutes: 720
strategy:
matrix:
rosdistro: [humble]
arch: [amd64]
# Build test for arm64 CPU is broken.
# This is a temporary solution and will be repaired in the future.
# See also https://github.com/tier4/scenario_simulator_v2/pull/1295
# arch: [amd64, arm64]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install docker for ubuntu runner
uses: docker/setup-buildx-action@v3

- name: Install QEMU
uses: docker/setup-qemu-action@v3

- uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push (${{ matrix.arch }})
uses: docker/bake-action@v3
with:
files: |
./docker-bake.hcl
workdir: .
set: |
*.cache-to=type=gha,mode=max
*.cache-from=type=gha
*.tags=ghcr.io/tier4/scenario_simulator_v2:humble-${{ needs.release.outputs.new_version }}
push: ${{ github.event.pull_request.merged == true }}
targets: |
${{ matrix.rosdistro }}_base_${{ matrix.arch }}
- name: Kick docker build action
if: github.event.pull_request.merged == true
run: |
hakuturu583 marked this conversation as resolved.
Show resolved Hide resolved
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.BLOOM_GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/tier4/scenario_simulator_v2/actions/workflows/Docker.yaml/dispatches \
-d '{"ref":"master","inputs":{"version":"${{ steps.new_version.outputs.new_version }}"}}'
Loading