Skip to content

Commit a97f7f2

Browse files
committed
Merge remote-tracking branch 'origin/main' into jd/26/02/makefile_dockerfile_konflux_rhds
2 parents 3117865 + 3184b80 commit a97f7f2

File tree

89 files changed

+8325
-8370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+8325
-8370
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
name: 'Playwright Browser Tests'
3+
description: |
4+
Run Playwright browser tests for workbench images.
5+
6+
Features:
7+
- Runs Playwright tests inside the official Microsoft Playwright container
8+
- Uses Podman to run the test container with proper isolation
9+
- Supports testcontainers for container orchestration
10+
- Uploads test reports as artifacts on pull requests
11+
12+
Requirements:
13+
- Podman must be installed and running
14+
- The workbench image must be available in the local Podman storage
15+
- tests/browser directory must contain the Playwright test configuration
16+
17+
inputs:
18+
test-target:
19+
description: 'The workbench image to test (full image reference).'
20+
required: true
21+
podman-socket:
22+
description: 'Path to Podman socket'
23+
required: false
24+
default: '/var/run/podman/podman.sock'
25+
playwright-version:
26+
description: 'Version of the Playwright container to use (e.g., v1.58.1-noble). If not provided, extracted from package.json5'
27+
required: false
28+
default: ''
29+
working-directory:
30+
description: 'Directory containing the Playwright tests'
31+
required: false
32+
default: 'tests/browser'
33+
upload-report:
34+
description: 'Whether to upload the Playwright report as an artifact'
35+
required: false
36+
default: 'false'
37+
artifact-name:
38+
description: 'Name for the uploaded artifact (required if upload-report is true)'
39+
required: false
40+
default: 'playwright-report'
41+
artifact-retention-days:
42+
description: 'Number of days to retain the artifact'
43+
required: false
44+
default: '30'
45+
46+
outputs:
47+
outcome:
48+
description: 'The outcome of the Playwright tests (success or failure)'
49+
value: ${{ steps.playwright.outcome }}
50+
51+
runs:
52+
using: 'composite'
53+
steps:
54+
- name: Determine Playwright version
55+
id: playwright-version
56+
shell: bash
57+
run: |
58+
if [[ -n "${INPUT_PLAYWRIGHT_VERSION}" ]]; then
59+
echo "version=${INPUT_PLAYWRIGHT_VERSION}" >> "$GITHUB_OUTPUT"
60+
else
61+
# Extract version from package.json5 (single source of truth)
62+
# package.json5 has: "@playwright/test": "=1.58.1"
63+
# Container tag format is: v1.58.1-noble
64+
PKG_VERSION=$(grep -oP '"@playwright/test":\s*"=?\K[0-9.]+' "${WORKING_DIRECTORY}/package.json5")
65+
if [[ -z "$PKG_VERSION" ]]; then
66+
echo "::error::Failed to extract Playwright version from package.json5"
67+
exit 1
68+
fi
69+
echo "version=v${PKG_VERSION}-noble" >> "$GITHUB_OUTPUT"
70+
echo "Extracted Playwright version: v${PKG_VERSION}-noble"
71+
fi
72+
env:
73+
INPUT_PLAYWRIGHT_VERSION: ${{ inputs.playwright-version }}
74+
WORKING_DIRECTORY: ${{ inputs.working-directory }}
75+
76+
- name: Run Playwright tests
77+
id: playwright
78+
shell: bash
79+
# --ipc=host because Microsoft says so in Playwright docs
80+
# --net=host because testcontainers connects to the Reaper container's exposed port
81+
# we need to pass through the relevant environment variables
82+
# DEBUG configures Node.js debuggers, sets different verbosity as needed
83+
# CI=true is set on every CI nowadays
84+
# PODMAN_SOCK should be mounted to /var/run/docker.sock, other likely mounting locations may not exist (mkdir -p)
85+
# TEST_TARGET is the workbench image the test will run
86+
# --volume(s) let us access docker socket and not clobber host's node_modules
87+
run: |
88+
podman run \
89+
--interactive --rm \
90+
--ipc=host \
91+
--net=host \
92+
--env "CI=true" \
93+
--env "NPM_CONFIG_fund=false" \
94+
--env "DEBUG=testcontainers:*" \
95+
--env "PODMAN_SOCK=/var/run/docker.sock" \
96+
--env "TEST_TARGET" \
97+
--volume "${PODMAN_SOCKET}":/var/run/docker.sock \
98+
--volume "${PWD}":/mnt \
99+
--volume /mnt/node_modules \
100+
"mcr.microsoft.com/playwright:${PLAYWRIGHT_VERSION}" \
101+
/bin/bash <<EOF
102+
set -Eeuxo pipefail
103+
cd /mnt
104+
npm install -g pnpm && pnpm install
105+
pnpm exec playwright test
106+
exit 0
107+
EOF
108+
working-directory: ${{ inputs.working-directory }}
109+
env:
110+
# Only set TEST_TARGET if provided, otherwise playwright.config.ts uses its default
111+
TEST_TARGET: ${{ inputs.test-target || '' }}
112+
PODMAN_SOCKET: ${{ inputs.podman-socket }}
113+
PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.version }}
114+
115+
- name: Upload Playwright report
116+
if: ${{ !cancelled() && inputs.upload-report == 'true' }}
117+
uses: actions/upload-artifact@v6
118+
with:
119+
name: ${{ inputs.artifact-name }}
120+
path: ${{ inputs.working-directory }}/playwright-report/
121+
retention-days: ${{ inputs.artifact-retention-days }}

