From 011e558597072aba35063ba37a546110e8943586 Mon Sep 17 00:00:00 2001 From: Alexandre Alves Date: Wed, 4 Dec 2024 15:41:35 +0000 Subject: [PATCH] update --- .../scripts/test-extensions-creators-build.sh | 39 +++-- .../test-extension-workflows-master.yml | 151 ++++++++++++------ 2 files changed, 128 insertions(+), 62 deletions(-) diff --git a/.github/workflows/scripts/test-extensions-creators-build.sh b/.github/workflows/scripts/test-extensions-creators-build.sh index 119754a8240..de6451e5e8d 100755 --- a/.github/workflows/scripts/test-extensions-creators-build.sh +++ b/.github/workflows/scripts/test-extensions-creators-build.sh @@ -2,19 +2,14 @@ set -eo pipefail -EXTERNAL_TAG=$1 -EXTERNAL_UPDATE=$2 - -if [ -z "${EXTERNAL_TAG}" ]; then - echo "Missing tag set on running this script! Cannot run without a tag!" - exit 1 -fi validate_tagged_extension_creator() { TAG=$1 + NODE_VERSION=$2 + UPDATE=$3 - if [ -n "$2" ]; then - echo "will also cover the update path and migration on this run" + if [ -n "$UPDATE" ]; then + echo "*** Will also cover the UPDATE path and MIGRATION on this run! ***" UPDATE="true" fi @@ -24,6 +19,11 @@ validate_tagged_extension_creator() { echo "*** Verifying extension creator for tag ::: ${TAG} ***" echo "Using temporary directory ${DIR}" + echo "=> Setting up node version required for this env: ${NODE_VERSION}" + + nvm install ${NODE_VERSION} + nvm use ${NODE_VERSION} + # TODO: change yarn create to use the new tag approach (jordon to tweak code upstream) npm init @rancher/extension@${TAG} test-pkg --app-name test-app | cat @@ -35,10 +35,10 @@ validate_tagged_extension_creator() { if [ $UPDATE == "true" ]; then - echo "*** Testing full update path for extensions ***" - echo "Testing update from legacy-v1 to legacy-v2" + echo "*** Testing FULL UPGRADE path for extensions ***" + echo "Testing UPGRADE from legacy-v1 to legacy-v2" - npm init @rancher/extension@legacy-v2 -- --update + npm init @rancher/extension@legacy-v2 -- --update -f rm -rf node_modules rm -rf yarn.lock @@ -47,7 +47,12 @@ validate_tagged_extension_creator() { yarn build-pkg test-pkg | cat - echo "Testing update from legacy-v2 to latest" + echo "*** Testing UPGRADE from legacy-v2 to latest ***" + + echo "=> Updating node version required for last leg of upgrade path: v20" + + nvm install v20 + nvm use v20 npm init @rancher/extension -- --migrate @@ -67,9 +72,9 @@ validate_tagged_extension_creator() { } # test creating an extension with latest shell releases + build -validate_tagged_extension_creator ${EXTERNAL_TAG} ${EXTERNAL_UPDATE} -# validate_tagged_extension_creator "legacy-v2" -# validate_tagged_extension_creator "latest" +validate_tagged_extension_creator "legacy-v1" "v16" +validate_tagged_extension_creator "legacy-v2" "v16" +validate_tagged_extension_creator "latest" "v20" # test update paths + build -# validate_tagged_extension_creator "legacy-v1" "true" \ No newline at end of file +validate_tagged_extension_creator "legacy-v1" "v16" "true" \ No newline at end of file diff --git a/.github/workflows/test-extension-workflows-master.yml b/.github/workflows/test-extension-workflows-master.yml index 1179afd11e1..5a69fa2c1d6 100644 --- a/.github/workflows/test-extension-workflows-master.yml +++ b/.github/workflows/test-extension-workflows-master.yml @@ -18,63 +18,82 @@ defaults: working-directory: ./ jobs: - test-extensions-build-legacy-v1: + test-extensions-creators-and-update-paths: runs-on: ubuntu-latest outputs: - test-legacy-v1-job-status: ${{ job.status }} + test-extensions-creators-and-update-paths-job-status: ${{ job.status }} steps: - name: Checkout code uses: actions/checkout@v4 with: ref: 12158-test-latest-published-versions-shell - - name: Setup Nodejs with yarn caching - uses: actions/setup-node@v4 - with: - node-version: '16' + # - name: Setup Nodejs with yarn caching + # uses: actions/setup-node@v4 + # with: + # node-version: '16' - name: Retrieve Shell and Creators versions - run: .github/workflows/scripts/test-extensions-creators-build.sh legacy-v1 true + run: .github/workflows/scripts/test-extensions-creators-build.sh id: test-extensions-and-creators shell: bash - test-extensions-build-legacy-v2: - runs-on: ubuntu-latest - outputs: - test-legacy-v2-job-status: ${{ job.status }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: 12158-test-latest-published-versions-shell + # test-extensions-build-legacy-v1: + # runs-on: ubuntu-latest + # outputs: + # test-legacy-v1-job-status: ${{ job.status }} + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + # with: + # ref: 12158-test-latest-published-versions-shell - - name: Setup Nodejs with yarn caching - uses: actions/setup-node@v4 - with: - node-version: '16' + # - name: Setup Nodejs with yarn caching + # uses: actions/setup-node@v4 + # with: + # node-version: '16' - - name: Retrieve Shell and Creators versions - run: .github/workflows/scripts/test-extensions-creators-build.sh legacy-v2 - id: test-extensions-and-creators - shell: bash - test-extensions-build-latest: - runs-on: ubuntu-latest - outputs: - test-latest-job-status: ${{ job.status }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: 12158-test-latest-published-versions-shell + # - name: Retrieve Shell and Creators versions + # run: .github/workflows/scripts/test-extensions-creators-build.sh legacy-v1 true + # id: test-extensions-and-creators + # shell: bash + # test-extensions-build-legacy-v2: + # runs-on: ubuntu-latest + # outputs: + # test-legacy-v2-job-status: ${{ job.status }} + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + # with: + # ref: 12158-test-latest-published-versions-shell - - name: Setup Nodejs with yarn caching - uses: actions/setup-node@v4 - with: - node-version: '16' + # - name: Setup Nodejs with yarn caching + # uses: actions/setup-node@v4 + # with: + # node-version: '16' - - name: Retrieve Shell and Creators versions - run: .github/workflows/scripts/test-extensions-creators-build.sh latest - id: test-extensions-and-creators - shell: bash + # - name: Retrieve Shell and Creators versions + # run: .github/workflows/scripts/test-extensions-creators-build.sh legacy-v2 + # id: test-extensions-and-creators + # shell: bash + # test-extensions-build-latest: + # runs-on: ubuntu-latest + # outputs: + # test-latest-job-status: ${{ job.status }} + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + # with: + # ref: 12158-test-latest-published-versions-shell + + # - name: Setup Nodejs with yarn caching + # uses: actions/setup-node@v4 + # with: + # node-version: '16' + + # - name: Retrieve Shell and Creators versions + # run: .github/workflows/scripts/test-extensions-creators-build.sh latest + # id: test-extensions-and-creators + # shell: bash # retrieve-tags-master: # runs-on: ubuntu-latest # outputs: @@ -179,10 +198,52 @@ jobs: # curl -X POST -H 'Content-type: application/json; charset=utf-8' \ # --data "{\"branch\": \"master\", \"message\": \"$MSG\", \"workflow_run\": ${{ github.run_id }} }" $SLACK_WEBHOOK + ################### + # THIS ONE WORKS JUST FINE!!!!! + ################### + # slack-message: + # if: ${{ always() }} + # runs-on: ubuntu-latest + # needs: [test-extensions-build-legacy-v1, test-extensions-build-legacy-v2, test-extensions-build-latest] + # steps: + # - name: Slack message for workflow + # if: always() + # shell: bash + # env: + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL_EXT_WFS }} + # run: | + # OUTPUT_ARRAY=("${{ needs.test-extensions-build-legacy-v1.outputs.test-legacy-v1-job-status }}" "${{ needs.test-extensions-build-legacy-v2.outputs.test-legacy-v2-job-status }}" "${{ needs.test-extensions-build-latest.outputs.test-latest-job-status }}") + # JOB_NAME_ARRAY=("test-extensions-build-legacy-v1 job" "test-extensions-build-legacy-v2 job" "test-extensions-build-latest job") + + # if [[ ${OUTPUT_ARRAY[@]} =~ "failure" ]]; then + # MSG_PREFIX="\nWorkflows testing for extensions failed! 🆘" + # else + # MSG_PREFIX="\nWorkflows testing for extensions succedded! ✅" + # fi + + # echo "message prefix ::: $MSG_PREFIX" + + # MSG_OUTPUT="$MSG_PREFIX" + + # for index in "${!OUTPUT_ARRAY[@]}" + # do + # if [[ ${OUTPUT_ARRAY[$index]} == "failure" ]]; then + # EMOJI="🆘" + # else + # EMOJI="✅" + # fi + # MSG_OUTPUT="$MSG_OUTPUT \n::: Status for ${JOB_NAME_ARRAY[$index]} => ${OUTPUT_ARRAY[$index]} $EMOJI" + # done + + # echo "message sent: $MSG_OUTPUT" + + # curl -X POST -H 'Content-type: application/json; charset=utf-8' \ + # --data "{\"branch\": \"master\", \"message\": \"$MSG\", \"workflow_run\": ${{ github.run_id }} }" $SLACK_WEBHOOK + slack-message: if: ${{ always() }} runs-on: ubuntu-latest - needs: [test-extensions-build-legacy-v1, test-extensions-build-legacy-v2, test-extensions-build-latest] + needs: [test-extensions-creators-and-update-paths] steps: - name: Slack message for workflow if: always() @@ -190,8 +251,8 @@ jobs: env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL_EXT_WFS }} run: | - OUTPUT_ARRAY=("${{ needs.test-extensions-build-legacy-v1.outputs.test-legacy-v1-job-status }}" "${{ needs.test-extensions-build-legacy-v2.outputs.test-legacy-v2-job-status }}" "${{ needs.test-extensions-build-latest.outputs.test-latest-job-status }}") - JOB_NAME_ARRAY=("test-extensions-build-legacy-v1 job" "test-extensions-build-legacy-v2 job" "test-extensions-build-latest job") + OUTPUT_ARRAY=("${{ needs.test-extensions-creators-and-update-paths-job-status.outputs.test-legacy-v1-job-status }}") + JOB_NAME_ARRAY=("test-extensions-creators-and-update-paths-job-status job") if [[ ${OUTPUT_ARRAY[@]} =~ "failure" ]]; then MSG_PREFIX="\nWorkflows testing for extensions failed! 🆘" @@ -216,4 +277,4 @@ jobs: echo "message sent: $MSG_OUTPUT" curl -X POST -H 'Content-type: application/json; charset=utf-8' \ - --data "{\"branch\": \"master\", \"message\": \"$MSG\", \"workflow_run\": ${{ github.run_id }} }" $SLACK_WEBHOOK \ No newline at end of file + --data "{\"branch\": \"master\", \"message\": \"$MSG_OUTPUT\", \"workflow_run\": ${{ github.run_id }} }" $SLACK_WEBHOOK \ No newline at end of file