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" \
                                                --value4 "defaultRepository" \
                                                --field5 "selectedRepository_0" \
                                                --value5 "defaultRepository" 
-a addTask               --plan @plan@  --job @job@ \
                                                --taskKey com.atlassian.bamboo.plugins.scripttask:task.builder.script \
                                                --name "Script" \
                                                --field1 "argument" \
                                                --value1 "" \
                                                --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" \
                             value3 "RUN_AS_EXECUTABLE" 
-a addTask               --plan @plan@   --value1job "FILE"@job@ \
                                                --field2 "scriptBody"taskKey CLI_BAMBOO \
                                                --value2name "--helpBamboo CLI" \
                                                --field3field1 "directoryscriptLocation" \
                                                --value3value1 "INLINE" \
                                                --field4field2 "scriptscriptBody" \
                                                --value4value2 "--help"


Export All Plans With One CLI Action

...

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 a CLI ScriptScripts
--action runFromPlanList --project @all --common "--action exportPlan --plan @plan@ --file export/@project@/@plan@.txt"

...

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

...