.github/workflows/build-notebooks-TEMPLATE.yaml

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ jobs:
144144
# for bin/buildinputs in scripts/sandbox.py
145145
- uses: actions/setup-go@v6
146146
with:
147+
go-version: "stable"
147148
cache-dependency-path: "scripts/buildinputs/go.sum"
148149

149150
- run: sudo apt-get update
@@ -436,6 +437,7 @@ jobs:
436437
- uses: actions/setup-go@v6
437438
if: ${{ !cancelled() && steps.make-target.outcome == 'success' }}
438439
with:
440+
go-version-file: "scripts/check-payload/go.mod"
439441
cache-dependency-path: "scripts/check-payload/go.sum"
440442
env:
441443
GOPATH: ${{ steps.check-payload-vars.outputs.GOPATH }}
@@ -487,44 +489,12 @@ jobs:
487489
# not enough to install playwright; running playwright in podman uses the space we have
488490
- name: Run Playwright tests
489491
if: ${{ !cancelled() && contains(inputs.target, 'codeserver') && steps.make-target.outcome == 'success' }}
490-
# --ipc=host because Microsoft says so in Playwright docs
491-
# --net=host because testcontainers connects to the Reaper container's exposed port
492-
# we need to pass through the relevant environment variables
493-
# DEBUG configures Node.js debuggers, sets different verbosity as needed
494-
# CI=true is set on every CI nowadays
495-
# PODMAN_SOCK should be mounted to /var/run/docker.sock, other likely mounting locations may not exist (mkdir -p)
496-
# TEST_TARGET is the workbench image the test will run
497-
# --volume(s) let us access docker socket and not clobber host's node_modules
498-
run: |
499-
podman run \
500-
--interactive --rm \
501-
--ipc=host \
502-
--net=host \
503-
--env "CI=true" \
504-
--env "NPM_CONFIG_fund=false" \
505-
--env "DEBUG=testcontainers:*" \
506-
--env "PODMAN_SOCK=/var/run/docker.sock" \
507-
--env "TEST_TARGET" \
508-
--volume ${PODMAN_SOCK}:/var/run/docker.sock \
509-
--volume ${PWD}:/mnt \
510-
--volume /mnt/node_modules \
511-
mcr.microsoft.com/playwright:v1.53.1-noble \
512-
/bin/bash <<EOF
513-
set -Eeuxo pipefail
514-
cd /mnt
515-
npm install -g pnpm && pnpm install
516-
pnpm exec playwright test
517-
exit 0
518-
EOF
519-
working-directory: tests/browser
520-
env:
521-
TEST_TARGET: "${{ steps.calculated_vars.outputs.OUTPUT_IMAGE }}"
522-
- uses: actions/upload-artifact@v6
523-
if: ${{ !cancelled() && fromJson(inputs.github).event_name == 'pull_request' && contains(inputs.target, 'codeserver') }}
492+
uses: ./.github/actions/playwright-test
524493
with:
525-
name: "${{ inputs.target }}_${{ steps.calculated_vars.outputs.SANITIZED_PLATFORM }}_playwright-report"
526-
path: tests/browser/playwright-report/
527-
retention-days: 30
494+
test-target: ${{ steps.calculated_vars.outputs.OUTPUT_IMAGE }}
495+
podman-socket: /var/run/podman/podman.sock
496+
upload-report: ${{ fromJson(inputs.github).event_name == 'pull_request' }}
497+
artifact-name: "${{ inputs.target }}_${{ steps.calculated_vars.outputs.SANITIZED_PLATFORM }}_playwright-report"
528498

529499
# endregion
530500

.github/workflows/build-notebooks-pr-aipcc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262

6363
- uses: actions/setup-go@v6
6464
with:
65+
go-version: "stable"
6566
cache-dependency-path: "**/*.sum"
6667

6768
- name: Determine targets to build based on changed files

.github/workflows/build-notebooks-pr-rhel.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060

