HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Bitbucket pipelines: Deployment destination dependent on commit author

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
destinationcommitpipelinesbitbucketdependentauthordeployment

Problem

I'd like to create a deployment pipeline triggered on PR creation that would deploy to e.g. 'staging1' environment if it's my commit and 'staging2' if it's a commit of other team member (the idea is for each team member to have his/her own environment assigned, but deploy using a shared parametrized pipeline). Is it possible to achieve this and if so, then how?

Solution

the idea is for each team member to have his/her own environment assigned, but deploy using a shared parametrized pipeline


  • You could use definitions for the steps for each environment.



definitions:
steps:
- step: deploy to staging1
script:
- echo "Staging 1"
- step: deploy to staging2
script:
- echo "Staging 2"



  • Then just express each colleague branch and restrict his commits to just this branch.


For each of the branches you could call your needed definitions.

branches: #these will run on every push of the branch
feature/john.b:
- step:
# call needed definition step/s
feature/pavel.m:
# call needed definition step/s



This gives u flexibility to express multiple definitions steps for one person if needed.

Code Snippets

the idea is for each team member to have his/her own environment assigned, but deploy using a shared parametrized pipeline

Context

StackExchange DevOps Q#10867, answer score: 1

Revisions (0)

No revisions yet.