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"
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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.