6161
- uses: actions/setup-go@v6
6262
with:
63+
go-version: "stable"
6364
cache-dependency-path: "**/*.sum"
6465

6566
- name: Determine targets to build based on changed files

.github/workflows/build-notebooks-pr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434

3535
- uses: actions/setup-go@v6
3636
with:
37+
go-version: "stable"
3738
cache-dependency-path: "**/*.sum"
3839

3940
- name: Determine targets to build based on changed files

.github/workflows/build-notebooks-push.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838

3939
- uses: actions/setup-go@v6
4040
with:
41+
go-version: "stable"
4142
cache-dependency-path: "**/*.sum"
4243

4344
- name: Determine targets to build (we want to build everything on push)
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
name: Test Playwright Action
3+
"on":
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- '.github/actions/playwright-test/**'
8+
- '.github/workflows/test-playwright-action.yaml'
9+
- 'tests/browser/**'
10+
push:
11+
paths:
12+
- '.github/actions/playwright-test/**'
13+
- '.github/workflows/test-playwright-action.yaml'
14+
- 'tests/browser/**'
15+
16+
jobs:
17+
test-playwright:
18+
name: Test Playwright Browser Tests
19+
runs-on: ubuntu-24.04
20+
env:
21+
# Use rootful podman socket so podman run can find the image pulled with sudo
22+
CONTAINER_HOST: unix:///var/run/podman/podman.sock
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v6
26+
27+
- name: Extract default test image from playwright.config.ts
28+
id: get-image
29+
run: |
30+
# Extract DEFAULT_TEST_IMAGE using grep (the config imports @playwright/test which isn't installed yet)
31+
# Anchor to start of line to avoid matching comments
32+
TEST_IMAGE=$(grep -oP '^export const DEFAULT_TEST_IMAGE\s*=\s*"\K[^"]+' tests/browser/playwright.config.ts)
33+
34+
# Fail if extraction returned empty
35+
if [[ -z "$TEST_IMAGE" ]]; then
36+
echo "::error::Failed to extract DEFAULT_TEST_IMAGE from playwright.config.ts"
37+
exit 1
38+
fi
39+
40+
# Validate image reference against allowed characters (registry/repo:tag@sha256:digest format)
41+
if [[ ! "$TEST_IMAGE" =~ ^[a-zA-Z0-9_./:@-]+$ ]]; then
42+
echo "::error::Invalid image reference contains disallowed characters: $TEST_IMAGE"
43+
exit 1
44+
fi
45+
46+
echo "image=$TEST_IMAGE" >> "$GITHUB_OUTPUT"
47+
echo "Using test image: $TEST_IMAGE"
48+
49+
- name: Install missing dependencies
50+
run: |
51+
# Collect missing packages
52+
PACKAGES=()
53+
if ! command -v podman &> /dev/null; then
54+
PACKAGES+=(podman)
55+
fi
56+
if ! command -v setfacl &> /dev/null; then
57+
PACKAGES+=(acl)
58+
fi
59+
60+
# Install missing packages if any
61+
if [ ${#PACKAGES[@]} -gt 0 ]; then
62+
echo "Installing missing packages: ${PACKAGES[*]}"
63+
sudo apt-get update
64+
sudo apt-get install -y "${PACKAGES[@]}"
65+
fi
66+
67+
- name: Configure Podman
68+
run: |
69+
# Start podman socket for rootful podman
70+
sudo systemctl daemon-reload
71+
sudo systemctl enable --now podman.socket
72+
sudo systemctl status podman.socket
73+
74+
# Grant access to the podman socket for the current user
75+
sudo setfacl -m u:${USER}:x /var/run/podman
76+
sudo setfacl -m u:${USER}:rw /var/run/podman/podman.sock
77+
78+
# Verify socket is accessible
79+
ls -la /var/run/podman/podman.sock
80+
81+
- name: Pull test image
82+
run: |
83+
sudo podman pull "$TEST_IMAGE"
84+
sudo podman images
85+
env:
86+
TEST_IMAGE: ${{ steps.get-image.outputs.image }}
87+
88+
- name: Run Playwright tests
89+
uses: ./.github/actions/playwright-test
90+
with:
91+
test-target: ${{ steps.get-image.outputs.image }}
92+
podman-socket: /var/run/podman/podman.sock
93+
upload-report: 'true'
94+
artifact-name: playwright-action-test-report
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
INDEX_URL=https://console.redhat.com/api/pypi/public-rhai/rhoai/3.4-EA1/cpu-ubi9/simple/
12
BASE_IMAGE=quay.io/opendatahub/odh-base-image-cpu-py312-c9s:latest
23
PYLOCK_FLAVOR=cpu

codeserver/ubi9-python-3.12/get_code_server_rpm.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,42 @@ if [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" || "$ARCH" == "ppc64le" || "$ARCH
7474
while IFS= read -r src_patch; do echo "patches/$src_patch"; patch -p1 < "patches/$src_patch"; done < patches/series
7575
nvm use ${NODE_VERSION}
7676
npm cache clean --force
77+
if [[ "$ARCH" == "ppc64le" || "$ARCH" == "s390x" ]]; then
78+
if [[ -n "${VSCE_SIGN_VERSION:-}" ]]; then
79+
:
80+
else
81+
VSCE_SIGN_VERSION=$(node -e "try { const lock=require('./lib/vscode/build/package-lock.json'); console.log(lock?.packages?.['node_modules/@vscode/vsce-sign']?.version || ''); } catch (e) { console.log(''); }")
82+
fi
83+
if [[ -z "${VSCE_SIGN_VERSION}" || "${VSCE_SIGN_VERSION}" == "undefined" ]]; then
84+
echo "VSCE_SIGN_VERSION is required when @vscode/vsce-sign version cannot be read from lib/vscode/build/package-lock.json" >&2
85+
echo "Set VSCE_SIGN_VERSION to an explicit version (e.g. 2.0.9) to ensure reproducible builds." >&2
86+
exit 1
87+
fi
88+
if [[ ! -f lib/vscode/build/package.json ]]; then
89+
echo "Missing lib/vscode/build/package.json; cannot apply vsce-sign override" >&2
90+
exit 1
91+
fi
92+
VSCE_SIGN_PATCH_DIR=/tmp/vsce-sign-ppc64le
93+
rm -rf "${VSCE_SIGN_PATCH_DIR}"
94+
mkdir -p "${VSCE_SIGN_PATCH_DIR}"
95+
VSCE_SIGN_TARBALL=$(npm pack "@vscode/vsce-sign@${VSCE_SIGN_VERSION}")
96+
tar -xzf "${VSCE_SIGN_TARBALL}" -C "${VSCE_SIGN_PATCH_DIR}" --strip-components=1
97+
rm -f "${VSCE_SIGN_TARBALL}"
98+
mv "${VSCE_SIGN_PATCH_DIR}/src/postinstall.js" "${VSCE_SIGN_PATCH_DIR}/src/postinstall.orig.js"
99+
cat > "${VSCE_SIGN_PATCH_DIR}/src/postinstall.js" <<'EOL'
100+
const platform = process.platform;
101+
const arch = process.arch;
102+
if (platform === 'linux' && (arch === 'ppc64' || arch === 'ppc64le' || arch === 's390x')) {
103+
console.warn(`[vsce-sign] Skipping binary install on unsupported architecture: ${platform}-${arch}`);
104+
process.exit(0);
105+
}
106+
require('./postinstall.orig.js');
107+
EOL
108+
jq --arg override "file:${VSCE_SIGN_PATCH_DIR}" \
109+
'.overrides = (.overrides // {}) | .overrides["@vscode/vsce-sign"] = $override' \
110+
lib/vscode/build/package.json > /tmp/build-package.json \
111+
&& mv /tmp/build-package.json lib/vscode/build/package.json
112+
fi
77113
npm install
78114
npm run build
79115
VERSION=${CODESERVER_VERSION/v/} npm run build:vscode

codeserver/ubi9-python-3.12/pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ requires-python = "==3.12.*"
55

66
dependencies = [
77
# Base packages
8-
"wheel~=0.45.1",
8+
"wheel~=0.46.3",
99
"setuptools~=80.9.0",
1010

1111
"ipykernel~=7.1.0",
1212

1313
# Datascience packages
14-
# TODO(RHAIENG-3041): Upgrade feast to ~=0.59.0 before RHOAI 3.4 GA
15-
"feast~=0.58.0",
14+
"feast~=0.59.0",
1615
# RHAIENG-1475: skl2onnx excluded on s390x for codeserver
1716
"skl2onnx~=1.19.1; platform_machine != 's390x'",
1817
"odh-notebooks-meta-workbench-datascience-deps",
1918

2019
# Some extra useful packages
2120
"opencensus~=0.11.4",
2221
"smart-open~=7.5.0",
23-
"virtualenv~=20.35.3",
24-
"py-spy~=0.4.1; platform_machine != 's390x'",
25-
"prometheus-client~=0.23.1",
22+
"virtualenv~=20.36.1",
23+
# https://issues.redhat.com/browse/AIPCC-9544 py-spy excluded on ppc64le for codeserver
24+
"py-spy~=0.4.1; platform_machine != 's390x' and platform_machine != 'ppc64le'",
25+
"prometheus-client~=0.24.1",
2626
]
2727

2828
[tool.uv]

0 commit comments

Comments
 (0)