How to pass multiple pattern to custom bitbucket pipeline API inside Target block ?

Ranopriyo Neogy July 12, 2021

I want to invoke a custom bitbucket pipeline via custom BitBucket API. Is there a way I can pass multiple patterns in the below command calling the API ?

At present, I am able to run only one pipeline create-aws-account via the command line (Bit bucket API). 

Note: I want to run the yaml file mentioned in below sequence via the custom bitbucket API command  : 

  • create-aws-account
  • set-sso-permissions
  • run-cloudhealth-pipeline
  • run-tekton-pipeline

 

Command:

curl -X POST -is -u uname:password \

        -H 'Content-Type: application/json' \

        https://api.bitbucket.org/2.0/repositories/xxxx/xxxx/pipelines/ \

        -d '

        {

            "target": { 

            "type": "pipeline_ref_target",

            "ref_type": "branch",

            "ref_name": "master",

            "selector": {

            "type": "custom",

            "pattern": "create-aws-account"

              }

            },

        "variables": [

            {

            "key": "account_id",

            "value": "02020202",

            "secured": true

            },

 

 

Below is my Pipeline code bitbucket-pipelines.yml and I want to run them sequentially one after the other. 




pipelines:

  custom:

    create-aws-account:

      - variables:

          - name: account_id # single string (required)

      - step: *tfapply

    set-sso-permissions:

      - variables:

          - name: aws_account_id # single string (required)

          - name: aws_region # us-east-1 or ca-central-1

      - step: *aws_sso_access

    run-cloudhealth-pipeline:

      - variables:

          - name: aws_account_name

          - name: aws_account_id

      - step: *cloudhealth_pipeline

    run-tekton-pipeline:

      - variables:

          - name: account_id # single string (required)

          - name: app_id # single string (optional)

      - step: *tekton_pipeline

 

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 17, 2021

Hi @Ranopriyo Neogy

Thank you for reaching out to the community.

I'm afraid it's not possible for you to run multiple patterns for your custom steps in your Pipelines YAML configuration as the API only works for a single trigger.

If you want to trigger the other custom steps, you will have to run multiple Curl commands with different patterns.

Let me know if you have any further questions.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events