-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from MartinBasti/align-test-and-release
fix(STONEINTG-624): align PR and release workflow
- Loading branch information
Showing
5 changed files
with
92 additions
and
64 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,66 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
archs: | ||
description: "Build image for defined architectures. Must be comma-separated list of architectures." | ||
required: false | ||
default: "amd64,ppc64le" | ||
type: string | ||
tags: | ||
description: "Tags to be used for the image. Must be space separated list of tags." | ||
required: true | ||
type: string | ||
push: | ||
description: "Determine if image should be pushed into registry. By default image will be only built and tested locally." | ||
required: false | ||
type: boolean | ||
default: false | ||
jobs: | ||
build_container_image: | ||
name: Build and check main image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Docker file code in the root directory | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-user-static podman | ||
- name: Build Image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: hacbs-test | ||
tags: ${{ inputs.tags }} | ||
archs: ${{ inputs.archs }} | ||
containerfiles: | | ||
./Dockerfile | ||
- name: Selfcheck - Integration test inside the image | ||
run: | | ||
archs="${{ inputs.archs }}" | ||
for i in ${archs//,/$IFS} | ||
do | ||
echo "START of testing architecture ${arch}" | ||
podman run --arch "${arch}" --rm -t ${{ steps.build-image.outputs.image-with-tag }} /selftest.sh | ||
echo "END of testing for architecture ${arch}" | ||
echo | ||
done | ||
- name: Push To quay.io | ||
id: push-to-quay | ||
if: ${{ inputs.push }} | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: quay.io/redhat-appstudio | ||
username: ${{ secrets.HACBS_TEST_QUAY_USER }} | ||
password: ${{ secrets.HACBS_TEST_QUAY_TOKEN }} | ||
|
||
- name: Print image url | ||
if: ${{ inputs.push }} | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |
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
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 |
---|---|---|
|
@@ -11,42 +11,22 @@ on: | |
default: 'main' | ||
|
||
jobs: | ||
build: | ||
call-build-test-and-push-workflow: | ||
name: Call build, test and push workflow | ||
uses: ./.github/workflows/build_reusable.yaml | ||
with: | ||
tags: latest v${{ github.event.inputs.release-version }} ${{ github.sha }} | ||
push: true | ||
secrets: inherit | ||
|
||
github-release: | ||
name: Build and push image | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- call-build-test-and-push-workflow | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install qemu dependency | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-user-static | ||
- name: Build Image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: hacbs-test | ||
tags: latest v${{ github.event.inputs.release-version }} ${{ github.sha }} | ||
archs: amd64,ppc64le | ||
containerfiles: | | ||
./Dockerfile | ||
# Podman Login action (https://github.com/redhat-actions/podman-login) also be used to log in, | ||
# in which case 'username' and 'password' can be omitted. | ||
- name: Push To quay.io | ||
id: push-to-quay | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: quay.io/redhat-appstudio | ||
username: ${{ secrets.HACBS_TEST_QUAY_USER }} | ||
password: ${{ secrets.HACBS_TEST_QUAY_TOKEN }} | ||
|
||
- name: Print image url | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" | ||
|
||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
|
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
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