mirror of
https://github.com/bitnami/charts.git
synced 2026-03-03 15:07:37 +08:00
[bitnami/*] Add CI retriability for release PRs (#20018)
* [bitnami/*] Add CI retriability for release PRs Signed-off-by: Fran de Paz <fdepaz@vmware.com> * Apply suggestions Signed-off-by: Fran de Paz <fdepaz@vmware.com> --------- Signed-off-by: Fran de Paz <fdepaz@vmware.com>
This commit is contained in:
committed by
GitHub
parent
9e47148daa
commit
cb0cc779a7
7
.github/workflows/ci-pipeline.yml
vendored
7
.github/workflows/ci-pipeline.yml
vendored
@@ -27,7 +27,6 @@ jobs:
|
||||
name: Get modified charts
|
||||
permissions:
|
||||
contents: read
|
||||
if: ${{ github.event.pull_request.state != 'closed' }}
|
||||
outputs:
|
||||
chart: ${{ steps.get-chart.outputs.chart }}
|
||||
result: ${{ steps.get-chart.outputs.result }}
|
||||
@@ -50,7 +49,11 @@ jobs:
|
||||
num_version_bumps="$(filterdiff -s -i "*Chart.yaml" $TEMP_FILE | grep -c "+version" || true)"
|
||||
non_readme_files=$(echo "$files_changed" | grep -vc "\.md" || true)
|
||||
|
||||
if [[ "$non_readme_files" -le "0" ]]; then
|
||||
if [[ $(curl -Lks ${{ github.event.pull_request.url }} | jq '.state | index("closed")') != *null* ]]; then
|
||||
# The PR for which this workflow run was launched is now closed -> SKIP
|
||||
echo "error=The PR for which this workflow run was launched is now closed. The tests will be skipped." >> $GITHUB_OUTPUT
|
||||
echo "result=skip" >> $GITHUB_OUTPUT
|
||||
elif [[ "$non_readme_files" -le "0" ]]; then
|
||||
# The only changes are .md files -> SKIP
|
||||
echo "result=skip" >> $GITHUB_OUTPUT
|
||||
elif [[ "$num_charts_changed" -ne "$num_version_bumps" ]]; then
|
||||
|
||||
30
.github/workflows/retry-failed-releases.yml
vendored
Normal file
30
.github/workflows/retry-failed-releases.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright VMware, Inc.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
name: '[CI/CD] Retry release PRs'
|
||||
on:
|
||||
schedule:
|
||||
# Every 2 hours
|
||||
- cron: '0 */2 * * *'
|
||||
# Remove all permissions by default
|
||||
permissions: {}
|
||||
jobs:
|
||||
retry-failed-pr-releases:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- name: Retry "CI Pipeline" failed runs in releases PRs
|
||||
env:
|
||||
WORKFLOW_ID: "35553382"
|
||||
TEMP_FILE: "${{runner.temp}}/failed_runs.json"
|
||||
ACTIONS_API_ENDPOINT: "${{ github.api_url }}/repos/${{ github.repository }}/actions"
|
||||
run: |
|
||||
# Obtain "CI Pipeline" failed runs and filter those from release PRs with less than 3 attempts
|
||||
curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X GET -Lkso ${{ env.TEMP_FILE }} ${{ env.ACTIONS_API_ENDPOINT }}/workflows/${{ env.WORKFLOW_ID }}/runs?status=failure
|
||||
readarray -t failed_runs_ids < <(jq '.workflow_runs[] | select((.run_attempt < 3) and (.display_title | contains("Release")) and (.head_commit.author.email=="bitnami-bot@vmware.com")).id' ${{ env.TEMP_FILE }})
|
||||
|
||||
for run_id in "${failed_runs_ids[@]:0:15}"; do
|
||||
echo "Retrying workflow $(jq --argjson id $run_id '.workflow_runs[] | select(.id==$id) | .html_url' ${{ env.TEMP_FILE }})"
|
||||
curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X POST -Lks ${{ env.ACTIONS_API_ENDPOINT }}/workflows/runs/${run_id}/rerun
|
||||
done
|
||||
Reference in New Issue
Block a user