-
Notifications
You must be signed in to change notification settings - Fork 409
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
feat: Enable skip of CI deployment tests #4203
base: main
Are you sure you want to change the base?
Changes from 7 commits
475bfce
3c848bd
219f6ff
17e6b6d
5aec7c1
8a79bc3
c1171ec
8e4dc0d
c382179
b28e053
c362c71
f547f3c
870bc34
e88659b
8f47a3d
1ab729c
01a1201
eb492e3
47e9282
9e5b97c
1630bcb
6f08745
d5e9e2e
73e22f7
57bbbe0
a6df0eb
e5898d3
77ffdb1
cf3de24
f85f137
4ff05fb
d3d77e5
a0dc290
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 |
---|---|---|
|
@@ -213,7 +213,39 @@ runs: | |
|
||
# [Deployment validation] task(s) | ||
# ------------------------------- | ||
- name: "Validate Test Execution" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wondering if we could skip the whole job instead of singular steps There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, we can't. I moved the ignore check to the top of the steps, so it will "stop" earlier. Skipping a matrix job is not possible. We could implement another job before this one, to modify the tests-list input in order to only execute the non-skipped tests. But with that, the test would vanish completely from the list. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not possible, unfortunately. The skipping condition is only available in a step within the job. Not before :-( |
||
uses: azure/powershell@v2 | ||
with: | ||
azPSVersion: "latest" | ||
inlineScript: | | ||
# the first step is to check, if the deployment should be bypassed | ||
|
||
# Resolve template file path | ||
$moduleTestFilePath = Join-Path $env:GITHUB_WORKSPACE '${{ inputs.templateFilePath }}' | ||
|
||
# Determine if $moduleTestFilePath is a directory or a file | ||
if (Test-Path $moduleTestFilePath -PathType Container) { | ||
$moduleTestFolderPath = $moduleTestFilePath | ||
} else { | ||
$moduleTestFolderPath = Split-Path $moduleTestFilePath | ||
} | ||
|
||
# Check if the deployment test should be bypassed | ||
$passCiFilePath = Join-Path $moduleTestFolderPath '.e2eignore' | ||
if (Test-Path $passCiFilePath) { | ||
Write-Warning -Message "File '.e2eignore' exists in the folder: $moduleTestFolderPath" | ||
$excludeReason = Get-Content $passCiFilePath | ||
if ($excludeReason -ne $null) { | ||
Write-Warning -Message "Reason for exclusion: $excludeReason" | ||
} | ||
Write-Output "skip_deployment_ci=true" >> $env:GITHUB_ENV | ||
} else { | ||
Write-Output "File '.e2eignore' does not exist in the folder: $moduleTestFolderPath" -Verbose | ||
Write-Output "skip_deployment_ci=false" >> $env:GITHUB_ENV | ||
} | ||
|
||
- name: "Validate template file" | ||
if: env.skip_deployment_ci == 'false' | ||
uses: azure/powershell@v2 | ||
with: | ||
azPSVersion: "latest" | ||
|
@@ -293,6 +325,7 @@ runs: | |
# [Deployment execution] task(s) | ||
# ------------------------------ | ||
- name: "Deploy template file" | ||
if: env.skip_deployment_ci == 'false' | ||
id: deploy_step | ||
uses: azure/powershell@v2 | ||
with: | ||
|
@@ -387,6 +420,7 @@ runs: | |
# [Post-Deployment test] task(s) | ||
# ------------------------------ | ||
- name: "Run post-deployment Pester tests" | ||
if: env.skip_deployment_ci == 'false' | ||
id: pester_run_step | ||
shell: pwsh | ||
run: | | ||
|
@@ -457,7 +491,7 @@ runs: | |
} | ||
|
||
- name: "Output to GitHub job summaries" | ||
if: steps.pester_run_step.outputs.formattedPesterResultsPath != '' | ||
if: env.skip_deployment_ci == 'false' && steps.pester_run_step.outputs.formattedPesterResultsPath != '' | ||
shell: pwsh | ||
run: | | ||
# Grouping task logs | ||
|
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.
Looking forward to discussing, great work meanwhile!
The main suggestion I'd have for now is to add tests. At least one pipeline run with one deployment test skipped and one base case pipeline with no test skipped
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.
Thanks @eriqua.
I am not sure I understand your remark. You mean we should have a failed test before the test can be excluded?
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.
Hi @ReneHezser exactly, suggested full test coverage for CI updates before they are introduced.