Missed Team ’24? Catch up on announcements here.

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

How to set the deployment variable and import pipeline config ?

ronwaldo_querol May 5, 2024

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

 

2 answers

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 7, 2024

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

0 votes
YY哥
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2024

Hi @ronwaldo_querol 

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 

ronwaldo_querol May 5, 2024

@YY哥  - 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

Suggest an answer

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

Atlassian Community Events