Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to use pipe in yaml anchors? Need help with refactor

Edited
Deleted user Mar 10, 2023

Hello All,

I have below parallel step, I want to refactor the same to reduce the number of lines in bitbucket-pipelines.yml

      - parallel:
          - step:
              name: Deploy Identity Service Main to Feature
              script:
                - echo "deploy identity service"
                - export SERVICE_TO_DEPLOY=identityservice
                - echo "Deploy service ${SERVICE_TO_DEPLOY}"
                - pipe: atlassian/trigger-pipeline:5.1.0
                  variables:
                    BITBUCKET_USERNAME: $BB_INTEGRATION_USER
                    BITBUCKET_APP_PASSWORD: $BB_INTEGRATION_TOKEN
                    REPOSITORY: ${SERVICE_TO_DEPLOY}
                    REF_TYPE: "branch"
                    REF_NAME: "pipelines"
                    CUSTOM_PIPELINE_NAME: "main-to-feature-deploy"
                    PIPELINE_VARIABLES: >
                      [{
                        "key": "BRANCH_TO_DEPLOY",
                        "value": "${BITBUCKET_BRANCH}"
                      },
                      {
                        "key": "SOURCE_REPO_NAME",
                        "value": "$BITBUCKET_REPO_SLUG"
                      }]
                    WAIT: "true"
          - step:
              name: Deploy Admin Service Main to Feature
              script:
                - echo "deploy admin service"
                - export SERVICE_TO_DEPLOY=adminservice
                - echo "Deploy service ${SERVICE_TO_DEPLOY}"
                - pipe: atlassian/trigger-pipeline:5.1.0
                  variables:
                    BITBUCKET_USERNAME: $BB_INTEGRATION_USER
                    BITBUCKET_APP_PASSWORD: $BB_INTEGRATION_TOKEN
                    REPOSITORY: ${SERVICE_TO_DEPLOY}
                    REF_TYPE: "branch"
                    REF_NAME: "pipelines"
                    CUSTOM_PIPELINE_NAME: "main-to-feature-deploy"
                    PIPELINE_VARIABLES: >
                      [{
                        "key": "BRANCH_TO_DEPLOY",
                        "value": "${BITBUCKET_BRANCH}"
                      },
                      {
                        "key": "SOURCE_REPO_NAME",
                        "value": "$BITBUCKET_REPO_SLUG"
                      }]
                    WAIT: "true"

1 answer

1 accepted

1 vote
Answer accepted
Deleted user Mar 10, 2023

Got the answer from this issue.

My code is as below

Definitions:

definitions:
  services:
    docker:
      memory: 1536

  pipes:
    - pipe: &triggerpipeline
        pipe: atlassian/trigger-pipeline:5.1.0
        variables:
          BITBUCKET_USERNAME: $BB_INTEGRATION_USER
          BITBUCKET_APP_PASSWORD: $BB_INTEGRATION_TOKEN
          REPOSITORY: ${SERVICE_TO_DEPLOY}
          REF_TYPE: "branch"
          REF_NAME: "pipelines"
          CUSTOM_PIPELINE_NAME: "main-to-feature-deploy"
          PIPELINE_VARIABLES: >
            [{
              "key": "BRANCH_TO_DEPLOY",
              "value": "${BITBUCKET_BRANCH}"
            },
            {
              "key": "SOURCE_REPO_NAME",
              "value": "$BITBUCKET_REPO_SLUG"
            }]
          WAIT: "true"

And parallel steps:

      - parallel:
          - step:
              name: Deploy Identity Service Main to Feature
              script:
                - echo "deploy identity service"
                - export SERVICE_TO_DEPLOY=identityservice
                - echo "Deploy service ${SERVICE_TO_DEPLOY}"
                - *triggerpipeline

          - step:
              name: Deploy Admin Service Main to Feature
              script:
                - echo "deploy admin service"
                - export SERVICE_TO_DEPLOY=adminservice
                - echo "Deploy service ${SERVICE_TO_DEPLOY}"
                - *triggerpipeline

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events