From 452b0789fff2af0b7122a1b6f1426051bfda2a5b Mon Sep 17 00:00:00 2001 From: Igor Vinokur Date: Wed, 27 Jul 2022 12:24:09 +0300 Subject: [PATCH] chore: Propagate Bitbucket SAAS Oauth secret properties (#1445) Add Bitbucket Oauth2 properties support. Propagate Bitbucket SAAS client id and client secret Oauth2 properties as workpsace environment variables. --- pkg/common/constants/constants.go | 26 ++++++++++++++------------ pkg/deploy/server/server_deployment.go | 3 +++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pkg/common/constants/constants.go b/pkg/common/constants/constants.go index a935a1f53e..6dc948d9d8 100644 --- a/pkg/common/constants/constants.go +++ b/pkg/common/constants/constants.go @@ -61,18 +61,20 @@ const ( DefaultCheServiceAccountName = "che" // OAuth - BitBucketOAuthConfigMountPath = "/che-conf/oauth/bitbucket" - BitBucketOAuthConfigPrivateKeyFileName = "private.key" - BitBucketOAuthConfigConsumerKeyFileName = "consumer.key" - GitHubOAuthConfigMountPath = "/che-conf/oauth/github" - GitHubOAuthConfigClientIdFileName = "id" - GitHubOAuthConfigClientSecretFileName = "secret" - GitLabOAuthConfigMountPath = "/che-conf/oauth/gitlab" - GitLabOAuthConfigClientIdFileName = "id" - GitLabOAuthConfigClientSecretFileName = "secret" - OAuthScmConfiguration = "oauth-scm-configuration" - AccessToken = "access_token" - IdToken = "id_token" + BitBucketOAuthConfigClientIdFileName = "id" + BitBucketOAuthConfigClientSecretFileName = "secret" + BitBucketOAuthConfigMountPath = "/che-conf/oauth/bitbucket" + BitBucketOAuthConfigPrivateKeyFileName = "private.key" + BitBucketOAuthConfigConsumerKeyFileName = "consumer.key" + GitHubOAuthConfigMountPath = "/che-conf/oauth/github" + GitHubOAuthConfigClientIdFileName = "id" + GitHubOAuthConfigClientSecretFileName = "secret" + GitLabOAuthConfigMountPath = "/che-conf/oauth/gitlab" + GitLabOAuthConfigClientIdFileName = "id" + GitLabOAuthConfigClientSecretFileName = "secret" + OAuthScmConfiguration = "oauth-scm-configuration" + AccessToken = "access_token" + IdToken = "id_token" // Labels KubernetesComponentLabelKey = "app.kubernetes.io/component" diff --git a/pkg/deploy/server/server_deployment.go b/pkg/deploy/server/server_deployment.go index b1d977cdfc..aa1c84ecb7 100644 --- a/pkg/deploy/server/server_deployment.go +++ b/pkg/deploy/server/server_deployment.go @@ -331,6 +331,9 @@ func MountBitBucketOAuthConfig(ctx *chetypes.DeployContext, deployment *appsv1.D mountEnv(deployment, "CHE_OAUTH1_BITBUCKET_CONSUMERKEYPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigConsumerKeyFileName) mountEnv(deployment, "CHE_OAUTH1_BITBUCKET_PRIVATEKEYPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigPrivateKeyFileName) + mountEnv(deployment, "CHE_OAUTH2_BITBUCKET_CLIENTID__FILEPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigClientIdFileName) + mountEnv(deployment, "CHE_OAUTH2_BITBUCKET_CLIENTSECRET__FILEPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigClientSecretFileName) + oauthEndpoint := secret.Annotations[constants.CheEclipseOrgScmServerEndpoint] if oauthEndpoint != "" { mountEnv(deployment, "CHE_OAUTH1_BITBUCKET_ENDPOINT", oauthEndpoint)