Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use org runners for workflows that run in PR gates #11616

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
18 changes: 18 additions & 0 deletions .github/actions/setup-node/action.yaml
Original file line number Diff line number Diff line change
@@ -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'
8 changes: 3 additions & 5 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/check-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/docusaurus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr-gh-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/storybook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
77 changes: 52 additions & 25 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
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
BUILD_DASHBOARD: false

E2E_BUILD_DIST_NAME: dist
E2E_BUILD_DIST_DIR: dist
Expand All @@ -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
Expand All @@ -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: [
Expand All @@ -84,22 +91,42 @@ 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: |
echo "OS Info"
cat /etc/os-release

echo "Chrome installed by default"
google-chrome --version

echo "uninstal chrome"
# sudo apt-get remove google-chrome-stable
sudo dpkg -r google-chrome-stable

echo "install wget"
sudo apt-get install -y wget

echo "download target chrome"
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
wget -q http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_129.0.6668.100-1_amd64.deb
# sudo apt-get install -y --allow-downgrades ./google-chrome-stable_129.0.6668.100-1_amd64.deb || true
# sudo apt --fix-broken install

echo "install target chrome"
sudo dpkg -i google-chrome-stable_129.0.6668.100-1_amd64.deb
# sudo apt install --assume-yes --fix-broken

echo "check target chrome"
google-chrome --version

- name: Download e2e build
Expand All @@ -119,15 +146,15 @@ 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
- name: Run user tests
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 }}
Expand All @@ -139,9 +166,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:
Expand All @@ -162,9 +189,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:
Expand All @@ -173,9 +200,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:
Expand All @@ -184,16 +211,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
Expand All @@ -204,14 +230,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
Expand Down Expand Up @@ -245,7 +271,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:
Expand Down
10 changes: 8 additions & 2 deletions cypress/e2e/po/components/sortable-table.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/po/pages/explorer/config-map.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/po/pages/explorer/network-policy.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
7 changes: 6 additions & 1 deletion shell/scripts/test-plugins-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Loading