From 51bb3a5163a66d4c64e3df582be4ac6bb7d42d5c Mon Sep 17 00:00:00 2001 From: Alexandre Alves Date: Mon, 11 Nov 2024 19:45:11 +0000 Subject: [PATCH] test with slack --- .github/workflows/build-extension-catalog.yml | 8 ++-- .github/workflows/build-extension-charts.yml | 12 +++--- .github/workflows/release-shell-pkg.yaml | 8 ++-- .../workflows/test-extension-workflows.yml | 39 ++++++++++++++++--- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-extension-catalog.yml b/.github/workflows/build-extension-catalog.yml index 63feccd535f..a6dba5e66c6 100644 --- a/.github/workflows/build-extension-catalog.yml +++ b/.github/workflows/build-extension-catalog.yml @@ -15,10 +15,10 @@ on: is_test: required: false type: string - test_repo: + test_ext_repo: required: false type: string - test_branch: + test_ext_branch: required: false type: string secrets: @@ -40,8 +40,8 @@ jobs: name: Checkout repository (test flow) uses: actions/checkout@v4 with: - repository: rancher/${{ inputs.test_repo }} - ref: ${{ inputs.test_branch }} + repository: rancher/${{ inputs.test_ext_repo }} + ref: ${{ inputs.test_ext_branch }} - if: inputs.is_test != 'true' name: Checkout repository (normal flow) diff --git a/.github/workflows/build-extension-charts.yml b/.github/workflows/build-extension-charts.yml index 4bf48de27d5..72fb1411fdb 100644 --- a/.github/workflows/build-extension-charts.yml +++ b/.github/workflows/build-extension-charts.yml @@ -12,10 +12,10 @@ on: is_test: required: false type: string - test_repo: + test_ext_repo: required: false type: string - test_branch: + test_ext_branch: required: false type: string @@ -40,8 +40,8 @@ jobs: name: Checkout (test flow) uses: actions/checkout@v4 with: - repository: rancher/${{ inputs.test_repo }} - ref: ${{ inputs.test_branch }} + repository: rancher/${{ inputs.test_ext_repo }} + ref: ${{ inputs.test_ext_branch }} fetch-depth: 0 - if: inputs.is_test != 'true' @@ -97,12 +97,12 @@ jobs: $publish - name: Upload charts artifact - if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test == 'true' + if: github.ref_type == 'tag' || github.event_name != 'pull_request' || inputs.is_test == 'true' uses: actions/upload-artifact@v3 with: name: charts path: tmp -## if test, check if artifacts are there... +## TODO: if test, check if artifacts are there... release: name: Release Build if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test != 'true' diff --git a/.github/workflows/release-shell-pkg.yaml b/.github/workflows/release-shell-pkg.yaml index c79a526eba1..7c78314dacd 100644 --- a/.github/workflows/release-shell-pkg.yaml +++ b/.github/workflows/release-shell-pkg.yaml @@ -24,6 +24,7 @@ jobs: permissions: contents: read packages: write + # TODO: replace "aalves08" if: github.repository == 'aalves08/dashboard' && (github.event_name == 'workflow_call' || (github.event_name == 'push' && github.event.ref == 'refs/tags/${{ github.ref_name }}')) steps: - if: inputs.is_test == 'true' && inputs.test_branch != '' @@ -56,10 +57,9 @@ jobs: run: ./.github/workflows/scripts/check-package-tag-version.sh shell: bash - # TODO: Re-enable this step before completing PR - # - name: Validate Plugin build system - # run: ./shell/scripts/test-plugins-build.sh - # shell: bash + - name: Validate Plugin build system + run: ./shell/scripts/test-plugins-build.sh + shell: bash # Reset the local (ci) repository state because # The previous step (Validate Plugin build system) changes diff --git a/.github/workflows/test-extension-workflows.yml b/.github/workflows/test-extension-workflows.yml index 416b62d5932..d98c8783558 100644 --- a/.github/workflows/test-extension-workflows.yml +++ b/.github/workflows/test-extension-workflows.yml @@ -11,6 +11,7 @@ defaults: run: shell: bash working-directory: ./ +# TODO: replace all instances of "aalves08" and "12032-reusable-wf-tests-2" jobs: retrieve-tags-master: runs-on: ubuntu-latest @@ -22,6 +23,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: 12032-reusable-wf-tests-2 - name: Retrieve Shell and Creators versions run: source ./shell/scripts/retrieve-versions.sh @@ -39,8 +42,8 @@ jobs: target_branch: 'gh-pages' tagged_release: ${{ needs.retrieve-tags-master.outputs.EXTENSIONS_TAG }} is_test: 'true' - test_repo: 'ui-plugin-examples' - test_branch: 'main' + test_ext_repo: 'ui-plugin-examples' + test_ext_branch: 'main' test-build-extension-catalog-master: needs: retrieve-tags-master uses: aalves08/dashboard/.github/workflows/build-extension-catalog.yml@12032-reusable-wf-tests-2 @@ -53,8 +56,8 @@ jobs: registry_user: ${{ github.actor }} tagged_release: ${{ needs.retrieve-tags-master.outputs.ECI_TAG }} is_test: 'true' - test_repo: 'ui-plugin-examples' - test_branch: 'main' + test_ext_repo: 'ui-plugin-examples' + test_ext_branch: 'main' secrets: registry_token: ${{ secrets.GITHUB_TOKEN }} test-release-shell-pkg-master: @@ -70,4 +73,30 @@ jobs: with: is_test: 'true' test_branch: '12032-reusable-wf-tests-2' - tag: ${{ needs.retrieve-tags-master.outputs.CREATORS_TAG }} \ No newline at end of file + tag: ${{ needs.retrieve-tags-master.outputs.CREATORS_TAG }} + slack-message: + if: always() + runs-on: ubuntu-latest + needs: [retrieve-tags-master, test-build-extension-charts-master, test-build-extension-catalog-master, test-release-shell-pkg-master, test-release-creators-pkg-master] + # TODO: SLACK_WEBHOOK_URL_WORKFLOWS not SLACK_WEBHOOK_URL + steps: + - name: Slack message for workflow success + env: + SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL_WORKFLOWS }} + if: success() + shell: bash + run: | + curl -X POST \ + -H "Content-type: application/json; charset=utf-8" \ + --data '{"name": "${{ github.job }}", "status": "Extensions workflow test succedded! ✅", "workflow_run": ${{ github.run_id }} }' \ + $SLACK_URL + - name: Slack message for workflow success + env: + SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL_WORKFLOWS }} + if: success() + shell: bash + run: | + curl -X POST \ + -H "Content-type: application/json; charset=utf-8" \ + --data '{"name": "${{ github.job }}", "status": "Extensions workflow test failed! 🆘", "workflow_run": ${{ github.run_id }} }' \ + $SLACK_URL