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

feat: Enable skip of CI deployment tests #4203

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

ReneHezser
Copy link
Contributor

@ReneHezser ReneHezser commented Jan 17, 2025

Description

Allow testcases to be excluded from deplyoments by the CI deployment.

Azure/Azure-Verified-Modules#1796

Pipeline Reference

Pipeline
avm.ptn.deployment-script.import-image-to-acr

Type of Change

  • Update to CI Environment or utilities (Non-module affecting changes)
  • Azure Verified Module updates:
    • Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in version.json:
      • Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description.
      • The bug was found by the module author, and no one has opened an issue to report it yet.
    • Feature update backwards compatible feature updates, and I have bumped the MINOR version in version.json.
    • Breaking changes and I have bumped the MAJOR version in version.json.
    • Update to documentation

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • I have run Set-AVMModule locally to generate the supporting module files.
  • My corresponding pipelines / checks run clean and green without any errors or warnings

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue labels Jan 17, 2025
@ReneHezser ReneHezser added Type: CI 🚀 This issue is related to the AVM CI github_actions Pull requests that update GitHub Actions code and removed Needs: Triage 🔍 Maintainers need to triage still labels Jan 17, 2025
@@ -213,7 +213,39 @@ runs:

# [Deployment validation] task(s)
# -------------------------------
- name: "Validate Test Execution"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we could skip the whole job instead of singular steps

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case what about using the job title to provide that info, e.g. to add a skipped- prefix to the module test folder so that it gets rendered in the UI
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 :-(

@@ -180,3 +180,4 @@
/avm/res/web/static-site/ @Azure/avm-res-web-staticsite-module-owners-bicep @Azure/avm-module-reviewers-bicep
/avm/utl/types/avm-common-types/ @Azure/avm-utl-types-avmcommontypes-module-owners-bicep @Azure/avm-module-reviewers-bicep
*avm.core.team.tests.ps1 @Azure/avm-core-team-technical-bicep
*.e2eignore @Azure/avm-core-team-technical-bicep
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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.

  • Static validation: we introduced 2 pester tests so we need:
    • module run with no test skipped --> should pass
    • module run where deployment tests are skipped as intended--> should pass
    • module run with one test skipped incorrectly (.e2eignore added in defaults or waf-aligned test) --> should fail pester test 1
    • module run with one test skipped incorrectly (.e2eignore is empty) --> should fail pester test 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue Type: CI 🚀 This issue is related to the AVM CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants