diff --git a/.github/actions/setup-node/action.yaml b/.github/actions/setup-node/action.yaml new file mode 100644 index 00000000000..98059c70676 --- /dev/null +++ b/.github/actions/setup-node/action.yaml @@ -0,0 +1,18 @@ +name: Setup Node +description: Setup node, including yarn + +runs: + using: 'composite' + steps: + - name: Setup yarn + shell: bash + # if we have yarn, no op + # if no yarn, install (probably running in non-containerized runners) + run: | + yarn || curl -fsSL -o ~/bin/yarn https://github.com/yarnpkg/yarn/releases/download/v1.22.17/yarn-1.22.17.js && chmod +x ~/bin/yarn && echo "~/bin" >> $GITHUB_PATH + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'yarn' diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index df7dcdfcfb6..308f532bf73 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -1,13 +1,11 @@ name: Setup UI Env -description: Setup node, python and call bootstrap script +description: Setup node, yarn install runs: using: 'composite' steps: - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'yarn' + - name: Setup Node + uses: ./.github/actions/setup-node - name: Install packages shell: bash diff --git a/.github/workflows/check-plugins.yaml b/.github/workflows/check-plugins.yaml index a8fbb48be66..dfa73bac488 100644 --- a/.github/workflows/check-plugins.yaml +++ b/.github/workflows/check-plugins.yaml @@ -7,19 +7,14 @@ env: TEST_PERSIST_BUILD: true jobs: validate: - runs-on: ubuntu-latest + # Resource starved when running in container, so run in non-container runner + runs-on: runs-on,runner=8cpu-linux-x64,run-id=${{ github.run_id }} 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: Setup Node + uses: ./.github/actions/setup-node - name: Validate Plugin build system run: ./shell/scripts/test-plugins-build.sh diff --git a/.github/workflows/docusaurus.yaml b/.github/workflows/docusaurus.yaml index 38056fe0316..78f768712e8 100644 --- a/.github/workflows/docusaurus.yaml +++ b/.github/workflows/docusaurus.yaml @@ -10,14 +10,12 @@ on: jobs: build: name: Build - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: yarn - + - name: Setup Node + uses: ./.github/actions/setup-node - name: Install dependencies run: cd docusaurus/ && yarn install:ci - name: Build website @@ -38,7 +36,8 @@ jobs: deploy: name: Publish if: ${{ github.event_name == 'push' && github.repository_owner == 'rancher' }} - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s needs: build # This is required to avoid https://github.com/actions/deploy-pages/issues/271 diff --git a/.github/workflows/pr-gh-project.yaml b/.github/workflows/pr-gh-project.yaml index dcb875c3dac..72774afc4d7 100644 --- a/.github/workflows/pr-gh-project.yaml +++ b/.github/workflows/pr-gh-project.yaml @@ -10,7 +10,8 @@ jobs: pull-requests: write repository-projects: write id-token: write - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v2 - name: Use Node.js diff --git a/.github/workflows/storybook.yaml b/.github/workflows/storybook.yaml index b71bc7a58c8..8a5b3fd0388 100644 --- a/.github/workflows/storybook.yaml +++ b/.github/workflows/storybook.yaml @@ -10,13 +10,12 @@ on: - master jobs: storybook: - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' + - name: Setup Node + uses: ./.github/actions/setup-node - name: Install packages run: yarn install - name: Build Storybook diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e0f265c5c25..e2cff54a3e6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -35,13 +35,19 @@ env: jobs: e2e-ui-build: if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')" - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v4 with: fetch-depth: 1 - name: Setup env uses: ./.github/actions/setup + - name: Ensure repo dir is accepted as safe by git + # in bci user who runs git commands and repo folder owner is different + shell: bash + run: | + git config --global --add safe.directory $PWD - name: Build e2e run: yarn e2e:build - name: Upload e2e build @@ -61,15 +67,16 @@ jobs: retention-days: 10 compression-level: 9 - e2e-test: if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')" needs: e2e-ui-build + # Cannot run container (rancher) in container (runner), so run in non-container runner + runs-on: runs-on,runner=8cpu-linux-x64,run-id=${{ github.run_id }} strategy: fail-fast: false matrix: role: [ - { username: 'admin', tag: '@adminUser' }, + { username: 'admin', tag: '@adminUser' }, { username: 'standard_user', tag: '@standardUser' } ] features: [ @@ -84,23 +91,23 @@ jobs: ['@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 + # # 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://dl.google.com/linux/chrome/deb/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 @@ -119,7 +126,7 @@ jobs: - name: Setup Rancher and user run: | yarn e2e:prod - env: + 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 @@ -127,7 +134,7 @@ jobs: run: | yarn e2e:prod [ "$BUILD_DASHBOARD" != "false" ] || exit 0 - env: + 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 }} @@ -139,9 +146,9 @@ jobs: name: ${{github.run_number}}-${{github.run_attempt}}-screenshots-${{ matrix.role.tag }}+${{ matrix.features[0] }} path: cypress/screenshots - unit-test: - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v4 with: @@ -162,9 +169,9 @@ jobs: name: ${{github.run_number}}-${{github.run_attempt}}-coverage path: coverage-artifacts/**/* - i18n: - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v4 with: @@ -173,9 +180,9 @@ jobs: - name: Run i18n lint uses: ./.github/actions/i18n-lint - lint: - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v4 with: @@ -184,16 +191,15 @@ jobs: - name: Run tests uses: ./.github/actions/lint - check-i18n: - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v4 with: fetch-depth: 1 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' + - name: Setup Node + uses: ./.github/actions/setup-node - name: Install packages run: yarn install:ci @@ -204,14 +210,14 @@ jobs: ./scripts/check-i18n -s -x check-i18n-links: - runs-on: ubuntu-latest + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v4 with: fetch-depth: 1 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' + - name: Setup Node + uses: ./.github/actions/setup-node - name: Install packages run: yarn install:ci @@ -245,7 +251,8 @@ jobs: # 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 + container: registry.suse.com/bci/nodejs:20 + runs-on: org-${{ github.repository_owner_id }}-amd64-k8s steps: - uses: actions/checkout@v4 with: diff --git a/cypress/e2e/po/components/sortable-table.po.ts b/cypress/e2e/po/components/sortable-table.po.ts index 5f59b1849b4..0e3f77ad2bf 100644 --- a/cypress/e2e/po/components/sortable-table.po.ts +++ b/cypress/e2e/po/components/sortable-table.po.ts @@ -80,11 +80,17 @@ export default class SortableTablePo extends ComponentPo { * @param searchText * @returns */ - filter(searchText: string) { - return this.filterComponent() + filter(searchText: string, checkQuery = false) { + const res = this.filterComponent() .focus() .clear() .type(searchText); + + if (checkQuery) { + cy.url().should('include', `q=${ searchText }`); + } + + return res; } resetFilter() { diff --git a/cypress/e2e/po/pages/explorer/config-map.po.ts b/cypress/e2e/po/pages/explorer/config-map.po.ts index 60459d0536d..6204f51e63f 100644 --- a/cypress/e2e/po/pages/explorer/config-map.po.ts +++ b/cypress/e2e/po/pages/explorer/config-map.po.ts @@ -39,7 +39,7 @@ export class ConfigMapPagePo extends PagePo { } searchForConfigMap(name: string) { - return this.list().resourceTable().sortableTable().filter(name); + return this.list().resourceTable().sortableTable().filter(name, true); } title() { diff --git a/cypress/e2e/po/pages/explorer/network-policy.po.ts b/cypress/e2e/po/pages/explorer/network-policy.po.ts index ad229c9d6ab..77999c094af 100644 --- a/cypress/e2e/po/pages/explorer/network-policy.po.ts +++ b/cypress/e2e/po/pages/explorer/network-policy.po.ts @@ -39,6 +39,6 @@ export class NetworkPolicyPagePo extends PagePo { } searchForNetworkPolicy(name: string) { - return this.list().resourceTable().sortableTable().filter(name); + return this.list().resourceTable().sortableTable().filter(name, true); } } diff --git a/shell/scripts/test-plugins-build.sh b/shell/scripts/test-plugins-build.sh index bbac4cc4f74..1be2e98f98b 100755 --- a/shell/scripts/test-plugins-build.sh +++ b/shell/scripts/test-plugins-build.sh @@ -128,7 +128,10 @@ if [ "${SKIP_STANDALONE}" == "false" ]; then pushd test-app > /dev/null yarn install - FORCE_COLOR=true yarn build | cat + + echo "Building skeleton app" + + NODE_OPTIONS=--max_old_space_size=4096 FORCE_COLOR=true yarn build | cat # Add test list component to the test package # Validates rancher-components imports @@ -228,3 +231,5 @@ function clone_repo_test_extension_build() { # clone_repo_test_extension_build "capi-ui-extension" "capi" echo "All done" +# Force an exit +exit 0