A job to promote a Pull Requests on GitOps repository
On each run, the bot will:
- Get the PR of the merged commit
- Clone the GitOps repository
- Promote the new PR in GitOps repository
- Create an application repository access token with
pullrequest:read
scope - Create a gitops repository access token with
pullrequest:write
scope - Set the environment variables:
GITOPS_SOURCE_ACCESS_TOKEN
: Bitbucket application repository in step 1GITOPS_ACCESS_TOKEN
: Bitbucket gitops repository in step 2GITOPS_BOT_EMAIL
: Bitbucket gitops repository email that is associated with the Access token created in step 2
docker run --rm \
--env GITOPS_SOURCE_ACCESS_TOKEN \
--env GITOPS_ACCESS_TOKEN \
--env GITOPS_BOT_EMAIL \
--env GITOPS_REPO \
--env GITOPS_DESTINATION_BRANCH \
--env GITOPS_SOURCE_BRANCH_PREFIX \
--env BITBUCKET_COMMIT \
--env BITBUCKET_REPO_OWNER \
--env BITBUCKET_REPO_SLUG \
--env BITBUCKET_REVIEWER_UUIDS \
bitbucket-pr-bot:latest
GITOPS_DESTINATION_BRANCH
: The branch that PR will be merged and deployed to environments such asmain
,master
,develop
,stg
,qa
GITOPS_SOURCE_BRANCH_PREFIX
: The prefix of the branch name that PR will be created from such asqa
for testing,stg
for staging,release
for productionBITBUCKET_REVIEWER_UUIDS
The list of string UUID of reviewers separated by;
. E.g{7ff3a816-c6c7-4cd7-8133};{7ff3a816-c6c7-4cd7-8133}
-
Add
GITOPS_SOURCE_ACCESS_TOKEN
andGITOPS_ACCESS_TOKEN
andGITOPS_BOT_EMAIL
to your repository variables -
Create a custom pipeline in your
bitbucket-pipelines.yml
filepipelines: custom: cc-bot: - step: name: Bitbucket PR Bot image: ghcr.io/thangnc/bitbucket-pr-bot:latest