Skip to content

Commit

Permalink
Update AKS and EKS action to properly run on schedule (#1125)
Browse files Browse the repository at this point in the history
* Update bundle version JSON

* Rearrange clauses

* Rearrange clauses

* Rearrange clauses

* Update action to enable workflow dispatch

* Update job to run always and not on workflow dispatch only

* Update EKS action

* Update actions

* Make comment more concise

* Update checkout action to v4

* Update checkout action to v4
  • Loading branch information
mvlassis authored Nov 18, 2024
1 parent 7fc638e commit ba8dce5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 38 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/deploy-to-aks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,49 @@ 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 }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- 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
- name: Process bundle versions
id: process_bundle_versions
run: |
bundle_versions=$(yq '. | keys' .github/dependencies.yaml -o=json)
echo "bundle_versions=${bundle_versions}" >> $GITHUB_OUTPUT
if [[ "${{ github.event_name }}" == "schedule" ]]; then
# Use `tr` to remove new lines as a workaround to:
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#multiline-strngs
bundle_versions=$(yq '. | keys' .github/dependencies.yaml -o=json | tr -d '\n')
echo "bundle_versions=${bundle_versions}"
echo "bundle_versions=${bundle_versions}" >> $GITHUB_OUTPUT
else
python scripts/gh-actions/parse_versions.py "${{ inputs.bundle_version }}"
fi
deploy-ckf-to-aks:
needs: preprocess-input
runs-on: ubuntu-22.04
strategy:
matrix:
bundle_version: ${{ fromJSON(needs.preprocess-input.outputs.processed_bundle_versions) || fromJSON(jobs.generate-bundle-versions-on-schedule.outputs.bundle_versions) }}
bundle_version: ${{ fromJSON(needs.preprocess-input.outputs.processed_bundle_versions) }}
fail-fast: false
env:
AZURE_CORE_OUTPUT: none
PYTHON_VERSION: "3.8"

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Run YAML to Github Output Action
id: yaml-output
Expand Down
34 changes: 15 additions & 19 deletions .github/workflows/deploy-to-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,48 @@ 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 }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- 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
- name: Process bundle versions
id: process_bundle_versions
run: |
bundle_versions=$(yq '. | keys' .github/dependencies.yaml -o=json)
echo "bundle_versions=${bundle_versions}" >> $GITHUB_OUTPUT
if [[ "${{ github.event_name }}" == "schedule" ]]; then
# Use `tr` to remove new lines as a workaround to:
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#multiline-strngs
bundle_versions=$(yq '. | keys' .github/dependencies.yaml -o=json | tr -d '\n')
echo "bundle_versions=${bundle_versions}"
echo "bundle_versions=${bundle_versions}" >> $GITHUB_OUTPUT
else
python scripts/gh-actions/parse_versions.py "${{ inputs.bundle_version }}"
fi
deploy-ckf-to-eks:
needs: preprocess-input
runs-on: ubuntu-22.04
strategy:
matrix:
bundle_version: ${{ fromJSON(needs.preprocess-input.outputs.processed_bundle_versions) || fromJSON(jobs.generate-bundle-versions-on-schedule.outputs.bundle_versions) }}
bundle_version: ${{ fromJSON(needs.preprocess-input.outputs.processed_bundle_versions) }}
fail-fast: false
env:
PYTHON_VERSION: "3.8"

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Run YAML to Github Output Action
id: yaml-output
Expand Down

0 comments on commit ba8dce5

Please sign in to comment.