-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OSSM-5306][OSSM-5307] Add building tests images into pipeline
- Loading branch information
Showing
5 changed files
with
279 additions
and
3 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,115 @@ | ||
name: Build and push test suite images | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_branch: | ||
description: Branch to release | ||
default: master | ||
type: string | ||
required: true | ||
quay_org: | ||
description: Quay organization | ||
type: string | ||
default: kiali | ||
required: true | ||
images_tag: | ||
description: Images tag | ||
type: string | ||
default: dev | ||
required: true | ||
build_mode: | ||
type: choice | ||
description: Which images should be built | ||
default: both | ||
options: | ||
- integration | ||
- cypress | ||
- both | ||
workflow_call: | ||
inputs: | ||
release_branch: | ||
description: Branch to release | ||
type: string | ||
required: true | ||
quay_org: | ||
description: Quay organization | ||
type: string | ||
required: true | ||
images_tag: | ||
description: Images tag | ||
type: string | ||
required: true | ||
build_mode: | ||
description: Which images should be built (integration/cypress/both) | ||
type: string | ||
required: true | ||
secrets: | ||
QUAY_USER: | ||
description: 'A quay user secret passed from the caller workflow' | ||
required: true | ||
QUAY_PASSWORD: | ||
description: 'A quay user password passed from the caller workflow' | ||
required: true | ||
|
||
|
||
jobs: | ||
build_and_push_integration_tests: | ||
name: Generate and push integration test docker images | ||
if: ${{ inputs.build_mode == 'integration' || inputs.build_mode == 'both' }} | ||
runs-on: ubuntu-latest | ||
env: | ||
# These ENVs are expected in Make file! | ||
IMAGE_ORG: ${{ inputs.quay_org }} | ||
INT_TESTS_CONTAINER_VERSION: ${{ inputs.images_tag }} | ||
CYPRESS_TESTS_CONTAINER_VERSION: ${{ inputs.images_tag }} | ||
steps: | ||
- name: Log information | ||
run: | | ||
echo "Branch": ${{ inputs.release_branch }} | ||
echo "Quay organization": ${{ inputs.quay_org }} | ||
echo "Images tag": ${{ inputs.images_tag }} | ||
echo "Builde mode": ${{ inputs.build_mode }} | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.release_branch }} | ||
- name: Login to Quay.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USER }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
- name: "Build integration test image" | ||
run: | | ||
make container-build-int-tests container-push-int-tests-quay | ||
build_and_push_cypress_tests: | ||
name: Generate and push cypress test docker images | ||
if: ${{ inputs.build_mode == 'cypress' || inputs.build_mode == 'both' }} | ||
runs-on: ubuntu-latest | ||
env: | ||
# These ENVs are expected in Make file! | ||
IMAGE_ORG: ${{ inputs.quay_org }} | ||
INT_TESTS_CONTAINER_VERSION: ${{ inputs.images_tag }} | ||
CYPRESS_TESTS_CONTAINER_VERSION: ${{ inputs.images_tag }} | ||
steps: | ||
- name: Log information | ||
run: | | ||
echo "Branch": ${{ inputs.release_branch }} | ||
echo "Quay organization": ${{ inputs.quay_org }} | ||
echo "Images tag": ${{ inputs.images_tag }} | ||
echo "Builde mode": ${{ inputs.build_mode }} | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.release_branch }} | ||
- name: Login to Quay.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USER }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
- name: "Build cypress test image" | ||
run: | | ||
make container-build-cypress-tests container-push-cypress-tests-quay |
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,70 @@ | ||
name: Release test suite images | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
initialize: | ||
name: Initialize | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
quay_org: 'kiali' | ||
images_tag: ${{ steps.images_tag.outputs.images_tag }} | ||
steps: | ||
- name: Determine Image tag without Z version | ||
id: images_tag | ||
run: | | ||
major=$(echo ${{ github.ref_name }} | cut -d. -f1) | ||
minor=$(echo ${{ github.ref_name }} | cut -d. -f2) | ||
echo "images_tag=$major.$minor" >> $GITHUB_OUTPUT | ||
- name: Log information | ||
run: | | ||
echo "Github tag": ${{ github.ref_name }} | ||
echo "Quay main version tag": ${{ steps.images_tag.outputs.images_tag }} | ||
push_test_images: | ||
name: Build and push images with full tag | ||
uses: ./.github/workflows/test-images-creator.yml | ||
needs: [initialize] | ||
with: | ||
release_branch: ${{ github.ref_name }} | ||
images_tag: ${{ github.ref_name }} | ||
quay_org: ${{ needs.initialize.outputs.quay_org }} | ||
build_mode: 'both' | ||
secrets: | ||
QUAY_USER: ${{ secrets.QUAY_USER }} | ||
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
update_latest_test_images: | ||
name: Update images under major.minor version tag | ||
runs-on: ubuntu-20.04 | ||
needs: [initialize, push_test_images] | ||
steps: | ||
- name: Login to Quay.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USER }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Pull new integration test image | ||
run: | | ||
docker pull quay.io/${{ needs.initialize.outputs.quay_org }}/kiali-int-tests:${{ github.ref_name }} | ||
- name: Use major.minor version tag | ||
run: | | ||
docker tag quay.io/${{ needs.initialize.outputs.quay_org }}/kiali-int-tests:${{ github.ref_name }} quay.io/${{ needs.initialize.outputs.quay_org }}/kiali-int-tests:${{ needs.initialize.outputs.images_tag }} | ||
- name: Update integration test image in quay | ||
run: | | ||
docker push quay.io/${{ needs.initialize.outputs.quay_org }}/kiali-int-tests:${{ needs.initialize.outputs.images_tag }} | ||
- name: Pull new cypress test image | ||
run: | | ||
docker pull quay.io/${{ needs.initialize.outputs.quay_org }}/kiali-cypress-tests:${{ github.ref_name }} | ||
- name: Use major.minor version tag | ||
run: | | ||
docker tag quay.io/${{ needs.initialize.outputs.quay_org }}/kiali-cypress-tests:${{ github.ref_name }} quay.io/${{ needs.initialize.outputs.quay_org }}/kiali-cypress-tests:${{ needs.initialize.outputs.images_tag }} | ||
- name: Update cypress test image in quay | ||
run: | | ||
docker push quay.io/${{ needs.initialize.outputs.quay_org }}/kiali-cypress-tests:${{ needs.initialize.outputs.images_tag }} |
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,65 @@ | ||
name: Update latest test suite images | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'hack/**' | ||
- 'frontend/**' | ||
# ignore src folder | ||
- '!frontend/src/**' | ||
- 'deploy/docker/Dockerfile-cypress' | ||
- 'tests/integration/**' | ||
|
||
jobs: | ||
determine_change: | ||
name: Determine which images are affected by the change | ||
runs-on: ubuntu-latest | ||
outputs: | ||
build_mode: ${{ steps.determine.outputs.build_mode }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dorny/paths-filter@v2.11.1 | ||
id: filter | ||
with: | ||
filters: | | ||
integration: | ||
- 'hack/**' | ||
- 'tests/integration/**' | ||
cypress: | ||
- 'hack/**' | ||
- 'frontend/**' | ||
- 'deploy/docker/Dockerfile-cypress' | ||
- name: Determine what needs to be rebuilt | ||
id: determine | ||
run: | | ||
if ${{ steps.filter.outputs.integration }} && ${{ steps.filter.outputs.cypress }}; then | ||
MODE="both" | ||
elif ${{ steps.filter.outputs.integration }}; then | ||
MODE="integration" | ||
elif ${{ steps.filter.outputs.cypress }}; then | ||
MODE="cypress" | ||
else | ||
echo "Unknown change. A change in watched folders was detected, but the folder is not related to any test image. Review the workflow file and add that folder to the related test image in the filter step!" exit 1 | ||
fi | ||
echo "build_mode=$MODE" >> $GITHUB_OUTPUT | ||
- name: Log information | ||
run: | | ||
echo "Change in folders related to int tests": ${{ steps.filter.outputs.integration }} | ||
echo "Change in folders related to cypress tests": ${{ steps.filter.outputs.cypress }} | ||
echo "Determined mode": ${{ steps.determine.outputs.build_mode }} | ||
push_test_images: | ||
name: Build and push test images | ||
needs: [determine_change] | ||
uses: ./.github/workflows/test-images-creator.yml | ||
with: | ||
release_branch: ${{ github.ref_name }} | ||
images_tag: 'latest' | ||
quay_org: 'kiali' | ||
build_mode: ${{ needs.determine_change.outputs.build_mode }} | ||
secrets: | ||
QUAY_USER: ${{ secrets.QUAY_USER }} | ||
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} |
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