Answers: <pre><code>the idea is for each team member to have his/her own environment assigned, but deploy using a shared parametrized pipeline
  </code></pre>
  
  <ol>
  <li>You could use definitions for the steps for each environment.</li>
  </ol>
  
  <pre class="lang-yaml prettyprint-override"><code>definitions:
    steps:
      - step: deploy to staging1
          script:
            - echo "Staging 1"
      - step: deploy to staging2
          script:
            - echo "Staging 2"
  
  </code></pre>
  
  <ol start="2">
  <li>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.</li>
  </ol>
  
  <pre class="lang-yaml prettyprint-override"><code>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
  
  </code></pre>
  
  <p>This gives u flexibility to express multiple definitions steps for one person if needed. </p>
  
Answers: CC BY-SA 4.0
Answers: 2020-03-06T17:42:41.857Z
Answers: 2020-03-06T17:42:41.857Z
Answers: Recoba20
Body: <p>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?</p>
  
Tags: <deployment><continuous-deployment><cicd><bitbucket><bitbucket-pipelines>
Title: Bitbucket pipelines: Deployment destination dependent on commit author
UserDisplayName: asliwinski
ThreadText: # Bitbucket pipelines: Deployment destination dependent on commit author
  
  (Asked by: username_0 on 2020-02-20)
  
  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?
  
  **Tags:** deployment, continuous-deployment, cicd, bitbucket, bitbucket-pipelines
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-03-06. Score: 1
  
  ```
  the idea is for each team member to have his/her own environment assigned, but deploy using a shared parametrized pipeline
  
  ```
  
  1. You could use definitions for the steps for each environment.
  
  ```yaml
  definitions:
    steps:
      - step: deploy to staging1
          script:
            - echo "Staging 1"
      - step: deploy to staging2
          script:
            - echo "Staging 2"
  
  ```
  
  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.
  
  ```yaml
  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.
  
  
  ---
  
  