From 7fc638e4b6ecb0694ed922a166e9583f5c0e971e Mon Sep 17 00:00:00 2001 From: Manos Vlassis <57320708+mvlassis@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:23:57 +0300 Subject: [PATCH] Fix bundle versions being given to the scheduled workflows for testing on AKS and EKS. (#1122) * Add bundle versions for AKS action * Add bundle versions for AKS action * Update matrix for deploy-to-ckf-on-aks job * Update identation * Add target versions for scheduled workflow * Add bundle versions for scheduled workflow on EKS * Add bundle versions for scheduled workflow on EKS * Update dependencies.yaml and parse_versions.py * Removed redundant file --- .github/dependencies.yaml | 5 ----- .github/workflows/deploy-to-aks.yaml | 21 +++++++++++++++++++-- .github/workflows/deploy-to-eks.yaml | 21 +++++++++++++++++++-- scripts/gh-actions/parse_versions.py | 2 +- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/dependencies.yaml b/.github/dependencies.yaml index c201b23b..a6f00c05 100644 --- a/.github/dependencies.yaml +++ b/.github/dependencies.yaml @@ -1,8 +1,3 @@ -"1.7": - K8S_VERSION: "1.24" - JUJU_VERSION: "2.9" - JUJU_VERSION_WITH_PATCH: "2.9.49" - UATS_BRANCH: "track/1.7" "1.8": K8S_VERSION: "1.29" JUJU_VERSION: "3.4" diff --git a/.github/workflows/deploy-to-aks.yaml b/.github/workflows/deploy-to-aks.yaml index 6e1f9636..76c61aff 100644 --- a/.github/workflows/deploy-to-aks.yaml +++ b/.github/workflows/deploy-to-aks.yaml @@ -16,6 +16,7 @@ on: - cron: "17 0 * * 2" jobs: preprocess-input: + if: ${{ github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-22.04 outputs: processed_bundle_versions: ${{ steps.process_bundle_versions.outputs.bundle_versions }} @@ -31,13 +32,29 @@ jobs: - name: Process bundle versions id: process_bundle_versions run: python scripts/gh-actions/parse_versions.py "${{ inputs.bundle_version }}" - + + generate-bundle-versions-on-schedule: + if: ${{ github.event_name == 'schedule' }} + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install CLI tools + run: | + sudo snap install yq + + - name: Create JSON array of bundle versions + run: | + bundle_versions=$(yq '. | keys' .github/dependencies.yaml -o=json) + echo "bundle_versions=${bundle_versions}" >> $GITHUB_OUTPUT + deploy-ckf-to-aks: needs: preprocess-input runs-on: ubuntu-22.04 strategy: matrix: - bundle_version: ${{ fromJSON(needs.preprocess-input.outputs.processed_bundle_versions) }} + bundle_version: ${{ fromJSON(needs.preprocess-input.outputs.processed_bundle_versions) || fromJSON(jobs.generate-bundle-versions-on-schedule.outputs.bundle_versions) }} fail-fast: false env: AZURE_CORE_OUTPUT: none diff --git a/.github/workflows/deploy-to-eks.yaml b/.github/workflows/deploy-to-eks.yaml index 2b5861d4..fa962f40 100644 --- a/.github/workflows/deploy-to-eks.yaml +++ b/.github/workflows/deploy-to-eks.yaml @@ -16,6 +16,7 @@ on: - cron: "23 0 * * 2" jobs: preprocess-input: + if: ${{ github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-22.04 outputs: processed_bundle_versions: ${{ steps.process_bundle_versions.outputs.bundle_versions }} @@ -31,13 +32,29 @@ jobs: - name: Process bundle versions id: process_bundle_versions run: python scripts/gh-actions/parse_versions.py "${{ inputs.bundle_version }}" - + + generate-bundle-versions-on-schedule: + if: ${{ github.event_name == 'schedule' }} + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install CLI tools + run: | + sudo snap install yq + + - name: Create JSON array of bundle versions + run: | + bundle_versions=$(yq '. | keys' .github/dependencies.yaml -o=json) + echo "bundle_versions=${bundle_versions}" >> $GITHUB_OUTPUT + deploy-ckf-to-eks: needs: preprocess-input runs-on: ubuntu-22.04 strategy: matrix: - bundle_version: ${{ fromJSON(needs.preprocess-input.outputs.processed_bundle_versions) }} + bundle_version: ${{ fromJSON(needs.preprocess-input.outputs.processed_bundle_versions) || fromJSON(jobs.generate-bundle-versions-on-schedule.outputs.bundle_versions) }} fail-fast: false env: PYTHON_VERSION: "3.8" diff --git a/scripts/gh-actions/parse_versions.py b/scripts/gh-actions/parse_versions.py index efbae6b2..13d50177 100644 --- a/scripts/gh-actions/parse_versions.py +++ b/scripts/gh-actions/parse_versions.py @@ -12,7 +12,7 @@ def parse_versions(input_versions): return json_array if __name__ == "__main__": - if len(sys.argv) < 1: + if len(sys.argv) < 2 or sys.argv[1] == "": raise Exception("No bundle versions given as input.") input_versions = sys.argv[1]