Skip to content

Commit a7f0ad3

Browse files
authored
feat: add support for Bitbucket Cloud API token authentication. (#731)
1 parent 4d85980 commit a7f0ad3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

incubating/git-commit/step.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ kind: step-type
22
version: '1.0'
33
metadata:
44
name: git-commit
5-
version: 0.1.4
5+
version: 0.2.0
66
isPublic: true
77
description: Commit and push changes to repository
88
icon:
@@ -155,6 +155,9 @@ spec:
155155
- export GIT_ACCESS_TOKEN_USER=$(codefresh get context $GIT_INTEGRATION_NAME --decrypt --prepare -o yaml | yq -r -c .spec.data.auth.username)
156156
- export PRIVATE_KEY=$(codefresh get context $GIT_INTEGRATION_NAME --decrypt --prepare -o yaml | yq .spec.data.auth.sshPrivateKey)
157157
- echo PRIVATE_KEY=$PRIVATE_KEY >> /meta/env_vars_to_export
158+
# For Bitbucket Cloud integration with API Token, replace username by 'x-bitbucket-api-token-auth'
159+
- export GIT_INTEGRATION_TYPE=$(codefresh get context "$GIT_INTEGRATION_NAME" --decrypt --prepare -o yaml | yq -r -c .spec.type)
160+
- if [ "$GIT_INTEGRATION_TYPE" = "git.bitbucket" ] && [ "${GIT_ACCESS_TOKEN#ATAT}" != "$GIT_ACCESS_TOKEN" ]; then export GIT_ACCESS_TOKEN_USER="x-bitbucket-api-token-auth"; fi
158161
# If the git integration does not include the auth username, then default to the git_user_name argument
159162
- if [ "$GIT_ACCESS_TOKEN_USER" = "null" ]; then export GIT_ACCESS_TOKEN_USER=$GIT_USER_NAME; fi
160163
- echo GIT_ACCESS_TOKEN_USER=$GIT_ACCESS_TOKEN_USER >> /meta/env_vars_to_export

0 commit comments

Comments
 (0)