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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,460,920
Community Members
 
Community Events
176
Community Groups

Select which scripts will run in the pipeline

Hello,

I would like to know if it is possible when running a pipeline, to choose which scripts will be executed. Ex:

release: &release
- step:
     name:  Release
     trigger: manual
          deployment: production
          artifacts:
               download: false
           script:
               - chmod +x sh/script.sh
               - ./sh/script.sh api1
               - ./sh/script.sh api2
               - ./sh/script.sh api3
would it be possible to open a question asking which api for example I want to include to run the script?

In the way I developed the 3 always run, but I would like to have the possibility of being something dynamic, where sometimes I can run all or just one or two.

1 answer

1 accepted

0 votes
Answer accepted

Hi @Júlio César Fonseca Costa and welcome to the community!

It is not possible to execute only some commands of a step's script. When a step runs, all the commands in its script will be executed sequentially (unless one of them fails and the step fails, then the rest won't be executed).

If you don't want all of them to be executed, you can create a separate manual step for each API and then run manually the step(s) you want.

Another option would be to use a custom pipeline that can make use of variables, as follows:

pipelines:
custom:
my-custom-pipeline-name: #name of this pipeline
- variables: #list variable names under here
- name: api
default: "api1" # optionally provide a default variable value
allowed-values: # optionally restrict variable values
- "api1"
- "api2"
- "api3"
- step:
script:
- chmod +x sh/script.sh
- ./sh/script.sh $api

In this example, I am using a variable named api, with allowed values api1, api2, and api3. When you try to run manually a custom pipeline like this, you will be asked to choose the value for the variable api. If you want to run more than 1 apis, you will need to run the custom pipeline multiple times, one for each value.

If you have any questions, please feel free to let me know.

Kind regards,
Theodora

Hello @Theodora Boudale

Thanks for your answer, I'm going to use the option of having custom pipelines anyway.

Thank you very much.

You are very welcome @Júlio César Fonseca Costa, please feel free to reach out if you ever need anything else!

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events