-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci,ansible,images): properly use image tag.
Moreover, added a reusable workflow to build and eventually push images. Images makefile does now support pushing tagged and latest images too now. Signed-off-by: Federico Di Pierro <[email protected]>
- Loading branch information
Showing
7 changed files
with
209 additions
and
108 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 |
---|---|---|
@@ -1,20 +1,18 @@ | ||
name: ansible-lint | ||
on: | ||
pull_request: | ||
pull_request: | ||
|
||
|
||
jobs: | ||
build: | ||
name: Ansible Lint | ||
runs-on: ubuntu-latest | ||
build: | ||
name: Ansible Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
steps: | ||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Run ansible-lint | ||
# replace `main` with any valid ref, or tags like `v6` | ||
uses: ansible/[email protected] # the latest version has a bug that does not run in online mode | ||
with: | ||
path: "ansible-playbooks/" | ||
- name: Run ansible-lint | ||
uses: ansible/[email protected] # the latest version has a bug that does not run in online mode | ||
with: | ||
path: "ansible-playbooks/" |
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 |
---|---|---|
@@ -1,57 +1,20 @@ | ||
name: Build and Push docker images | ||
name: Main CI | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'images/**' | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'images/**' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
group: main_push_images | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Job responsible to test the build of the images and, only on main CI, to push them too. | ||
push-images: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [amd64, arm64] | ||
runs-on: ${{ (matrix.arch == 'arm64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-22.04' }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to Github Packages | ||
if: ${{ github.event_name == 'push' }} | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Sets PUSH env var for main push | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
echo "PUSH=true" >> $GITHUB_ENV | ||
- name: Build images | ||
working-directory: ./images | ||
run: | | ||
touch failed.txt | ||
make build-all | ||
- name: Check failures | ||
working-directory: ./images | ||
run: | | ||
if [ -s failed.txt ]; then | ||
cat failed.txt | ||
exit 1; | ||
fi | ||
uses: ./.github/workflows/reusable_build_images.yml | ||
with: | ||
push: true | ||
is_latest: false | ||
version: 'main' | ||
secrets: inherit |
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,20 @@ | ||
name: PR CI | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'images/**' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-images: | ||
uses: ./.github/workflows/reusable_build_images.yml | ||
with: | ||
push: false | ||
is_latest: false | ||
version: '${{ github.run_id }}' | ||
secrets: inherit |
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,17 @@ | ||
name: Release CI | ||
on: | ||
release: | ||
types: [published] | ||
|
||
concurrency: | ||
group: release_push_images | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
release-images: | ||
uses: ./.github/workflows/reusable_build_images.yml | ||
with: | ||
push: true | ||
is_latest: true | ||
version: ${{ github.event.release.tag_name }} | ||
secrets: inherit |
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,73 @@ | ||
name: Build and Push docker images | ||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
description: 'docker images version to be built/tagged' | ||
type: string | ||
required: false | ||
default: 'main' | ||
push: | ||
description: 'whether to push images or build only' | ||
type: boolean | ||
required: false | ||
default: false | ||
is_latest: | ||
description: 'whether we need to also push latest images' | ||
type: boolean | ||
required: false | ||
default: false | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Job responsible to test the build of the images and, only on main CI, to push them too. | ||
build-images: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [amd64, arm64] | ||
runs-on: ${{ (matrix.arch == 'arm64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-22.04' }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to Github Packages | ||
if: inputs.push | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set PUSH env var | ||
if: inputs.push | ||
run: | | ||
echo "PUSH=true" >> $GITHUB_ENV | ||
- name: Set LATEST env var | ||
if: inputs.is_latest | ||
run: | | ||
echo "LATEST=true" >> $GITHUB_ENV | ||
- name: Set TAG env var | ||
run: | | ||
echo "TAG=${{ inputs.version }}" >> $GITHUB_ENV | ||
- name: Build images | ||
working-directory: ./images | ||
run: | | ||
touch failed.txt | ||
make build-all | ||
- name: Check failures | ||
working-directory: ./images | ||
run: | | ||
if [ -s failed.txt ]; then | ||
cat failed.txt | ||
exit 1; | ||
fi | ||
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
Oops, something went wrong.