How do I set the deployment variable and import the pipeline configuration?
definitions:
steps:
- step: &test-deployment-variable
name: Set Test Deployment Variable
deployment: Test
script:
- echo 'Test'
- step: &staging-deployment-variable
name: Set Staging Deployment Variable
deployment: Stage
script:
- echo 'Stage'
- step: &production-deployment-variable
name: Set Production Deployment Variable
deployment: Production
script:
- echo 'Production'
pipelines:
branches:
develop:
- step: *production-deployment-variable
import: application-pipeline:master:shared-pipeline
Hi @ronwaldo.querol,
In the importing repository, I'm afraid that it is not possible to combine an imported pipeline with a separate step, as you are currently doing:
pipelines:
branches:
develop:
- step: *production-deployment-variable
import: application-pipeline:master:shared-pipeline
You can only use a shared pipeline as follows:
pipelines:
branches:
develop:
import: application-pipeline:master:shared-pipeline
We do have a feature request for sharing individual steps and combining an imported pipeline with another step: https://jira.atlassian.com/browse/BCLOUD-22855
The importing pipeline will use the deployment environment that is defined in application-pipeline:master:shared-pipeline. For example, if that shared pipeline looks like this in the exporting repo
definitions:
pipelines:
shared-pipeline:
- step:
deployment: Test
script:
- echo $myVar
and you have defined a deployment variable named myVar in the importing repo for the Test environment, this is what the importing pipeline will use.
If you want to use the same in a different pipeline of the importing repo with a different deployment environment, you will need to configure additional shared pipelines in the exporting repo with a different deployment environment and also define the variable myVar in the importing repo in the respective environments.
Please feel free to let me know if you have any questions.
Kind regards,
Theodora
Welcom to our Community.
It seems that you're using Bibucket features from Premium plan called shared pipeline.
Here's an examle of snyk pipen with a variable of $SNYK_TOKEN:
- step: &run_snyk_scan
name: run_snyk_scan
script:
- pipe: snyk/snyk-scan:1.0.1
variables:
SNYK_TOKEN: $SNYK_TOKEN
LANGUAGE: "node"
Then you configured the variable value in each repo using that shared pipeline.
Hope it helps & Thanks,
YY哥, Atlassian Certified Expert
Cloze Tech, China
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@YY Brother - thanks but I didn't get your response and not sure if this help to achieve the goal of using deployment variables to override the repository variable and use on the imported pipeline repository.
So I have Deployments and set the variable 'version':
Test Environment:
version = 8.1
Stage Environment:
version = 8.2
This was also set on the repository variable as '8.1' as the value.
I have the bash scipt on the imported pipeline and pass the variable version on it.
mybash.sh $version
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.