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(ISV-5130): add Atlas secrets to e2e tests #1451

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jedinym
Copy link

@jedinym jedinym commented Nov 11, 2024

Description

In ISV-5130, the rh-advisories and rh-push-to-registry-redhat-io pipelines gained the ability to upload component and product-level SBOMs to the Atlas release instance.

The upload of SBOMs requires a new k8s Secret containing the SSO account and token for the stage Atlas release instance. The secret needs to be manually added by @.shebert or @.ralphbean.

This PR makes the e2e test use the new secrets and refactors secret creation to avoid duplicate code. I left the other tests use the old way of creating the secrets but I can refactor those as well if you wish.

Issue ticket number and link

ISV-5130 - Add new pipeline steps in rh-advisories for sbom upload
ISV-5394 - Update rh-advisories pipeline e2e tests

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added meaningful description with JIRA/GitHub issue key(if applicable), for example HASSuiteDescribe("STONE-123456789 devfile source")
  • I have updated labels (if needed)

Copy link

openshift-ci bot commented Nov 11, 2024

Hi @jedinym. Thanks for your PR.

I'm waiting for a konflux-ci member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jedinym jedinym marked this pull request as ready for review November 12, 2024 10:58
@jedinym jedinym changed the title feat(ISV-5130): add Atlas secrets to rh-advisories test feat(ISV-5130): add Atlas secrets to e2e tests Nov 12, 2024
Copy link
Contributor

@johnbieren johnbieren left a comment

Choose a reason for hiding this comment

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

Looks sane to me, @jinqi7 does it look okay to you too?

Copy link

openshift-ci bot commented Nov 12, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: johnbieren
Once this PR has been reviewed and has the lgtm label, please assign flacatus for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@johnbieren johnbieren requested review from a team and removed request for kasemAlem November 12, 2024 13:00
Copy link
Contributor

@jinqi7 jinqi7 left a comment

Choose a reason for hiding this comment

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

There are some lint issues need to be resolved.

// createSecretfromEnv creates a k8s Secret in the managed workspace if it
// doesn't exist. It populates the Secret data fields based on the mapping of
// fields to environment variables containing the base64 encoded field data.
func createSecretFromEnv(
Copy link
Contributor

@jinqi7 jinqi7 Nov 13, 2024

Choose a reason for hiding this comment

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

Thanks for the contribution! This function can be added to releaseLib.go. The function name can be changed to something like "createOpaqueSecret" since it's to create a secret of Opaque type, manageFw can be changed to fw and managedNameSpace to namespace.

@johnbieren
Copy link
Contributor

Looks good to me, will let Jing approve if it looks good to her as well

@johnbieren
Copy link
Contributor

/ok-to-test

ATLAS_STAGE_ACCOUNT_ENV string = "ATLAS_STAGE_ACCOUNT"

// SSO token for accessing the Atlas stage release instance
ATLAS_STAGE_TOKEN_ENV string = "ATLAS_STAGE_TOKEN"

Check failure

Code scanning / Golang security checks by gosec

Potential hardcoded credentials Error

Potential hardcoded credentials
@konflux-ci-qe-bot
Copy link

@johnbieren: The following test has Failed, say /retest to rerun failed tests.

PipelineRun Name Status Rerun command Build Log Test Log
konflux-e2e-6hcj6 Failed /retest View Pipeline Log View Test Logs

Inspecting Test Artifacts

To inspect your test artifacts, follow these steps:

  1. Install ORAS (see the ORAS installation guide).
  2. Download artifacts with the following commands:
mkdir -p oras-artifacts
cd oras-artifacts
oras pull quay.io/konflux-test-storage/konflux-team/e2e-tests:konflux-e2e-6hcj6

@jedinym
Copy link
Author

jedinym commented Nov 13, 2024

@johnbieren still waiting on @.shebert's manual action before the tests can work

Data: secretData,
}

_, err = fw.AsKubeAdmin.CommonController.CreateSecret(
Copy link
Contributor

Choose a reason for hiding this comment

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

There is some indent issue.

secretData[field] = decodedValue
}

secret, err := fw.AsKubeAdmin.CommonController.GetSecret(
Copy link
Contributor

Choose a reason for hiding this comment

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

Here is some indent issue.

@@ -136,4 +140,44 @@ func CheckReleaseStatus(releaseCR *releaseApi.Release) (error) {
return nil
}

// CreateOpaqueSecret creates a k8s Secret in the managed workspace if it
Copy link
Contributor

Choose a reason for hiding this comment

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

The managed workspace can be changed to workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants