Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to use the variable send through a trigger bitbucket pipeline in the triggered pipeline? Edited

Hi,

 I am trying to trigger a pipeline in my doc repository when a release is done in my actual code repository. For this, I am following the example given in "trigger bitbucket pipeline".

What I don't understand is how to write the pipeline which will be triggered in the other side and how use the variable send by the release pipeline ?

 

Thank you

 

1 answer

0 votes

You're variables will be available in your triggered pipeline as environment variables. For example, if you write your release pipeline like the following:

script:
  - pipe: atlassian/trigger-pipeline:4.0.5
    variables:
      BITBUCKET_USERNAME: $BITBUCKET_USERNAME
      BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
      REPOSITORY: 'your-awesome-repo'
      BRANCH_NAME: 'master'
      CUSTOM_PIPELINE_NAME: 'deployment-pipeline'
      PIPELINE_VARIABLES: >
          [{
            "key": "AWS_DEFAULT_REGION",
            "value": "us-west-1"
          },
          {
            "key": "AWS_ACCESS_KEY_ID",
            "value": "$AWS_ACCESS_KEY_ID",
            "secured": true
          },
          {
            "key": "AWS_SECRET_ACCESS_KEY",
            "value": "$AWS_SECRET_ACCESS_KEY",
            "secured": true
          }]
      WAIT: 'true'

You can use AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION in your downstream pipeline like this:

pipelines:
default:
- step:
script:
- echo $AWS_ACCESS_KEY_ID
- echo $AWS_SECRET_ACCESS_KEY
- echo $AWS_DEFAULT_REGION

Thank you. I was thinking by putting the custom pipeline name as 'deployment-pipeline, i need to have a downstream pipeline like this : 

pipelines:
custom:
deployment-pipeline:
- step:
script:
- echo $AWS_ACCESS_KEY_ID
- echo $AWS_SECRET_ACCESS_KEY
- echo $AWS_DEFAULT_REGION

I have a still an error when the pipeline is triggered.

Do you have an idea what it could be ?

HttpResponseSummary{httpStatusCode=400, httpStatusMessage=Bad Request, bodyAsString={"key":"variable-service.request.validation-error","message":"The request body contains invalid properties","arguments":{"value.required":"Property value is required"}}} (command VARIABLE_SERVICE_CREATE_PIPELINE_VARIABLE, error key='variable-service.request.validation-error')

Thanks you for your answer

You're probably missing a variable value. Note, that there are two fields for each variable: key, which is a variable name, and value, which is an actual variable value.

{
    "key": "VariableName",
    "value": "VariableValue"
}

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

190 views 2 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you