-
Notifications
You must be signed in to change notification settings - Fork 2
Add UI test workflow for Renovate dependency-update PRs #179
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
base: main
Are you sure you want to change the base?
Changes from all commits
6ba1f81
4fa716d
ce57756
dc09b6f
e955538
e3391e9
89840a1
42b7900
bccb1d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: Test UI on Renovate PRs | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| debug_shell: | ||
| description: "Debug shell" | ||
| required: true | ||
| type: boolean | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "ui/**" | ||
andre8244 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - "build-images.sh" | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| check-author: | ||
| runs-on: ubuntu-latest | ||
| permissions: {} | ||
| outputs: | ||
| is_renovate: ${{ steps.check.outputs.is_renovate }} | ||
| steps: | ||
| - id: check | ||
| env: | ||
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | ||
| run: | | ||
| # On workflow_dispatch, PR_AUTHOR is empty — allow the run. | ||
| # On pull_request, only allow renovate[bot]. | ||
| if [[ -z "$PR_AUTHOR" || "$PR_AUTHOR" == "renovate[bot]" ]]; then | ||
| echo "is_renovate=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "is_renovate=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| publish-images: | ||
| needs: check-author | ||
| if: needs.check-author.outputs.is_renovate == 'true' | ||
| uses: NethServer/ns8-github-actions/.github/workflows/publish-branch.yml@v1 | ||
| permissions: | ||
| packages: write | ||
| actions: read | ||
| contents: write | ||
|
|
||
| module: | ||
| needs: publish-images | ||
| permissions: {} | ||
| uses: NethServer/ns8-github-actions/.github/workflows/module-info.yml@v1 | ||
|
|
||
| chooser: | ||
| needs: check-author | ||
| if: needs.check-author.outputs.is_renovate == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: {} | ||
| outputs: | ||
| node_a: ${{ steps.pick.outputs.node_a }} | ||
| node_b: ${{ steps.pick.outputs.node_b }} | ||
| steps: | ||
| - id: pick | ||
| run: | | ||
| if (( $GITHUB_RUN_NUMBER % 2 )); then | ||
| echo "node_a=rl1" >> "$GITHUB_OUTPUT" | ||
| echo "node_b=dn1" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "node_a=dn1" >> "$GITHUB_OUTPUT" | ||
| echo "node_b=rl1" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| run_ui_tests: | ||
| needs: [module, chooser] | ||
| permissions: {} | ||
| timeout-minutes: 30 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| scenario: [install, update] | ||
| uses: NethServer/ns8-github-actions/.github/workflows/test-on-digitalocean-infra.yml@v1 | ||
| with: | ||
| script: test-ui.sh | ||
| path: ui | ||
| coremodules: ${{ matrix.scenario == 'install' && format('ghcr.io/{0}/{1}:{2}', needs.module.outputs.owner, needs.module.outputs.name, needs.module.outputs.tag) || '' }} | ||
| leader_nodes: >- | ||
| ${{ | ||
| matrix.scenario == 'install' | ||
| && needs.chooser.outputs.node_a | ||
| || needs.chooser.outputs.node_b | ||
| }} | ||
| args: ${{ format('ghcr.io/{0}/{1}:{2} -v SCENARIO:{3}', needs.module.outputs.owner, needs.module.outputs.name, needs.module.outputs.tag, matrix.scenario) }} | ||
| repo_ref: ${{needs.module.outputs.sha}} | ||
| debug_shell: ${{ github.event.inputs.debug_shell == 'true' || false }} | ||
| secrets: | ||
| do_token: ${{ secrets.do_token }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,3 +21,6 @@ pnpm-debug.log* | |
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
|
|
||
| # tests outputs | ||
| tests/outputs | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,42 @@ | ||||||||
| #!/bin/bash | ||||||||
|
|
||||||||
| # | ||||||||
| # Copyright (C) 2026 Nethesis S.r.l. | ||||||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||||||
| # | ||||||||
|
|
||||||||
| set -e | ||||||||
|
|
||||||||
| SSH_KEYFILE=${SSH_KEYFILE:-$HOME/.ssh/id_rsa} | ||||||||
|
|
||||||||
| LEADER_NODE="${1:?missing LEADER_NODE argument}" | ||||||||
| IMAGE_URL="${2:?missing IMAGE_URL argument}" | ||||||||
|
|
||||||||
| ssh_key="$(< $SSH_KEYFILE)" | ||||||||
andre8244 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| cleanup() { | ||||||||
| set +e | ||||||||
| podman cp rf-core-runner:/home/pwuser/outputs tests/ | ||||||||
| podman stop rf-core-runner | ||||||||
| podman rm rf-core-runner | ||||||||
| } | ||||||||
|
|
||||||||
| trap cleanup EXIT | ||||||||
|
|
||||||||
| podman run -i \ | ||||||||
| --network=host \ | ||||||||
| --volume=.:/home/pwuser/ns8-module:z \ | ||||||||
|
||||||||
| --volume=.:/home/pwuser/ns8-module:z \ | |
| --volume=.:/home/pwuser/ns8-module:z \ | |
| --volume=./.pip-cache:/home/pwuser/.cache/pip:z \ |
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script runs a third-party container image ghcr.io/marketsquare/robotframework-browser/rfbrowser-stable:19.11.0 with --network=host and passes in the private SSH key contents via ssh_key, giving that image direct access to secrets and your test infrastructure. Because the image is pinned only by a mutable tag and comes from an external organization, a compromised or hijacked image could exfiltrate the SSH key or tamper with tests without any integrity check. Pin this image to an immutable digest (and/or vendor it under your own namespace) and restrict secrets exposure so that only trusted, first-party images ever see private keys.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| robotframework | ||
| robotframework-sshlibrary | ||
| robotframework-browser | ||
|
Comment on lines
+1
to
+3
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||
| *** Settings *** | ||||||
| Library SSHLibrary | ||||||
| Library Browser | ||||||
| Suite Setup Connect to the node | ||||||
|
|
||||||
| *** Variables *** | ||||||
| ${SSH_KEYFILE} %{HOME}/.ssh/id_ecdsa | ||||||
|
||||||
| ${SSH_KEYFILE} %{HOME}/.ssh/id_ecdsa | |
| ${SSH_KEYFILE} %{HOME}/.ssh/id_rsa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workflow must run on renovate branches. IIRC this is the branch prefix:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should put the name of the base branch, i.e. the branch we are merging into