Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
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 override values?

Edited

I will use the two steps for 'mainnet-detach', 'mainnet-attach' twice in pipelines.custom.

In the same code(mainnet-detach / mainnet-attach), when the "deploy-mainnet" step is executed for the first time, the variable 'instance_target' is defined as API01, and when the step is executed the second time, the variable 'instance_target' is defined and executed as API02.

 

How should I modify my code to set the variables?

[i need override values]

 

definitions:

services:

docker:

memory: 4096


###### deploy Mainnet ######

mainnet-detach: &mainnet-detach

step:

name: Detach mainnet ${target_instance}

image: amazon/aws-cli

runs-on:

- self.hosted

- linux

- ${target_instance}

oidc: true

script:

- export AWS_REGION=${AWS_REGION}

- export AWS_ROLE_ARN=${AWS_ROLE_ARN}

- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token

- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token

- aws sts assume-role-with-web-identity --role-arn ${AWS_ROLE_ARN} --role-session-name admin --web-identity-token "$BITBUCKET_STEP_OIDC_TOKEN" --duration-seconds 1000

- status=$(aws elbv2 describe-target-health --target-group-arn ${TARGET_GROUP_ARN} --targets Id=${target_instance_id} --query 'TargetHealthDescriptions[0].TargetHealth.State' --output text)


mainnet-attach
: &mainnet-attach

step:

name: Attach mainnet ${target_instance}

image: amazon/aws-cli

runs-on:

- self.hosted

- linux

- ${target_instance}

oidc: true

script:

- export AWS_REGION=${AWS_REGION}

- export AWS_ROLE_ARN=${AWS_ROLE_ARN}

- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token

- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token

- aws sts assume-role-with-web-identity --role-arn ${AWS_ROLE_ARN} --role-session-name admin --web-identity-token "$BITBUCKET_STEP_OIDC_TOKEN" --duration-seconds 1000

- status=$(aws elbv2 describe-target-health --target-group-arn ${TARGET_GROUP_ARN} --targets Id=${target_instance_id} --query 'TargetHealthDescriptions[0].TargetHealth.State' --output text)


pipelines
:

  custom:

    deploy-mainnet:

      - target_instance=API01

      - target_instance_id=${BITBUCKET_VARIABLE_API01}

      - <<: *mainnet-detach

      - <<: *mainnet-attach

      - target_instance=API02

      - target_instance_id=${BITBUCKET_VARIABLE_API02}

      - <<: *mainnet-detach

      - <<: *mainnet-attach

 

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 02, 2023

Hello @김주희 and thank you for reaching out to Community!

Currently, Bitbucket Pipelines does not support using variables to specify the runner's labels in the step definition. We do have an existing feature request for it at :

We suggest you Vote for that feature so that our product managers better understand the interest, and you can also add yourself as a Watcher to get notified whenever there's any update on that feature.

In the meantime, you will need to define two different steps where in each step you explicitly provide the runner label in the runs-on parameter, without using variables.

Thank you, @김주희 !

Patrik S

Suggest an answer

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

Atlassian Community Events