Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleEAP - exportPlan is marked experimental in 6.4
  • Atlassian considers export to java as beta for Bamboo 6.0 - export may be incomplete or not able to be imported without changes. The CLI exportPlan uses the Bamboo provided export for java.
  • Export plan to CLI is new in Bamboo CLI 6.4 and has some limitations as well in terms of completeness that will be addressed mostly in release 6.5.


Code Block
languagebash
titleExport to Bamboo Specs Java
--action exportPlan --plan EXAMPLE-PLAN --type java --file example.java

...

Code Block
languagebash
titleExport to a CLI Script
--action exportPlan --plan EXAMPLE-PLAN --file example.txt

...

Expand
titleSee generated CLI source


Code Block
languagebash
linenumberstrue
# Exported from https://examplegear.com running Bamboo 6.0.0 on 2017-05-02 by automation using the Bamboo CLI 6.4.0-SNAPSHOT

-a createOrUpdatePlan    --plan ZEXPORT-BASE  --name "Base"  --description "" 

-a removeRepository      --plan @plan@  --repository @all 
-a addRepository         --plan @plan@  --repository "cli" 

-a removeBranch          --plan @plan@  --branch @all 
-a addBranch             --plan @plan@  --branch 2.5.0 \
                                                --name "ZEXPORT - Base - 2.5.0" 

-a removeVariables       --plan @plan@  --field1 @all 
-a addVariables          --plan @plan@  --field1 "v1"  --value1 "xxx" 

-a removeStage           --plan @plan@  --stage @all 
-a addStage              --plan @plan@  --stage "FIRST" 

-a addJob                --plan @plan@  --stage @stage@  --job JOB1 \
                                                --name "JOB1" 
-a addArtifact           --plan @plan@  --job @job@ \
                                                --artifact "out.txt" \
                                                --copyPattern "out.txt" 
-a addTask               --plan @plan@  --job @job@ \
                                                --taskKey com.atlassian.bamboo.plugins.vcs:task.vcs.checkoutCHECKOUT \
                                                --name "Source Code Checkout" \
                                                --description "Checkout Default Repository" 
-a addTask               --plan @plan@  --job @job@ \
                                                --field1taskKey "cleanCheckout"SCRIPT \
                                                --value1name "Script" \
                                                --field2field1 "checkoutDir_0scriptLocation" \
                                                --value2value1 "INLINE" \
                                                --field3field2 "checkoutDir_{index}scriptBody" \
                                                --value3value2 "echo xxx > out.txt" \
                                                --field4field3 "selectedRepository_{index}interpreter" \
                                                --value4value3 "defaultRepositoryRUN_AS_EXECUTABLE" \
-a addTask               --plan @plan@  --job @job@ \
                          --field5 "selectedRepository_0" \                    --taskKey CLI_BAMBOO \
                          --value5 "defaultRepository"  -a addTask               --plan @plan@  --job @job@name "Bamboo CLI" \
                                                --taskKey com.atlassian.bamboo.plugins.scripttask:task.builder.scriptfield1 "scriptLocation" \
                                                --namevalue1 "ScriptINLINE" \
                                                --field1field2 "argumentscriptBody" \
                                                --value1value2 "" \
                                                --field2 "scriptLocation" \
                                                --value2 "INLINE" \
                                                --field3 "environmentVariables" \
                                                --value3 "" \
                                                --field4 "scriptBody" \
                                                --value4 "echo xxx > out.txt" \
                                                --field5 "interpreter" \
                                                --value5 "RUN_AS_EXECUTABLE" \
                                                --field6 "script" \
                                                --value6 "" \
                                                --field7 "workingSubDirectory" \
                                                --value7 "" 
-a addTask               --plan @plan@  --job @job@ \
                                                --taskKey org.swift.bamboo.acli:bamboo \
                                                --name "Bamboo CLI" \
                                                --field1 "scriptLocation" \
                                                --value1 "FILE" \
                                                --field2 "scriptBody" \
                                                --value2 "--help" \
                                                --field3 "directory" \
                                                --value3 "" \
                                                --field4 "script" \
                                                --value4 ""

Export All Plans With One CLI Action

One action will export all your existing plans to a directory. Alternatively, be more selective by doing this by project and using regex based filtering on names. 

Code Block
languagebash
titleExport All Plans
--action runFromPlanList --project @all --common "--action exportPlan --plan @plan@ --type java --file export/@project@/@plan@.java"
or 
--action runFromPlanList --project @all --common "--action exportPlan --plan @plan@ --file export/@project@/@plan@.txt"

Import - Creating or Updating Plans

For java, use your IDE of choice and refer to the Atlassian documentation.

...

--help"


Export All Plans With One CLI Action

One action will export all your existing plans to a directory. Alternatively, be more selective by doing this by project and using regex based filtering on names. 

Code Block
languagebash
titleExport All Plans as Java Files
--action runFromPlanList --project @all --common "--action exportPlan --plan @plan@ --type java --file export/@project@/@plan@.java"


Code Block
languagebash
titleExport All Plans as CLI Scripts
--action runFromPlanList --project @all --common "--action exportPlan --plan @plan@ --file export/@project@/@plan@.txt"

Import - Creating or Updating Plans

For java, use your IDE of choice and refer to the Atlassian documentation.

For CLI, use one of the following approaches depending on your situation. We use the --continue option to keep going even if something fails along the way. The export was constructed to support updating an existing plan without deleting it first. This is important to maintain references from other plans. Also, some history is retained, but due to a Bamboo limitation, previous logs are lost. Use movePlan to another location (project or key change) in order to save all logs.

Code Block
languagebash
titleCreate same plan key as export
--action run --file example.txt --continue


Code Block
languagebash
titleCreate new plan key
--action run --file example.txt --findReplace "--plan EXAMPLE-TEMPLATE:--plan EXAMPLE-PLAN1, --name TEMPLATE:--name Plan1" --continue