From 45ca3b15e5f02f5eeac9b544b4aa2807cd95574c Mon Sep 17 00:00:00 2001 From: Disaiah Bennett Date: Fri, 12 Jan 2024 15:25:40 -0500 Subject: [PATCH] added GH action for backplane-2.4 (#567) Signed-off-by: Disaiah Bennett --- .../regenerate-operator-bundles-2.0.yml | 2 +- .../regenerate-operator-bundles-2.1.yml | 2 +- .../regenerate-operator-bundles-2.2.yml | 2 +- .../regenerate-operator-bundles-2.3.yml | 2 +- .../regenerate-operator-bundles-2.4.yml | 87 +++++++++++++++++++ .../workflows/regenerate-operator-bundles.yml | 2 +- 6 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/regenerate-operator-bundles-2.4.yml diff --git a/.github/workflows/regenerate-operator-bundles-2.0.yml b/.github/workflows/regenerate-operator-bundles-2.0.yml index 55b529bb6..a16b1e77e 100644 --- a/.github/workflows/regenerate-operator-bundles-2.0.yml +++ b/.github/workflows/regenerate-operator-bundles-2.0.yml @@ -84,4 +84,4 @@ jobs: committer: GitHub author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> labels: do-not-merge/hold - assignees: cameronmwall,dislbenn,ngraham20 + reviewers: cameronmwall,dislbenn,ngraham20 diff --git a/.github/workflows/regenerate-operator-bundles-2.1.yml b/.github/workflows/regenerate-operator-bundles-2.1.yml index c63845048..ac42ed951 100644 --- a/.github/workflows/regenerate-operator-bundles-2.1.yml +++ b/.github/workflows/regenerate-operator-bundles-2.1.yml @@ -84,4 +84,4 @@ jobs: committer: GitHub author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> labels: do-not-merge/hold - assignees: cameronmwall,dislbenn,ngraham20 + reviewers: cameronmwall,dislbenn,ngraham20 diff --git a/.github/workflows/regenerate-operator-bundles-2.2.yml b/.github/workflows/regenerate-operator-bundles-2.2.yml index 8f2c20df1..782fb6d5c 100644 --- a/.github/workflows/regenerate-operator-bundles-2.2.yml +++ b/.github/workflows/regenerate-operator-bundles-2.2.yml @@ -84,4 +84,4 @@ jobs: committer: GitHub author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> labels: do-not-merge/hold - assignees: cameronmwall,dislbenn,ngraham20 + reviewers: cameronmwall,dislbenn,ngraham20 diff --git a/.github/workflows/regenerate-operator-bundles-2.3.yml b/.github/workflows/regenerate-operator-bundles-2.3.yml index c02e22432..426c8bb46 100644 --- a/.github/workflows/regenerate-operator-bundles-2.3.yml +++ b/.github/workflows/regenerate-operator-bundles-2.3.yml @@ -84,4 +84,4 @@ jobs: committer: GitHub author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> labels: do-not-merge/hold - assignees: cameronmwall,dislbenn,ngraham20 + reviewers: cameronmwall,dislbenn,ngraham20 diff --git a/.github/workflows/regenerate-operator-bundles-2.4.yml b/.github/workflows/regenerate-operator-bundles-2.4.yml new file mode 100644 index 000000000..4ee32688d --- /dev/null +++ b/.github/workflows/regenerate-operator-bundles-2.4.yml @@ -0,0 +1,87 @@ +# This is a basic workflow to help you get started with Actions + +name: Regenerate 2.4 Operator Bundles + +# Controls when the action will run. +on: + # Runs every day + schedule: + - cron: "0 0 * * *" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.9] + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + with: + token: ${{ secrets.BACKPLANE_TOKEN }} + ref: backplane-2.4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + # Runs a set of commands using the runners shell + - name: Lint Operator Bundles + continue-on-error: true + id: lint_bundle + run: | + make lint-operator-bundles + + # Runs a set of commands using the runners shell + - name: Regenerate Operator Bundles + continue-on-error: true + id: generate_bundle + run: | + make regenerate-operator-bundles + + - name: Check Job Status + id: job_status + run: | + if [[ ${{ steps.generate_bundle.outcome }} == 'failure' || ${{ steps.lint_bundle.outcome }} == 'failure' ]]; then + echo "status=failure" >> $GITHUB_OUTPUT + else + echo "status=success" >> $GITHUB_OUTPUT + fi + + - name: Send Slack Message on Failure + if: steps.job_status.outputs.status == 'failure' + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + run: | + # Compose the Slack message + SLACK_MESSAGE=":exclamation: *GitHub Actions Job Failed* :exclamation:\n\n" + SLACK_MESSAGE+="Job Name: $GITHUB_WORKFLOW/$GITHUB_JOB\n" + SLACK_MESSAGE+="Job URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\n" + SLACK_MESSAGE+="Error Details: Your job failed. Please check the job logs for more information." + + # Send the message to Slack + curl -X POST -H "Content-type: application/json" --data "{ + \"text\": \"$SLACK_MESSAGE\" + }" $SLACK_WEBHOOK_URL + + exit 1 + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + signoff: true + branch: "regenerate-operator-bundles-2.4" + delete-branch: true + title: "Operator Bundle Update [2.4]" + committer: GitHub + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + labels: do-not-merge/hold + assignees: cameronmwall,dislbenn,ngraham20 diff --git a/.github/workflows/regenerate-operator-bundles.yml b/.github/workflows/regenerate-operator-bundles.yml index bb2e70747..567d400cd 100644 --- a/.github/workflows/regenerate-operator-bundles.yml +++ b/.github/workflows/regenerate-operator-bundles.yml @@ -83,4 +83,4 @@ jobs: committer: GitHub author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> labels: do-not-merge/hold - assignees: cameronmwall,dislbenn,ngraham20 + reviewers: cameronmwall,dislbenn,ngraham20