Skip to end of banner
Go to start of banner

How to semi-automate repetitive tasks

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Description

Often you need to create a standard set of Confluence pages or JIRA issues or similar. The Run CLI Actions in Confluence allows you to semi-automate this process using the power of Appfire Command Line Interface (CLI). The process or activity is easily documented and readily changeable. Confluence page history provides tracking. The Run Self-Service Reports for Confluence should be used to provide a run button and to parameterize some of the data - the technique is demonstrated in Repetitive task using the RUN macro. An alternative is to use the --simulate parameter on the run action and manually remove it when ready to run the actions using preview mode.

Confluence example

Wiki markup
{cli:profile=confluence}

--action run --common "--space zcli"

@DATA:
  --action storePage --title "Designs"
  --action storePage --title "Design 1" --parent "Designs"
  --action storePage --title "Design 2" --parent "Designs"

# Remove comment for this only for UI  projects!!!
# --action storePage --title "UI Design 1" --parent "Designs"

{cli}
Result
Run: --space zcli --action storePage --title "Designs"
Page updated: 'Designs'.  Page has id: 86245981

Run: --space zcli --action storePage --title "Design 1" --parent "Designs"
Page updated: 'Design 1' as child of 'Designs'.  Page has id: 86245982

Run: --space zcli --action storePage --title "Design 2" --parent "Designs"
Page updated: 'Design 2' as child of 'Designs'.  Page has id: 86245983
# Only do this page for UI  projects
# --action storePage --title "UI Design 1" --parent "Designs"

Run completed successfully. 3 actions were successful 

JIRA example

Wiki markup
{cli:profile=jira}

h3. JIRA example
{cli:profile=jira}
--action run --common "--project zcli"

@DATA:
  --action createIssue --type task --summary "Task 1"
  --action createIssue --type task --summary "Task 2"

{cli}

Result
Run: --project zcli --action createIssue --type task --summary "Task 1"
Issue ZCLI-22 created with id 78404. URL: http://localhost:8215/browse/ZCLI-22

Run: --project zcli --action createIssue --type task --summary "Task 2"
Issue ZCLI-23 created with id 78405. URL: http://localhost:8215/browse/ZCLI-23

Run completed successfully. 2 actions were successful


Complete example

This example uses Run Self-Service Reports for Confluence to provide run button and optionally a button that saves the result of the run. This expands on How to semi-automate repetitive tasks.

{run:id=cli|anchor=results|inputSize=30|titleExport=Run and save output|
dateFormat=yyyy-MM-dd hh.mm.ss|
exportFile=?^$current_time.html|
attachmentComment=?Pages for $space|replace=
space::Space key:text-required,
script:'
  --action storePage --title "Designs"
  --action storePage --title "Design 1" --parent "Designs"
':Script of actions (one per line):textarea-required:5:140}

{anchor:results}
----
Results generated: *$current_time*

{cli:profile=confluence}
--action run --common "--space $space" 
@DATA:
$script
{cli}

{run}

Result

  • No labels