Skip to content

Commit

Permalink
feat(ISV-5130): add atlas secrets to registry push test
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Jediny <[email protected]>
  • Loading branch information
jedinym committed Nov 12, 2024
1 parent d4eb570 commit 34e70b9
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions tests/release/pipelines/rh_push_to_redhat_io.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var rhioComponentName = "rhio-comp-" + util.GenerateRandomString(4)

var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for rh-push-to-redhat-io pipeline", Pending, Label("release-pipelines", "rh-push-to-redhat-io"), func() {
defer GinkgoRecover()
var pyxisKeyDecoded, pyxisCertDecoded []byte

var devWorkspace = utils.GetEnv(constants.RELEASE_DEV_WORKSPACE_ENV, constants.DevReleaseTeam)
var managedWorkspace = utils.GetEnv(constants.RELEASE_MANAGED_WORKSPACE_ENV, constants.ManagedReleaseTeam)
Expand Down Expand Up @@ -70,36 +69,17 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for rh-push-to-redhat
managedFw = releasecommon.NewFramework(managedWorkspace)
managedNamespace = managedFw.UserNamespace

keyPyxisStage := os.Getenv(constants.PYXIS_STAGE_KEY_ENV)
Expect(keyPyxisStage).ToNot(BeEmpty())

certPyxisStage := os.Getenv(constants.PYXIS_STAGE_CERT_ENV)
Expect(certPyxisStage).ToNot(BeEmpty())

// Creating k8s secret to access Pyxis stage based on base64 decoded of key and cert
pyxisKeyDecoded, err = base64.StdEncoding.DecodeString(string(keyPyxisStage))
Expect(err).ToNot(HaveOccurred())

pyxisCertDecoded, err = base64.StdEncoding.DecodeString(string(certPyxisStage))
Expect(err).ToNot(HaveOccurred())

pyxisSecret, err := managedFw.AsKubeAdmin.CommonController.GetSecret(managedNamespace, "pyxis")
if pyxisSecret == nil || errors.IsNotFound(err) {
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "pyxis",
Namespace: managedNamespace,
},
Type: corev1.SecretTypeOpaque,
Data: map[string][]byte{
"cert": pyxisCertDecoded,
"key": pyxisKeyDecoded,
},
}
pyxisFieldEnvMap := map[string]string{
"key": constants.PYXIS_STAGE_KEY_ENV,
"cert": constants.PYXIS_STAGE_CERT_ENV,
}
createSecretFromEnv(managedFw, managedNamespace, "pyxis", pyxisFieldEnvMap)

_, err = managedFw.AsKubeAdmin.CommonController.CreateSecret(managedNamespace, secret)
Expect(err).ToNot(HaveOccurred())
atlasFieldEnvMap := map[string]string{
"sso_account": constants.ATLAS_STAGE_ACCOUNT_ENV,
"sso_token": constants.ATLAS_STAGE_TOKEN_ENV,
}
createSecretFromEnv(managedFw, managedNamespace, "atlas", atlasFieldEnvMap)

err = managedFw.AsKubeAdmin.CommonController.LinkSecretToServiceAccount(managedNamespace, releasecommon.RedhatAppstudioUserSecret, constants.DefaultPipelineServiceAccount, true)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -247,6 +227,9 @@ func createRHIOReleasePlanAdmission(rhioRPAName string, managedFw framework.Fram
"server": "stage",
"secret": "pyxis",
},
"atlas": map[string]interface{}{
"server": "stage",
},
"fileUpdates": []map[string]interface{}{
{
"repo": releasecommon.GitLabRunFileUpdatesTestRepo,
Expand Down

0 comments on commit 34e70b9

Please sign in to comment.