generated from redhat-developer/new-project-template
-
Notifications
You must be signed in to change notification settings - Fork 9
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
chore(ci): add nightly e2e windows workflow #154
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
name: Podman Desktop SSO E2E Nightly | ||
|
||
on: | ||
schedule: | ||
- cron: '0 4 * * *' | ||
workflow_dispatch: | ||
inputs: | ||
fork: | ||
default: 'containers' | ||
description: 'Podman Desktop repo fork' | ||
type: string | ||
required: true | ||
branch: | ||
default: 'main' | ||
description: 'Podman Desktop repo branch' | ||
type: string | ||
required: true | ||
ext_repo_options: | ||
default: 'REPO=podman-desktop-redhat-account-ext,FORK=redhat-developer,BRANCH=main' | ||
description: 'Podman Desktop Extension repo, fork and branch' | ||
type: string | ||
required: true | ||
ext_tests: | ||
default: '1' | ||
description: 'Run E2E tests from extension' | ||
type: string | ||
required: true | ||
npm_target: | ||
default: 'test:e2e' | ||
description: 'npm target to run tests' | ||
type: string | ||
required: true | ||
podman_remote_url: | ||
default: 'https://github.com/containers/podman/releases/download/v5.1.1/podman-remote-release-windows_amd64.zip' | ||
description: 'podman remote zip' | ||
type: string | ||
required: true | ||
podman_options: | ||
default: 'INIT=1,START=1,ROOTFUL=1,NETWORKING=0' | ||
description: 'Podman machine configuration options, no spaces' | ||
type: 'string' | ||
required: true | ||
env_vars: | ||
default: 'TEST_PODMAN_MACHINE=true' | ||
description: 'Env. Variables passed into target machine, ie: VAR1=xxx,VAR2=true,VAR3=15,VAR4="Pass me along"' | ||
type: 'string' | ||
required: true | ||
|
||
jobs: | ||
windows: | ||
name: windows-${{ matrix.windows-version }}-${{ matrix.windows-featurepack }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
checks: write | ||
env: | ||
QENVS_VERSION: v0.6.3 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
windows-version: ['10','11'] | ||
windows-featurepack: ['22h2-ent', '23h2-ent'] | ||
exclude: | ||
- windows-version: '10' | ||
windows-featurepack: '23h2-ent' | ||
- windows-version: '11' | ||
windows-featurepack: '22h2-ent' | ||
|
||
|
||
steps: | ||
- name: Get Podman version used by Desktop | ||
run: | | ||
version=$(curl https://raw.githubusercontent.com/containers/podman-desktop/main/extensions/podman/src/podman5.json | jq -r '.version') | ||
echo "Default Podman Version from Podman Desktop: ${version}" | ||
echo "PD_PODMAN_VERSION=${version}" >> $GITHUB_ENV | ||
- name: Set the default env. variables | ||
env: | ||
DEFAULT_FORK: 'containers' | ||
DEFAULT_BRANCH: 'main' | ||
DEFAULT_EXT_TESTS: '1' | ||
DEFAULT_NPM_TARGET: 'test:e2e' | ||
DEFAULT_ENV_VARS: 'TEST_PODMAN_MACHINE=true' | ||
DEFAULT_PODMAN_OPTIONS: 'INIT=1,START=1,ROOTFUL=1,NETWORKING=0' | ||
DEFAULT_EXT_REPO_OPTIONS: 'REPO=podman-desktop-redhat-account-ext,FORK=redhat-developer,BRANCH=main' | ||
DEFAULT_VERSION: "${{ env.PD_PODMAN_VERSION || '5.1.1' }}" | ||
DEFAULT_URL: "https://github.com/containers/podman/releases/download/v$DEFAULT_VERSION/podman-remote-release-windows_amd64.zip" | ||
run: | | ||
echo "FORK=${{ github.event.inputs.fork || env.DEFAULT_FORK }}" >> $GITHUB_ENV | ||
echo "BRANCH=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV | ||
echo "NPM_TARGET=${{ github.event.inputs.npm_target || env.DEFAULT_NPM_TARGET }}" >> $GITHUB_ENV | ||
echo "ENV_VARS=${{ github.event.inputs.env_vars || env.DEFAULT_ENV_VARS }}" >> $GITHUB_ENV | ||
echo "PODMAN_URL=${{ github.event.inputs.podman_remote_url || env.DEFAULT_URL }}" >> $GITHUB_ENV | ||
echo "EXT_TESTS=${{ github.event.inputs.ext_tests || env.DEFAULT_EXT_TESTS }}" >> $GITHUB_ENV | ||
echo "${{ github.event.inputs.podman_options || env.DEFAULT_PODMAN_OPTIONS }}" | awk -F ',' \ | ||
'{for (i=1; i<=NF; i++) {split($i, kv, "="); print "PODMAN_"kv[1]"="kv[2]}}' >> $GITHUB_ENV | ||
echo "${{ github.event.inputs.ext_repo_options || env.DEFAULT_EXT_REPO_OPTIONS }}" | awk -F ',' \ | ||
'{for (i=1; i<=NF; i++) {split($i, kv, "="); print "EXT_"kv[1]"="kv[2]}}' >> $GITHUB_ENV | ||
|
||
- name: Create instance | ||
run: | | ||
# Create instance | ||
podman run -d --name windows-create --rm \ | ||
-v ${PWD}:/workspace:z \ | ||
-e ARM_TENANT_ID=${{ secrets.ARM_TENANT_ID }} \ | ||
-e ARM_SUBSCRIPTION_ID=${{ secrets.ARM_SUBSCRIPTION_ID }} \ | ||
-e ARM_CLIENT_ID=${{ secrets.ARM_CLIENT_ID }} \ | ||
-e ARM_CLIENT_SECRET='${{ secrets.ARM_CLIENT_SECRET }}' \ | ||
quay.io/rhqp/qenvs:${{ env.QENVS_VERSION }} azure \ | ||
windows create \ | ||
--project-name 'windows-desktop' \ | ||
--backed-url 'file:///workspace' \ | ||
--conn-details-output '/workspace' \ | ||
--windows-version '${{ matrix.windows-version }}' \ | ||
--windows-featurepack '${{ matrix.windows-featurepack }}' \ | ||
--vmsize 'Standard_D8s_v4' \ | ||
--tags project=podman-desktop \ | ||
--spot | ||
# Check logs | ||
podman logs -f windows-create | ||
|
||
- name: Check instance system info | ||
run: | | ||
ssh -i id_rsa \ | ||
-o StrictHostKeyChecking=no \ | ||
-o UserKnownHostsFile=/dev/null \ | ||
-o ServerAliveInterval=30 \ | ||
-o ServerAliveCountMax=1200 \ | ||
$(cat username)@$(cat host) "systeminfo" | ||
|
||
- name: Emulate X session | ||
run: | | ||
# use fake rdp to emulate an active x session | ||
podman run -d --name x-session \ | ||
-e RDP_HOST=$(cat host) \ | ||
-e RDP_USER=$(cat username) \ | ||
-e RDP_PASSWORD=$(cat userpassword) \ | ||
quay.io/rhqp/frdp:v0.0.1 | ||
# Wait until the x session has been created | ||
podman wait --condition running x-session | ||
# Check logs for the x session | ||
podman logs x-session | ||
|
||
- name: Download Podman, do not initialize | ||
run: | | ||
podman run --rm -d --name pde2e-podman-run \ | ||
-e TARGET_HOST=$(cat host) \ | ||
-e TARGET_HOST_USERNAME=$(cat username) \ | ||
-e TARGET_HOST_KEY_PATH=/data/id_rsa \ | ||
-e TARGET_FOLDER=pd-e2e \ | ||
-e TARGET_RESULTS=results \ | ||
-e OUTPUT_FOLDER=/data \ | ||
-e DEBUG=true \ | ||
-v $PWD:/data:z \ | ||
quay.io/odockal/pde2e-podman:v0.0.1-windows \ | ||
pd-e2e/podman.ps1 \ | ||
-downloadUrl ${{ env.PODMAN_URL }} \ | ||
-targetFolder pd-e2e \ | ||
-resultsFolder results \ | ||
-initialize 0 \ | ||
-rootful 0 \ | ||
-start 0 \ | ||
-installWSL 0 | ||
# check logs | ||
podman logs -f pde2e-podman-run | ||
|
||
- name: Run Podman Desktop Playwright E2E tests | ||
run: | | ||
podman run -d --name pde2e-runner-run \ | ||
-e TARGET_HOST=$(cat host) \ | ||
-e TARGET_HOST_USERNAME=$(cat username) \ | ||
-e TARGET_HOST_KEY_PATH=/data/id_rsa \ | ||
-e TARGET_FOLDER=pd-e2e \ | ||
-e TARGET_RESULTS=results \ | ||
-e TARGET_CLEANUP=false \ | ||
-e OUTPUT_FOLDER=/data \ | ||
-e DEBUG=true \ | ||
-v $PWD:/data:z \ | ||
quay.io/odockal/pde2e-runner:v0.0.1-windows \ | ||
pd-e2e/runner.ps1 \ | ||
-targetFolder pd-e2e \ | ||
-resultsFolder results \ | ||
-podmanPath $(cat results/podman-location.log) \ | ||
-fork ${{ env.FORK }} \ | ||
-branch ${{ env.BRANCH }} \ | ||
-extRepo ${{ env.EXT_REPO }} \ | ||
-extFork ${{ env.EXT_FORK }} \ | ||
-extBranch ${{ env.EXT_BRANCH }} \ | ||
-extTests ${{ env.EXT_TESTS }} \ | ||
-npmTarget ${{ env.NPM_TARGET }} \ | ||
-initialize ${{ env.PODMAN_INIT }} \ | ||
-rootful ${{ env.PODMAN_ROOTFUL }} \ | ||
-start ${{ env.PODMAN_START }} \ | ||
-userNetworking ${{ env.PODMAN_NETWORKING }} \ | ||
-envVars ${{ env.ENV_VARS }} | ||
# check logs | ||
podman logs -f pde2e-runner-run | ||
|
||
- name: Destroy instance | ||
if: always() | ||
run: | | ||
# Destroy instance | ||
podman run -d --name windows-destroy --rm \ | ||
-v ${PWD}:/workspace:z \ | ||
-e ARM_TENANT_ID=${{ secrets.ARM_TENANT_ID }} \ | ||
-e ARM_SUBSCRIPTION_ID=${{ secrets.ARM_SUBSCRIPTION_ID }} \ | ||
-e ARM_CLIENT_ID=${{ secrets.ARM_CLIENT_ID }} \ | ||
-e ARM_CLIENT_SECRET='${{ secrets.ARM_CLIENT_SECRET }}' \ | ||
quay.io/rhqp/qenvs:${{ env.QENVS_VERSION }} azure \ | ||
windows destroy \ | ||
--project-name 'windows-desktop' \ | ||
--backed-url 'file:///workspace' | ||
# Check logs | ||
podman logs -f windows-destroy | ||
|
||
- name: Publish Test Report | ||
uses: mikepenz/action-junit-report@v4 | ||
if: always() # always run even if the previous step fails | ||
with: | ||
fail_on_failure: true | ||
include_passed: true | ||
detailed_summary: true | ||
require_tests: true | ||
report_paths: '**/*results.xml' | ||
|
||
- name: Upload test artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: results-e2e-${{ matrix.windows-version }}${{ matrix.windows-featurepack }} | ||
path: | | ||
results/* |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
seems there is a duplication with the following input
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.
I am not sure I can define some constant across the yaml file here. these params are default for a workflow_dispatch run which is "on demand" when user inserts the values. The second batch of params bit below is dedicated for a workflow to be run on nightly base, when inputs are not considered.
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.
No but you can transcript them as env variables thus preventing the duplication
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.
I do not think it is possible. The input context is not available to the workflow run that was triggered by on-schedule event and vice versa.
So the way I am doing it here, is that I define env. var. with default value that is used when run on nightly or taken from input when run on demand. Snippet:
So the last line is the core I guess, depending on what context is available to the workflow run, we got this:
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.
Only what come to me, is that I could probably improve the workflow to have less lines by using env. on workflow level:
Which would eliminate the number of the lines, but not the duplication.
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.
The duplication I'm mentioning is that the input of the workflow defines both the podman version and the podman URL and I think the last one can be computed from the first one so there is no need for the 2
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.
Ah, ok. I have created an issue to tackle this: podman-desktop/e2e#194. Although, it cannot be simply computed from url here, you can pass url with version as seen in the PR, or also url without any info about the version which contain an archive with either
5.1.1
or ie.5.2.0-dev
. So the best would be to integrate the version handling in the image itself and then remove version parameter from the workflows.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.
@jeffmaury So now I have removed the input param for version, it is now counted from extracted archive inside the image's scripts.