Skip to content

Commit

Permalink
Filter images
Browse files Browse the repository at this point in the history
Signed-off-by: d-kuro <[email protected]>
  • Loading branch information
d-kuro committed Jul 22, 2023
1 parent 1898276 commit 1fe3a2f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
40 changes: 36 additions & 4 deletions .github/workflows/build-mysql-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,43 @@ on:
- "!**.md"

jobs:
filter:
runs-on: ubuntu-20.04
outputs:
mysql-versions: ${{ steps.filter.outputs.mysql-versions }}
steps:
- uses: actions/checkout@v3
- name: filter
id: filter
working-directory: containers
run: |
array=()
for dir in $(find ./mysql -mindepth 1 -type d -printf '%f\n'); do
result=$(./tag_exists moco/mysql "mysql/$dir")
if [ "$result" = ng ]; then
array+=( "$dir" )
fi
done
if [ "${#array[@]}" -eq 0 ]; then
json_output="[]"
else
json_output=$(printf '%s\n' "${array[@]}" | jq -R . | jq -s . | jq -c .)
fi
echo "GITHUB_OUTPUT: mysql-versions=$json_output"
echo "mysql-versions=$json_output" >> "$GITHUB_OUTPUT"
tests:
if: github.event_name == 'pull_request'
if: ${{ (github.event_name == 'pull_request') && (needs.filter.outputs.mysql-versions != '[]') }}
needs: filter
runs-on: ${{ vars.IMAGE_BUILD_RUNNER || 'ubuntu-20.04' }}
strategy:
matrix:
mysql-version: [ "8.0.18", "8.0.25", "8.0.26", "8.0.27", "8.0.28", "8.0.30", "8.0.31", "8.0.32" ]
mysql-version: ${{ fromJson(needs.filter.outputs.mysql-versions) }}
k8s-version: [ "1.27.1" ]
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -63,11 +94,12 @@ jobs:
use-local-mysql-image: true

build:
if: github.ref == 'refs/heads/main'
if: ${{ (github.ref == 'refs/heads/main') && (needs.filter.outputs.mysql-versions != '[]') }}
needs: filter
runs-on: ${{ vars.IMAGE_BUILD_RUNNER || 'ubuntu-20.04' }}
strategy:
matrix:
mysql-version: [ "8.0.18", "8.0.25", "8.0.26", "8.0.27", "8.0.28", "8.0.30", "8.0.31", "8.0.32" ]
mysql-version: ${{ fromJson(needs.filter.outputs.mysql-versions) }}
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
type: string
use-local-mysql-image:
required: false
default: false
type: boolean

jobs:
Expand All @@ -29,12 +30,12 @@ jobs:
- run: sudo mkdir /mnt/local-path-provisioner0 /mnt/local-path-provisioner1 /mnt/local-path-provisioner2

- name: Setup test cluster
if: ${{ inputs.use-local-mysql-image }} == false
run: make start KUBERNETES_VERSION=${{ inputs.k8s-version }} MYSQL_VERSION=${{ inputs.mysql-version }} KIND_CONFIG=kind-config_actions.yaml
if: ${{ inputs.use-local-mysql-image }} == 'false'
working-directory: e2e
- name: Setup test cluster with local mysql image
if: ${{ inputs.use-local-mysql-image }} == true
run: make start KUBERNETES_VERSION=${{ inputs.k8s-version }} MYSQL_VERSION=${{ inputs.mysql-version }} KIND_CONFIG=kind-config_actions.yaml USE_LOCAL_MYSQL_IMAGE=1
if: ${{ inputs.use-local-mysql-image }} == 'true'
working-directory: e2e

- run: make test
Expand Down

0 comments on commit 1fe3a2f

Please sign in to comment.