generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move to reusable docker workflows
- Loading branch information
1 parent
5d47ef4
commit d1d3c9c
Showing
4 changed files
with
57 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Save Docker Images | ||
description: Builds all docker images and saves them as artifacts | ||
inputs: | ||
service: | ||
description: The service to build | ||
required: true | ||
runs: | ||
using: "composite" | ||
# Make sure to keep these cache entries in sync with those in writecache.yml | ||
steps: | ||
- name: Init Hermit | ||
uses: cashapp/[email protected] | ||
- name: Build Docker Image | ||
shell: bash | ||
run: | | ||
just build-docker ${{ inputs.service }} | ||
mkdir -p artifacts/ftl-${{ inputs.service }} | ||
docker save -o artifacts/ftl-${{ inputs.service }}/ftl-${{ inputs.service }}.tar ftl0/ftl-${{ inputs.service }}:latest | ||
- name: Temporarily save Docker image | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: docker-${{ inputs.service }}-artifact | ||
path: artifacts/ftl-${{ inputs.service }} | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Shard Docker Builds | ||
description: Outputs a matrix of all services to build | ||
outputs: | ||
matrix: | ||
description: A matrix of all services to build | ||
value: ${{ steps.set-matrix.outputs.matrix }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: cashapp/[email protected] | ||
- id: set-matrix | ||
shell: bash | ||
run: echo "matrix=$(just list-docker-images | tr -d '\n' | jq -R -s -c 'split(" ")')" >> "$GITHUB_OUTPUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,24 +224,25 @@ jobs: | |
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cashapp/[email protected] | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- id: set-matrix | ||
run: echo "matrix=$(just list-docker-images | tr -d '\n' | jq -R -s -c 'split(" ")')" >> "$GITHUB_OUTPUT" | ||
docker-build: | ||
name: Shard Docker Builds | ||
uses: ./.github/actions/shard-docker-builds | ||
build-docker-images: | ||
name: Build ${{ matrix.service }} Docker Image | ||
needs: docker-shard | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
service: ${{ fromJson(needs.docker-shard.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cashapp/[email protected] | ||
- uses: ./.github/actions/build-cache | ||
- name: Build Docker Image | ||
run: just build-docker ${{ matrix.service }} | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Build Image and Save | ||
uses: ./.github/actions/save-docker-image | ||
with: | ||
service: ${{ matrix.service }} | ||
console-e2e: | ||
name: Console e2e | ||
# if: github.event_name != 'pull_request' || github.event.action == 'enqueued' || contains( github.event.pull_request.labels.*.name, 'run-all') | ||
|
@@ -394,13 +395,13 @@ jobs: | |
fi | ||
docker-success: | ||
name: Docker Success | ||
needs: [docker-build] | ||
needs: [build-docker-images] | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} | ||
steps: | ||
- name: Check docker builds result | ||
run: | | ||
if [[ "${{ needs.docker-build.result }}" == "failure" ]]; then | ||
if [[ "${{ needs.build-docker-images.result }}" == "failure" ]]; then | ||
echo "Docker builds failed" | ||
exit 1 | ||
else | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,11 @@ jobs: | |
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cashapp/[email protected] | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- id: set-matrix | ||
run: echo "matrix=$(just list-docker-images | tr -d '\n' | jq -R -s -c 'split(" ")')" >> "$GITHUB_OUTPUT" | ||
name: Shard Docker Builds | ||
uses: ./.github/actions/shard-docker-builds | ||
build-docker-images: | ||
name: Build ${{ matrix.service }} Docker Image | ||
needs: docker-shard | ||
|
@@ -24,19 +25,10 @@ jobs: | |
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Init Hermit | ||
uses: cashapp/[email protected] | ||
- name: Build Docker Image | ||
run: | | ||
just build-docker ${{ matrix.service }} | ||
mkdir -p artifacts/ftl-${{ matrix.service }} | ||
docker save -o artifacts/ftl-${{ matrix.service }}/ftl-${{ matrix.service }}.tar ftl0/ftl-${{ matrix.service }}:latest | ||
- name: Temporarily save Docker image | ||
uses: actions/upload-artifact@v4 | ||
- name: Build Image and Save | ||
uses: ./.github/actions/save-docker-image | ||
with: | ||
name: docker-${{ matrix.service }}-artifact | ||
path: artifacts/ftl-${{ matrix.service }} | ||
retention-days: 1 | ||
service: ${{ matrix.service }} | ||
release-docker: | ||
name: Release Docker Images | ||
runs-on: ubuntu-latest | ||
|