-
Notifications
You must be signed in to change notification settings - Fork 133
test(RELEASE-2325): add idempotent retrigger e2e test for rh-advisories #2170
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,95 @@ | ||
| # rh-advisories-idempotent test | ||
|
|
||
| ## Overview | ||
|
|
||
| This test validates idempotent re-release behavior for the `rh-advisories` pipeline: | ||
|
|
||
| 1. **First release**: all tasks run, advisory created (`skip_release=false`) | ||
| 2. **Second release** (same snapshot): `filter-already-released-advisory-images` detects the | ||
| existing advisory in Pyxis → `skip_release=true` | ||
| 3. All downstream tasks are skipped; release CR still reaches `Released=True` | ||
| 4. `advisory.url` is present in second release status (populated from filter result, | ||
| not from `create-advisory`) | ||
|
|
||
| ## Setup | ||
|
|
||
| ### Dependencies | ||
| * GitHub repo: https://github.com/hacbs-release-tests/e2e-base | ||
| * GitHub personal access token (classic) for above repo with **admin:repo_hook**, | ||
| **delete_repo**, **repo** scopes. | ||
| * The password to the vault files. (Contact a member of the Release team should you | ||
| want to run this test suite.) | ||
| * Access to the target cluster and tenant and managed namespaces | ||
| * **Cluster:** stg-rh01 (staging cluster) | ||
| * **Tenant Namespace:** `dev-release-team-tenant` (local) or `rhtap-release-2-tenant` (PaC) | ||
| * **Managed Namespace:** `managed-release-team-tenant` | ||
|
|
||
| ### Required Environment Variables | ||
| - `GITHUB_TOKEN` - GitHub personal access token | ||
| - `VAULT_PASSWORD_FILE` - Path to file containing ansible vault password | ||
| - `RELEASE_CATALOG_GIT_URL` - Release service catalog URL for the RPA | ||
| - `RELEASE_CATALOG_GIT_REVISION` - Release service catalog revision for the RPA | ||
|
|
||
| ### Optional Environment Variables | ||
| - `KUBECONFIG` - Kubeconfig file for cluster access | ||
| - `LARGE_SNAPSHOT_COMPONENT_COUNT` - Number of components in snapshot (default: 1) | ||
| - `LARGE_SNAPSHOT_TIMEOUT` - Pipeline timeout (default: 2h0m0s) | ||
|
|
||
| ### Test Properties | ||
| #### [test.env](test.env) | ||
| - Contains resource names and configuration values for testing. | ||
| - Uses a single-component pre-built snapshot to minimize first release duration. | ||
|
|
||
| #### [test.sh](test.sh) | ||
| - Overrides standard build functions to skip builds and use pre-built images. | ||
| - Implements the two-phase idempotent test: first release then second release. | ||
| - Verifies all acceptance criteria post second release. | ||
|
|
||
| ### Test Functions | ||
| #### [lib/test-functions.sh](../lib/test-functions.sh) | ||
| - Reusable functions for tests. | ||
|
|
||
| ### Secrets | ||
| - Secrets are stored in ansible vault files (symlinked from `rh-advisories-large-snapshot`): | ||
| - [vault/managed-secrets.yaml](vault/managed-secrets.yaml) | ||
| - [vault/tenant-secrets.yaml](vault/tenant-secrets.yaml) | ||
|
|
||
| ## Acceptance Criteria | ||
|
|
||
| - Second release: all major tasks (`create-advisory`, `push-snapshot`, `verify-conforma`, | ||
| `rh-sign-image`, etc.) appear in `skippedTasks` | ||
| - `advisory.url` present in second release `status.artifacts` (written by | ||
| `update-cr-status-skipped` from filter result, not `create-advisory`) | ||
|
|
||
| ## Running the test | ||
|
|
||
| For local testing: | ||
|
|
||
| ```shell | ||
| ../run-test.sh rh-advisories-idempotent | ||
| ``` | ||
|
|
||
| **Note:** This test runs two full releases sequentially. The first release takes | ||
| approximately 1-2 hours in staging; the second release completes quickly once the | ||
| filter detects the existing advisory. | ||
|
|
||
| ### Debugging | ||
|
|
||
| Use `--skip-cleanup` to preserve resources after the test: | ||
|
|
||
| ```shell | ||
| ../run-test.sh rh-advisories-idempotent --skip-cleanup | ||
| ``` | ||
|
|
||
| ### Maintenance | ||
|
|
||
| To update secrets: | ||
|
|
||
| ```shell | ||
| ansible-vault decrypt vault/tenant-secrets.yaml --output "/tmp/tenant-secrets.yaml" \ | ||
| --vault-password-file <vault password file> | ||
| vi /tmp/tenant-secrets.yaml | ||
| ansible-vault encrypt /tmp/tenant-secrets.yaml --output "vault/tenant-secrets.yaml" \ | ||
| --vault-password-file <vault password file> | ||
| rm /tmp/tenant-secrets.yaml | ||
| ``` |
1 change: 1 addition & 0 deletions
1
integration-tests/rh-advisories-idempotent/resources/managed/ec-policy.yaml
This file contains hidden or 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 @@ | ||
| ../../../collectors/resources/managed/ec-policy.yaml |
11 changes: 11 additions & 0 deletions
11
integration-tests/rh-advisories-idempotent/resources/managed/kustomization.yaml
This file contains hidden or 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,11 @@ | ||
| --- | ||
| kind: Kustomization | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
|
|
||
| namespace: ${managed_namespace} | ||
| resources: | ||
| - sa.yaml | ||
| - sa-rolebinding.yaml | ||
| - rpa.yaml | ||
| - ec-policy.yaml | ||
| - secrets/managed-secrets.yaml |
57 changes: 57 additions & 0 deletions
57
integration-tests/rh-advisories-idempotent/resources/managed/rpa.yaml
This file contains hidden or 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,57 @@ | ||
| --- | ||
| apiVersion: appstudio.redhat.com/v1alpha1 | ||
| kind: ReleasePlanAdmission | ||
| metadata: | ||
| name: ${release_plan_admission_name} | ||
| labels: | ||
| originating-tool: "${originating_tool}" | ||
| spec: | ||
| applications: | ||
| - ${application_name} | ||
| data: | ||
| jira: | ||
| jiraAdvisorySecret: advisory-jira-secret-${component_name} | ||
| cgw: | ||
| cgwSecret: publish-to-cgw-secret-${component_name} | ||
| atlas: | ||
| server: stage | ||
| atlas-sso-secret-name: atlas-staging-sso-secret-${component_name} | ||
| atlas-retry-aws-secret-name: atlas-retry-s3-staging-secret-${component_name} | ||
| pyxis: | ||
| server: stage | ||
| secret: pyxis-${component_name} | ||
| sign: | ||
| configMapName: "hacbs-signing-pipeline-config-staging-e2e-pq" | ||
| cosignSecretName: "konflux-cosign-signing-stage-${component_name}" | ||
| mapping: | ||
| defaults: | ||
| tags: | ||
| - latest | ||
| pushSourceContainer: true | ||
| components: | ||
| - name: ${component_name} | ||
| repositories: | ||
| - url: quay.io/redhat-pending/rhtap----rh-advisories-component | ||
| releaseNotes: | ||
| product_id: | ||
| - 999 | ||
| product_name: Red Hat Comp2 | ||
| product_version: '1.0.1' | ||
| cpe: 'cpe:/a:redhat:comp2:1::appstream' | ||
| product_stream: comp2-1.0 | ||
| origin: ${tenant_namespace} | ||
| pipeline: | ||
| pipelineRef: | ||
| params: | ||
| - name: url | ||
| value: "${RELEASE_CATALOG_GIT_URL}" | ||
| - name: revision | ||
| value: "${RELEASE_CATALOG_GIT_REVISION}" | ||
| - name: pathInRepo | ||
| value: pipelines/managed/rh-advisories/rh-advisories.yaml | ||
| resolver: git | ||
| serviceAccountName: ${managed_sa_name} | ||
| timeouts: | ||
| pipeline: 4h0m0s | ||
| tasks: 4h0m0s | ||
| policy: standard-${component_name} |
1 change: 1 addition & 0 deletions
1
integration-tests/rh-advisories-idempotent/resources/managed/sa-rolebinding.yaml
This file contains hidden or 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 @@ | ||
| ../../../collectors/resources/managed/sa-rolebinding.yaml |
1 change: 1 addition & 0 deletions
1
integration-tests/rh-advisories-idempotent/resources/managed/sa.yaml
This file contains hidden or 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 @@ | ||
| ../../../collectors/resources/managed/sa.yaml |
1 change: 1 addition & 0 deletions
1
integration-tests/rh-advisories-idempotent/resources/tenant/application.yaml
|
mmalina marked this conversation as resolved.
|
This file contains hidden or 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 @@ | ||
| ../../../collectors/resources/tenant/application.yaml |
1 change: 1 addition & 0 deletions
1
integration-tests/rh-advisories-idempotent/resources/tenant/component.yaml
This file contains hidden or 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 @@ | ||
| ../../../collectors/resources/tenant/component.yaml |
12 changes: 12 additions & 0 deletions
12
integration-tests/rh-advisories-idempotent/resources/tenant/kustomization.yaml
This file contains hidden or 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,12 @@ | ||
| --- | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| namespace: ${tenant_namespace} | ||
| resources: | ||
| - application.yaml | ||
| - component.yaml | ||
| - sa.yaml | ||
| - sa-rolebinding.yaml | ||
| - rp.yaml | ||
| - secrets/tenant-secrets.yaml |
1 change: 1 addition & 0 deletions
1
integration-tests/rh-advisories-idempotent/resources/tenant/rp.yaml
This file contains hidden or 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 @@ | ||
| ../../../collectors/resources/tenant/rp.yaml |
1 change: 1 addition & 0 deletions
1
integration-tests/rh-advisories-idempotent/resources/tenant/sa-rolebinding.yaml
This file contains hidden or 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 @@ | ||
| ../../../collectors/resources/tenant/sa-rolebinding.yaml |
1 change: 1 addition & 0 deletions
1
integration-tests/rh-advisories-idempotent/resources/tenant/sa.yaml
This file contains hidden or 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 @@ | ||
| ../../../collectors/resources/tenant/sa.yaml |
This file contains hidden or 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,33 @@ | ||
| uuid=${uuid:-"$(openssl rand -hex 4)"} | ||
| # make sure uuid is 8 chars long | ||
| uuid="${uuid:0:8}" | ||
|
|
||
| export originating_tool="rh-advisories-idempotent-test" | ||
|
|
||
| # Namespaces | ||
| export tenant_namespace=dev-release-team-tenant | ||
| # | ||
| ## Since this is a test that requires internal services, | ||
| ## this name should not change. | ||
| # | ||
| export managed_namespace=managed-release-team-tenant | ||
|
|
||
| export application_name=rh-adv-idem-app-${uuid} | ||
| export component_type=rh-adv-idem | ||
| export component_name=${component_type}-${uuid} | ||
| export component_branch=${component_name} | ||
| ## do not change this. it is a known branch created by Konflux | ||
| export appstudio_component_branch="appstudio-${component_name}" | ||
|
|
||
| export component_github_org=hacbs-release-tests | ||
| export component_base_branch=collectors-base | ||
| export component_repo_name=${component_github_org}/${component_name} | ||
| export component_base_repo_name=${component_github_org}/e2e-base | ||
| export component_git_url=https://github.com/$component_repo_name | ||
|
|
||
| export tenant_collector_sa_name=${component_type}-collector-sa-${uuid} | ||
| export tenant_sa_name=${component_type}-tenant-sa-${uuid} | ||
| export release_plan_name=${component_type}-rp-${uuid} | ||
|
|
||
| export managed_sa_name=${component_type}-sa-${uuid} | ||
| export release_plan_admission_name=${component_type}-rpa-${uuid} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.