diff --git a/.github/workflows/build-extension-catalog.yml b/.github/workflows/build-extension-catalog.yml index 2a81b51b361..2f4b7c52d08 100644 --- a/.github/workflows/build-extension-catalog.yml +++ b/.github/workflows/build-extension-catalog.yml @@ -12,22 +12,43 @@ on: tagged_release: required: false type: string + is_test: + required: false + type: string + test_ext_repo: + required: false + type: string + test_ext_branch: + required: false + type: string secrets: registry_token: required: true + outputs: + build-extension-catalog-job-status: + value: ${{ jobs.build-extension-catalog.outputs.build-status }} jobs: build-extension-catalog: name: Build container image - if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') + if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test == 'true' runs-on: ubuntu-latest permissions: actions: write contents: read packages: write - + outputs: + build-status: ${{ job.status }} steps: - - name: Checkout repository + - if: inputs.is_test == 'true' + name: Checkout repository (test flow) + uses: actions/checkout@v4 + with: + repository: rancher/${{ inputs.test_ext_repo }} + ref: ${{ inputs.test_ext_branch }} + + - if: inputs.is_test != 'true' + name: Checkout repository (normal flow) uses: actions/checkout@v4 - name: Enable Corepack @@ -60,7 +81,7 @@ jobs: run: yarn - name: Parse Extension Name - if: github.ref_type == 'tag' + if: github.ref_type == 'tag' || inputs.is_test == 'true' id: parsed-name env: GH_TOKEN: ${{ github.token }} @@ -69,7 +90,13 @@ jobs: - name: Build and push UI image run: | - publish="yarn publish-pkgs -cp -r ${{ inputs.registry_target }} -o ${{ github.repository_owner }}" + publish="yarn publish-pkgs -c" + + if [[ "${{ inputs.is_test }}" != "true" ]]; then + publish="$publish -p" + fi + + publish="$publish -r ${{ inputs.registry_target }} -o ${{ github.repository_owner }}" if [[ -n "${{ inputs.tagged_release }}" ]]; then publish="$publish -t ${{ inputs.tagged_release }}" diff --git a/.github/workflows/build-extension-charts.yml b/.github/workflows/build-extension-charts.yml index 0cb43d4408d..edba881700d 100644 --- a/.github/workflows/build-extension-charts.yml +++ b/.github/workflows/build-extension-charts.yml @@ -9,6 +9,20 @@ on: tagged_release: required: true type: string + is_test: + required: false + type: string + test_ext_repo: + required: false + type: string + test_ext_branch: + required: false + type: string + outputs: + build-job-status: + value: ${{ jobs.build-extension-artifact.outputs.build-status }} + release-job-status: + value: ${{ jobs.release.outputs.release-status }} env: ACTIONS_RUNNER_DEBUG: false @@ -26,8 +40,19 @@ jobs: permissions: actions: write contents: read + outputs: + build-status: ${{ job.status }} steps: - - name: Checkout + - if: inputs.is_test == 'true' + name: Checkout (test flow) + uses: actions/checkout@v4 + with: + repository: rancher/${{ inputs.test_ext_repo }} + ref: ${{ inputs.test_ext_branch }} + fetch-depth: 0 + + - if: inputs.is_test != 'true' + name: Checkout (normal flow) uses: actions/checkout@v4 with: fetch-depth: 0 @@ -55,7 +80,7 @@ jobs: run: yarn - name: Parse Extension Name - if: github.ref_type == 'tag' + if: github.ref_type == 'tag' || inputs.is_test == 'true' id: parsed-name env: GH_TOKEN: ${{ github.token }} @@ -72,10 +97,14 @@ jobs: publish="$publish -t ${{ inputs.tagged_release }}" fi + if [[ "${{ inputs.is_test }}" == "true" ]]; then + publish="$publish -f" + fi + $publish - name: Upload charts artifact - if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') + if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test == 'true' uses: actions/upload-artifact@v3 with: name: charts @@ -83,7 +112,7 @@ jobs: release: name: Release Build - if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') + if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test != 'true' needs: build-extension-artifact runs-on: ubuntu-latest permissions: @@ -91,6 +120,8 @@ jobs: contents: write deployments: write pages: write + outputs: + release-status: ${{ job.status }} steps: - name: Checkout uses: actions/checkout@v4 @@ -119,4 +150,4 @@ jobs: charts_dir: ./charts/* env: CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - CR_SKIP_EXISTING: true + CR_SKIP_EXISTING: true \ No newline at end of file diff --git a/.github/workflows/check-plugins.yaml b/.github/workflows/check-plugins.yaml deleted file mode 100644 index a8fbb48be66..00000000000 --- a/.github/workflows/check-plugins.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: check-plugins-build -on: - pull_request: - branches: - - master -env: - TEST_PERSIST_BUILD: true -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Enable Corepack - run: corepack enable - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - - - name: Validate Plugin build system - run: ./shell/scripts/test-plugins-build.sh - shell: bash - - - name: Upload files - uses: actions/upload-artifact@v3 - if: failure() - with: - name: test - path: | - /tmp/tmp.**/test-app - !/tmp/tmp.**/test-app/dist/js/*.map - !/tmp/tmp.**/test-app/node_modules/ - !/tmp/tmp.**/test-app/pkg/test-pkg/node_modules/ - retention-days: 2 diff --git a/.github/workflows/docusaurus.yaml b/.github/workflows/docusaurus.yaml deleted file mode 100644 index 38056fe0316..00000000000 --- a/.github/workflows/docusaurus.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: Publish Docusaurus - -on: - push: - branches: - - master - pull_request: - branches: - - master -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: yarn - - - name: Install dependencies - run: cd docusaurus/ && yarn install:ci - - name: Build website - run: cd docusaurus/ && yarn build - - name: Add CNAME - run: | - echo "extensions.rancher.io" > ./docusaurus/build/CNAME - - - name: Upload artifact - if: ${{ github.event_name == 'push' && github.repository_owner == 'rancher' }} - uses: actions/upload-pages-artifact@v3 - with: - path: ./docusaurus/build - retention-days: 10 - compression-level: 9 - - # Seperate the deploy job to isolate write permissions - deploy: - name: Publish - if: ${{ github.event_name == 'push' && github.repository_owner == 'rancher' }} - runs-on: ubuntu-latest - needs: build - - # This is required to avoid https://github.com/actions/deploy-pages/issues/271 - environment: - name: github-pages - - permissions: - pages: write - id-token: write - - steps: - - name: Deploy to GitHub Pages - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/release-shell-pkg.yaml b/.github/workflows/release-shell-pkg.yaml index 9caef82bee0..6d8edc1536e 100644 --- a/.github/workflows/release-shell-pkg.yaml +++ b/.github/workflows/release-shell-pkg.yaml @@ -5,15 +5,43 @@ on: tags: - 'shell-pkg-v*' - 'creators-pkg-v*' + workflow_call: + inputs: + tag: + required: false + type: string + is_test: + required: false + type: string + test_branch: + required: false + type: string + outputs: + build-release-shell-creators-status: + value: ${{ jobs.build.outputs.build-status }} jobs: + build: runs-on: ubuntu-latest permissions: contents: read packages: write + if: github.repository == 'rancher/dashboard' && (github.event_name == 'workflow_call' || (github.event_name == 'push' && github.event.ref == 'refs/tags/${{ github.ref_name }}')) + outputs: + build-status: ${{ job.status }} steps: - - uses: actions/checkout@v3 + - if: inputs.is_test == 'true' && inputs.test_branch != '' + name: Checkout (test flow) + uses: actions/checkout@v3 + with: + persist-credentials: false + ref: ${{ inputs.test_branch }} + fetch-depth: 0 + + - if: inputs.is_test != 'true' + name: Checkout (normal flow) + uses: actions/checkout@v3 with: fetch-depth: 0 persist-credentials: false @@ -29,35 +57,36 @@ jobs: - name: Check Tags Version Matching env: - TAG: ${{github.ref_name}} + TAG: ${{ inputs.tag || github.ref_name }} run: ./.github/workflows/scripts/check-package-tag-version.sh shell: bash - - 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 - # the version number on package.json for Shell in order - # to release it in verdaccio for it's tests - - name: Reset repository (file system) - run: | - git reset --hard HEAD - echo $NPM_REGISTRY - cat ./shell/package.json - - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - registry-url: 'https://registry.npmjs.org' - scope: '@rancher' + # # Reset the local (ci) repository state because + # # The previous step (Validate Plugin build system) changes + # # the version number on package.json for Shell in order + # # to release it in verdaccio for it's tests + # - name: Reset repository (file system) + # run: | + # git reset --hard HEAD + # echo $NPM_REGISTRY + # cat ./shell/package.json - - name: Install packages - run: yarn install --frozen-lockfile + # - uses: actions/setup-node@v4 + # with: + # node-version-file: '.nvmrc' + # registry-url: 'https://registry.npmjs.org' + # scope: '@rancher' - - name: Publish Shell Package to npm - run: ./shell/scripts/publish-shell.sh --npm - env: - TAG: ${{github.ref_name}} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + # - name: Install packages + # run: yarn install --frozen-lockfile + + # - name: Publish Shell Package to npm + # run: ./shell/scripts/publish-shell.sh --npm + # env: + # TAG: ${{ inputs.tag || github.ref_name }} + # DRY_RUN: ${{ inputs.is_test }} + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/storybook.yaml b/.github/workflows/storybook.yaml deleted file mode 100644 index b71bc7a58c8..00000000000 --- a/.github/workflows/storybook.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: storybook -env: - STORYBOOK_TOKEN: ${{ secrets.STORYBOOK_TOKEN }} -on: - push: - branches: - - master - pull_request: - branches: - - master -jobs: - storybook: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - name: Install packages - run: yarn install - - name: Build Storybook - run: | - yarn build-storybook - - name: Publish Storybook - if: ${{ github.event_name == 'push' && github.repository_owner == 'rancher'}} - run: .github/workflows/scripts/publish-storybook diff --git a/.github/workflows/test-extension-workflows.yml b/.github/workflows/test-extension-workflows.yml new file mode 100644 index 00000000000..68cd82f55ad --- /dev/null +++ b/.github/workflows/test-extension-workflows.yml @@ -0,0 +1,117 @@ +name: Test Extension workflows + +on: + push: + branches: [12032-reusable-wf-tests-2] + +defaults: + run: + shell: bash + working-directory: ./ + +jobs: + retrieve-tags-master: + runs-on: ubuntu-latest + outputs: + SHELL_TAG: ${{ steps.retrieve-data.outputs.SHELL_TAG }} + CREATORS_TAG: ${{ steps.retrieve-data.outputs.CREATORS_TAG }} + ECI_TAG: ${{ steps.retrieve-data.outputs.ECI_TAG }} + EXTENSIONS_TAG: ${{ steps.retrieve-data.outputs.EXTENSIONS_TAG }} + CURR_JOB_ID: ${{ github.job }} + tags-job-status: ${{ job.status }} + 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 + id: retrieve-data + shell: bash + # test-build-extension-charts-master: + # needs: retrieve-tags-master + # uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master + # permissions: + # actions: write + # contents: write + # deployments: write + # pages: write + # with: + # target_branch: 'gh-pages' + # tagged_release: ${{ needs.retrieve-tags-master.outputs.EXTENSIONS_TAG }} + # is_test: 'true' + # test_ext_repo: 'ui-plugin-examples' + # test_ext_branch: 'main' + # test-build-extension-catalog-master: + # needs: retrieve-tags-master + # uses: rancher/dashboard/.github/workflows/build-extension-catalog.yml@master + # permissions: + # actions: write + # contents: read + # packages: write + # with: + # registry_target: ghcr.io + # registry_user: ${{ github.actor }} + # tagged_release: ${{ needs.retrieve-tags-master.outputs.ECI_TAG }} + # is_test: 'true' + # test_ext_repo: 'ui-plugin-examples' + # test_ext_branch: 'main' + # secrets: + # registry_token: ${{ secrets.GITHUB_TOKEN }} + test-release-shell-pkg-master: + needs: retrieve-tags-master + uses: aalves08/dashboard/.github/workflows/release-shell-pkg.yaml@12032-reusable-wf-tests-2 + with: + # is_test: 'true' + # test_branch: 'master' + tag: ${{ needs.retrieve-tags-master.outputs.SHELL_TAG }} + # test-release-creators-pkg-master: + # needs: retrieve-tags-master + # uses: rancher/dashboard/.github/workflows/release-shell-pkg.yaml@master + # with: + # is_test: 'true' + # test_branch: 'master' + # 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] + # steps: + # - name: Slack message for workflow + # if: always() + # shell: bash + # env: + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL_EXT_WFS }} + # run: | + # OUTPUT_ARRAY=("${{ needs.retrieve-tags-master.outputs.tags-job-status }}" "${{ needs.test-build-extension-charts-master.outputs.build-job-status }}" "${{ needs.test-build-extension-charts-master.outputs.release-job-status }}" "${{ needs.test-build-extension-catalog-master.outputs.build-extension-catalog-job-status }}" "${{ needs.test-release-shell-pkg-master.outputs.build-release-shell-creators-status }}" "${{ needs.test-release-creators-pkg-master.outputs.build-release-shell-creators-status }}") + + # if [[ ${OUTPUT_ARRAY[@]} =~ "failure" ]]; then + # MSG_PREFIX="Workflows testing for extensions failed! 🆘" + # else + # MSG_PREFIX="Workflows testing for extensions succedded! ✅" + # fi + + # echo "message prefix ::: $MSG_PREFIX" + + # TAGS_OUTPUT_STRING="status for retrieve-tags-master - build => ${{ needs.retrieve-tags-master.outputs.tags-job-status }}" + # EXT_CHART_BUILD_OUTPUT_STRING="status for test-build-extension-charts-master - build => ${{ needs.test-build-extension-charts-master.outputs.build-job-status }}" + # EXT_CHART_RELEASE_OUTPUT_STRING="status for test-build-extension-charts-master - release => ${{ needs.test-build-extension-charts-master.outputs.release-job-status }}" + # EXT_CATALOG_BUILD_OUTPUT_STRING="status for test-build-extension-catalog-master - build => ${{ needs.test-build-extension-catalog-master.outputs.build-extension-catalog-job-status }}" + # RELEASE_SHELL_PKG_OUTPUT_STRING="status for test-release-shell-pkg-master - release => ${{ needs.test-release-shell-pkg-master.outputs.build-release-shell-creators-status }}" + # RELEASE_CREATORS_PKG_OUTPUT_STRING="status for test-release-creators-pkg-master - release => ${{ needs.test-release-creators-pkg-master.outputs.build-release-shell-creators-status }}" + + # echo $TAGS_OUTPUT_STRING + # echo $EXT_CHART_BUILD_OUTPUT_STRING + # echo $EXT_CHART_RELEASE_OUTPUT_STRING + # echo $EXT_CATALOG_BUILD_OUTPUT_STRING + # echo $RELEASE_SHELL_PKG_OUTPUT_STRING + # echo $RELEASE_CREATORS_PKG_OUTPUT_STRING + + # MSG="$MSG_PREFIX ::: $TAGS_OUTPUT_STRING ::: $EXT_CHART_BUILD_OUTPUT_STRING ::: $EXT_CHART_RELEASE_OUTPUT_STRING ::: $EXT_CATALOG_BUILD_OUTPUT_STRING ::: $RELEASE_SHELL_PKG_OUTPUT_STRING ::: $RELEASE_CREATORS_PKG_OUTPUT_STRING" + + # echo "message sent: $MSG" + + # curl -X POST -H 'Content-type: application/json; charset=utf-8' \ + # --data '{ branch: "master", message: $MSG }' $SLACK_WEBHOOK \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index e0f265c5c25..00000000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,258 +0,0 @@ -name: Tests -on: - push: - branches: - - master - - 'release-*' - pull_request: - branches: - - master - - 'release-*' - workflow_dispatch: - inputs: - environment: - description: 'Environment to run tests against' - type: environment - required: true - -env: - TEST_USERNAME: admin - TEST_PASSWORD: password - CATTLE_BOOTSTRAP_PASSWORD: password - TEST_BASE_URL: https://127.0.0.1/dashboard - API: https://127.0.0.1 - TEST_PROJECT_ID: rancher-dashboard - CYPRESS_API_URL: http://139.59.134.103:1234/ - TEST_RUN_ID: ${{github.run_number}}-${{github.run_attempt}}-${{github.event.pull_request.title || github.event.head_commit.message}} - # Build the dashboard to use in tests. When set to false it will grab `latest` from CDN (useful for running e2e tests quickly) - BUILD_DASHBOARD: true - - E2E_BUILD_DIST_NAME: dist - E2E_BUILD_DIST_DIR: dist - E2E_BUILD_DIST_EMBER_NAME: dist_ember - E2E_BUILD_DIST_EMBER_DIR: dist_ember - -jobs: - e2e-ui-build: - if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Setup env - uses: ./.github/actions/setup - - name: Build e2e - run: yarn e2e:build - - name: Upload e2e build - uses: actions/upload-artifact@v4 - with: - name: ${{ env.E2E_BUILD_DIST_NAME }} - path: ${{ env.E2E_BUILD_DIST_DIR }}/ - if-no-files-found: error - retention-days: 10 - compression-level: 9 - - name: Upload e2e build ember - uses: actions/upload-artifact@v4 - with: - name: ${{ env.E2E_BUILD_DIST_EMBER_NAME }} - path: ${{ env.E2E_BUILD_DIST_EMBER_DIR }}/ - if-no-files-found: error - retention-days: 10 - compression-level: 9 - - - e2e-test: - if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')" - needs: e2e-ui-build - strategy: - fail-fast: false - matrix: - role: [ - { username: 'admin', tag: '@adminUser' }, - { username: 'standard_user', tag: '@standardUser' } - ] - features: [ - ['@navigation', '@extensions'], - ['@charts'], - ['@explorer'], - ['@explorer2'], - ['@fleet'], - ['@generic', '@globalSettings'], - ['@manager'], - ['@userMenu', '@usersAndAuths'], - ['@components'], - ['@vai'] - ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Setup env - uses: ./.github/actions/setup - - # Installing fixed version of Chrome since latest version does not work (128 didn't work) - # Leaving this here again in case we need to pin to a specific Chrome version in the future - - name: Install Chrome 127 - run: | - sudo apt-get install -y wget - cd /tmp - wget -q http://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_127.0.6533.72-1_amd64.deb - sudo apt-get install -y --allow-downgrades ./google-chrome-stable_127.0.6533.72-1_amd64.deb - google-chrome --version - - - name: Download e2e build - uses: actions/download-artifact@v4 - with: - name: ${{ env.E2E_BUILD_DIST_NAME }} - path: ${{ env.E2E_BUILD_DIST_DIR }} - - name: Download e2e build ember - uses: actions/download-artifact@v4 - with: - name: ${{ env.E2E_BUILD_DIST_EMBER_NAME }} - path: ${{ env.E2E_BUILD_DIST_EMBER_DIR }} - - - name: Run Rancher - run: yarn e2e:docker - - - name: Setup Rancher and user - run: | - yarn e2e:prod - env: - GREP_TAGS: ${{ matrix.role.tag }}Setup+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}Setup+${{ matrix.features[1] || matrix.features[0] }} --@jenkins - TEST_USERNAME: admin - TEST_ONLY: setup - - name: Run user tests - run: | - yarn e2e:prod - [ "$BUILD_DASHBOARD" != "false" ] || exit 0 - env: - TEST_SKIP: setup - GREP_TAGS: ${{ matrix.role.tag }}+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}+${{ matrix.features[1] || matrix.features[0] }} --@jenkins - TEST_USERNAME: ${{ matrix.role.username }} - - - name: Upload screenshots - uses: actions/upload-artifact@v4 - if: ${{ failure() }} - with: - name: ${{github.run_number}}-${{github.run_attempt}}-screenshots-${{ matrix.role.tag }}+${{ matrix.features[0] }} - path: cypress/screenshots - - - unit-test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Run tests - uses: ./.github/actions/unit-tests - - - name: Collect Coverage - run: | - mkdir -p coverage-artifacts/coverage - cp coverage/unit/coverage-final.json coverage-artifacts/coverage/coverage-unit.json - cp -r coverage/unit/ coverage-artifacts/coverage/unit/ - - - name: Upload coverage - uses: actions/upload-artifact@v4 - with: - name: ${{github.run_number}}-${{github.run_attempt}}-coverage - path: coverage-artifacts/**/* - - - i18n: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Run i18n lint - uses: ./.github/actions/i18n-lint - - - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Run tests - uses: ./.github/actions/lint - - - check-i18n: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - - name: Install packages - run: yarn install:ci - - - name: Run i18n string check - run: | - # Falure won't fail the job (remove -x when all current issues are fixed) - ./scripts/check-i18n -s -x - - check-i18n-links: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - - name: Install packages - run: yarn install:ci - - - name: Run check of all http links in the i18n files (broken link check) - run: | - ./scripts/check-i18n-links - - # coverage: - # runs-on: ubuntu-latest - # needs: - # - unit-test - # steps: - # - uses: actions/checkout@v3 - # with: - # fetch-depth: 1 - - # - uses: actions/setup-node@v4 - # with: - # node-version-file: '.nvmrc' - - # - name: Download Coverage Artifacts - # uses: actions/download-artifact@v3 - # with: - # name: ${{github.run_number}}-${{github.run_attempt}}-coverage - - # - name: Install Codecov CLI - # run : .github/workflows/scripts/install-codecov.sh - - # - name: Upload tests coverage report to Codecov - # run: ./codecov --verbose upload-process -t ${{ secrets.CODECOV_TOKEN }} -n ${{github.run_number}}-${{github.run_attempt}}-coverage -F unit -f ./coverage/coverage-unit.json - - check-e2e-tags: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - name: Check e2e tags - run: | - ./scripts/check-e2e-tests-for-tags diff --git a/shell/scripts/extension/parse-tag-name b/shell/scripts/extension/parse-tag-name index e87e6bbff0b..ef19335b4af 100755 --- a/shell/scripts/extension/parse-tag-name +++ b/shell/scripts/extension/parse-tag-name @@ -4,6 +4,8 @@ GITHUB_RELEASE_TAG=$1 GITHUB_RUN_ID=$2 GITHUB_WORKFLOW_TYPE=$3 +echo "Parse tag name - evaluating release tag $GITHUB_RELEASE_TAG" + # Ensure "catalog" workflow release tag name does not match a pkg/ if [[ "${GITHUB_WORKFLOW_TYPE}" == "catalog" ]]; then for d in pkg/*/ ; do diff --git a/shell/scripts/publish-shell.sh b/shell/scripts/publish-shell.sh index e0e11671951..d64e53d70c3 100755 --- a/shell/scripts/publish-shell.sh +++ b/shell/scripts/publish-shell.sh @@ -50,6 +50,13 @@ function publish() { PUBLISH_ARGS="--no-git-tag-version --access public --registry $NPM_REGISTRY --tag pre-release" fi + # when testing the workflow, we don't want to actually do an npm publish but only a dry run + if [ ${DRY_RUN} == "true" ]; then + PUBLISH_ARGS="--no-git-tag-version --access public --registry $NPM_REGISTRY --tag pre-release --dry-run" + fi + + echo "Publish to NPM - arguments ::: ${PUBLISH_ARGS}" + echo "Publishing ${NAME} from ${FOLDER}" pushd ${FOLDER} >/dev/null diff --git a/shell/scripts/retrieve-versions.sh b/shell/scripts/retrieve-versions.sh new file mode 100755 index 00000000000..811aafcb202 --- /dev/null +++ b/shell/scripts/retrieve-versions.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +set -eo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +BASE_DIR="$( + cd $SCRIPT_DIR && cd ../.. & + pwd +)" +SHELL_DIR=$BASE_DIR/shell +CREATORS_DIR=$BASE_DIR/creators/extension + +function generate_tag_export() { + NAME=$1 + + case $NAME in + "shell") + SHELL_V=$(jq -r .version ${SHELL_DIR}/package.json) + echo "SHELL_TAG=shell-pkg-v$SHELL_V" >> $GITHUB_OUTPUT + echo "Shell tag retrieved ::: ${SHELL_V}" + ;; + "creators") + CREATORS_V=$(jq -r .version ${CREATORS_DIR}/package.json) + echo "CREATORS_TAG=creators-pkg-v$CREATORS_V" >> $GITHUB_OUTPUT + echo "Creators tag retrieved ::: ${CREATORS_V}" + ;; + "extension") + REPO_NAME=$2 + BRANCH=$3 + EXTENSION=$4 + git clone https://github.com/rancher/$REPO_NAME.git + pushd ${BASE_DIR}/$REPO_NAME + + git checkout $BRANCH + + ECI_NAME=$(jq -r .name ./package.json) + ECI_VERSION=$(jq -r .version ./package.json) + EXTENSION_VERSION=$(jq -r .version pkg/$EXTENSION/package.json) + ECI_TAG_FULL=$ECI_NAME-$ECI_VERSION + EXTENSION_TAG_FULL=$EXTENSION-$EXTENSION_VERSION + + echo "ECI_TAG=$ECI_TAG_FULL" >> $GITHUB_OUTPUT + echo "EXTENSION_TAG=$EXTENSION_TAG_FULL" >> $GITHUB_OUTPUT + echo "ECI tag retrieved ::: ${ECI_TAG_FULL}" + echo "Extension tag retrieved ::: ${EXTENSION_TAG_FULL}" + + popd + ;; + esac +} + +generate_tag_export "shell" +generate_tag_export "creators" +generate_tag_export "extension" "ui-plugin-examples" "main" "clock" \ No newline at end of file