This article shows how to answer the question: How do I find all jobs using a specific task?
Tip |
---|
This requires CLI release 7.6. |
...
Code Block |
---|
|
-a runFromPlanList --project CLI --common "-a runFromJobList --plan @plan@ --common \"-a getTaskList --plan @plan@ --job @job@ --regex \"\"Maven 3.x\"\" --file tasks.csv --append \" " --clearFileBeforeAppend |
This will take a while to complete on larger sites.
Code Block |
---|
|
-a runFromPlanList --project @all --common "-a runFromJobList --plan @plan@ --common \"-a getTaskList --plan @plan@ --job @job@ --regex \"\"Maven 3.x\"\" --file tasks.csv --append \" " --clearFileBeforeAppend |
No Format |
---|
"Plan","Job","Id","Name","Description","Task Key","Task Key Alias","Enabled","Final","Position"
"CLI-BAMBOO630","JOB1","3","Maven 3.x","","com.atlassian.bamboo.plugins.maven:task.builder.mvn3","MAVEN3","Yes","No","3"
"CLI-BASE","JOB1","3","Maven 3.x","","com.atlassian.bamboo.plugins.maven:task.builder.mvn3","MAVEN3","Yes","No","3"
... |
Csv |
---|
"Plan","Job","Id","Name","Description","Task Key","Task Key Alias","Enabled","Final","Position"
"CLI-BAMBOO630","JOB1","3","Maven 3.x","","com.atlassian.bamboo.plugins.maven:task.builder.mvn3","MAVEN3","Yes","No","3"
"CLI-BASE","JOB1","3","Maven 3.x","","com.atlassian.bamboo.plugins.maven:task.builder.mvn3","MAVEN3","Yes","No","3" |
The is a general answer to this type of question. If you have a CSV list of items, you can use a small script process each line or you can use runFromCsv to run an action for each line provided the CSV file has the correct headers for the action you are trying to run. You can modify the CSV file by hand or automate with the CSVCLI. In most cases, I recommend using the columns parameter on the list generation to only generate the columns needed for a subsequent runFromCSV action.
More specifically, for tasks you can use the runFromTaskList action directly in place of the getTaskList action above to simply do the request.
Code Block |
---|
|
-a runFromPlanList --project CLI --common "-a runFromJobList --plan @plan@ --common \"-a runFromTaskList --plan @plan@ --job @job@ --continue --regex \"\"Maven 3.x\"\" --common \"\"-a getTask --plan @plan@ --job @job@ --task @task@ \"\" \" " |
...