Support Bitbucket-server oAuth2 secret config (#1618)
Add an ability to configure bitbucket-server oAuth secret for the factory flow.pull/1620/head
parent
0eb919ed15
commit
d3fdf2476b
|
|
@ -314,19 +314,18 @@ func MountBitBucketOAuthConfig(ctx *chetypes.DeployContext, deployment *appsv1.D
|
|||
}
|
||||
|
||||
mountVolumes(deployment, secret, constants.BitBucketOAuthConfigMountPath)
|
||||
mountEnv(deployment, "CHE_OAUTH1_BITBUCKET_CONSUMERKEYPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigConsumerKeyFileName)
|
||||
mountEnv(deployment, "CHE_OAUTH1_BITBUCKET_PRIVATEKEYPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigPrivateKeyFileName)
|
||||
|
||||
if secret.Data["id"] != nil {
|
||||
if secret.Data["id"] != nil && secret.Data["secret"] != nil {
|
||||
mountEnv(deployment, "CHE_OAUTH2_BITBUCKET_CLIENTID__FILEPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigClientIdFileName)
|
||||
}
|
||||
if secret.Data["secret"] != nil {
|
||||
mountEnv(deployment, "CHE_OAUTH2_BITBUCKET_CLIENTSECRET__FILEPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigClientSecretFileName)
|
||||
} else {
|
||||
mountEnv(deployment, "CHE_OAUTH1_BITBUCKET_CONSUMERKEYPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigConsumerKeyFileName)
|
||||
mountEnv(deployment, "CHE_OAUTH1_BITBUCKET_PRIVATEKEYPATH", constants.BitBucketOAuthConfigMountPath+"/"+constants.BitBucketOAuthConfigPrivateKeyFileName)
|
||||
}
|
||||
|
||||
oauthEndpoint := secret.Annotations[constants.CheEclipseOrgScmServerEndpoint]
|
||||
if oauthEndpoint != "" {
|
||||
mountEnv(deployment, "CHE_OAUTH1_BITBUCKET_ENDPOINT", oauthEndpoint)
|
||||
mountEnv(deployment, "CHE_OAUTH_BITBUCKET_ENDPOINT", oauthEndpoint)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ func TestMountBitBucketServerOAuthEnvVar(t *testing.T) {
|
|||
value = utils.GetEnvByName("CHE_OAUTH1_BITBUCKET_PRIVATEKEYPATH", container.Env)
|
||||
assert.Equal(t, testCase.expectedPrivateKeyPath, value)
|
||||
|
||||
value = utils.GetEnvByName("CHE_OAUTH1_BITBUCKET_ENDPOINT", container.Env)
|
||||
value = utils.GetEnvByName("CHE_OAUTH_BITBUCKET_ENDPOINT", container.Env)
|
||||
assert.Equal(t, testCase.expectedOAuthEndpoint, value)
|
||||
|
||||
volume := test.FindVolume(deployment.Spec.Template.Spec.Volumes, "bitbucket-oauth-config")
|
||||
|
|
|
|||
Loading…
Reference in New Issue