Availability

Child pages
  • Run CLI Actions in Confluence

Skip to end of metadata
Go to start of metadata

Description

Atlassian Command Line Interface (CLI) actions can now be run directly from Confluence pages. This enables administrators to more easily document and run common automation steps. It also allows administrators to selectively enable self-service actions within a Confluence context using the Run Self-Service Reports for ConfluenceScripting for Confluence, or similar. 

Features

  1. Supports all clients included with the Atlassian CLI distribution (with the same version number)
  2. Any server instance supported by the Atlassian CLI can be accessed for running actions depending on having valid user credentials for the actions requested. This is the same as running the actions from a command line. This includes Cloud installations.
  3. Command and input data from macro body, attachment, or file system
  4. Profiles can be configured by administrators for common server configurations
    • Enables password hiding
  5. Display options - showCommandpanelhideOutput
  6. Option to render body before processing - macros=true
  7. Passwords in the CLI output are suppressed
  8. dataSource parameter for runFromSql action - same as SQL for Confluence add-on's dataSource parameter
  9. Security control (optional) via Macro Security for Confluence for plugin use and access to advanced parameters (profile, product, directory)
  10. include-remote macro to include content from a remote Confluence site

Get Started

Part of our Atlassian CLI Family of Tools

The following table provides a brief outline of our CLI family of tools.

Pricing information outlined in each product's Marketplace entry. Click product image or Try it Free link for details.

Category

CLI Clients / Connectors



Run CLI Actions



Description
  • Downloadable CLI Client, paired with a
    UPM installed CLI
    Connector.
  • All-in-one UPM installed solution.
    (CLI Runner, with the capabilities of all
    CLI Clients
    )
Benefits
  • Rich CLI Client.
  • Enhanced actions.
  • Deep automation. 
  • Ultimate control.
  • Execute powerful CLI automation
    right within your Atlassian products:
    • via Workflow Functions or UI in JIRA
    • via Macros in Confluence
    • via Tasks in Bamboo
    • via Hooks in Bitbucket

Deployment
Options


JIRA

Confluence

Bamboo
Bitbucket

Service Desk


Not applicable. Use Run CLI Actions in JIRA.

HipChat


Run CLI Actions not
available for HipChat.
Crucible
Run CLI Actions not available
for Crucible.
FishEye
Run CLI Actions not
available for FishEye.
UPM

Included  |  Documentation

NEW

Not applicable.
CSV

Included  |  Documentation

NEW

Not applicable.
Atlassian


Get it Now  |  Documentation

No additional purchase required for Atlassian CLI.
Paired
"CLI Connector" not included.
Compatible with all other licensed CLI tools.


Not applicable.

 

 

  • No labels

39 Comments

  1. Can I use it if I have confluence alone and no other atlassian products? 

    1. Yes, it works with one or more products and one or more installations.

  2. Wow. You are hard core! Nice work!

  3. First thank you very much for this cool plugin!

    Is it possible to add two (or more) actions inside of the run-macro?

    I would need to 1) add a Page + 2) add some labels to the newly created page. I tried to put several -action-lines one under the other but got an error?

    It should be easy to add this possibility and it would make much more things possible!

    (or did I miss something?)

    Thanks a lot in advance!

    1. {run:id=myid|prompt=Neuen Eintrag anlegen|titleRun=Eintrag ergänzen|replace=titleofentry:inhalt ersetzen:Text des Eintrages:text,labelstoset:'prio1, sv':zu setzende Labels:text}
      {cli:profile=combit-confluence}
      --action addPage  --space "$space_key"   --title "$titleofentry" --parent "$page_title"
      {cli}
      {cli:profile=combit-confluence}
      --action addLabels  --space "$space_key"   --title "$titleofentry"    --labels "$labelstoset"
      {cli}
      {run}

      Stupid question - it works like a charm!! ;-)

      1. The only thing what's missing: Is there somewhere an option to suppress the output?

        I mean I don't need (in my context) to have displayed:

        OutputPage created: 'inhalt ersetzen3' as child of 'Checklistenvorlage'. Page has id: 10488228

        OutputLabels: 'prio1, sv' were added to item: 'inhalt ersetzen3' from space: 'template'

          1. fantastic!

            don't know how i could miss this in the documentation...

      2. Good that you figured it out. This approach works especially if you need to so some other activity between the 2 actions. However, there is another alternative that is a better especially if you have a large number of actions:

        Example using run
        {run:...}
        {cli:profile=combit-confluence}
        --action run 
        
        @DATA:
        --action addPage   --space "$space_key" --title "$titleofentry" --parent "$page_title"
        --action addLabels --space "$space_key" --title "$titleofentry" --labels "$labelstoset"
        {cli}
        {run}
        
        1. Thanks++

          (perhaps you could/should include it on the samples page?)

  4. Another probably very interesting use of this plugin:

    Is there a way to add "metadata" to a (newly) created page?

    (like it is created e.g. by the metadata-macro or checklist-macros)

    1. Anything can be added as part of your run macro.

      1. I guess with a Groovy-Macro (like you recommended somewhere) I should be able to execute:contentPropertyManager.setTextProperty(contentEntityObject, "your.key", "your value");

        to write a metadate-value.

        Unfortunately even after some time of googling I could not find a Groovy-Confluence-Sample which does provide an example about how to use these objects?
        If you have any hint...

        Thanks a lot. I admire your plugins...

        1. I meant use regular metadata macros within the run macro, after the cli actions are completed.

          1. As far as I've seen, I can only read metadata with them, not write?

            And second problem, I had to uninstall metadata-plugin because I got weired problems with them in our confluence 4.1...

            (on every saving of a page, even in pages without the macro)

            this one: https://plugins.atlassian.com/plugin/details/5295

            Perhaps its the wrong one? There are several meta-data plugins out there it's a little bit confusing...

            I don't mind using Groovy if I have a starting point...

  5. Hi Bob,
    I work on Confluence 4.0.5, and I wrote a little user macro called getpagename (this macro haven't a body)

    ## @noparams
    $content.getTitle()
    

    I use this macro on CLI plugin and work very well, but If I use other macro in the wiki, CLI give me an error.
    I give you some examples:

    The following wiki markup generate the correct subpage whit correct body (ex: test-point1) but no excerpt macro are inside it!!

    {run:autorun=false|heading=MyPoint|titleRun=OK|replace=t1:1:Point:text,t2:Superman:Who talk:text,t3:Max 20 linee:Description:textarea:20:100}
    {cli:profile=confluence-profile1|hideOutput=false|macros=true}
    --action storePage --space "myspace" --title "{getpagename}-point$t1" --parent "{getpagename}" --content "h2. Point $t1
    Point: $t1
    Who talk?: $t2
    Description: {excerpt}$t3{excerpt}"
    {cli}
    {run}
    

    Instead the following wiki markup generate an error PARAMETER_PROBLEM

    run:autorun=false|heading=MyPoint|titleRun=OK|replace=t1:1:Point:text,t2:Superman:Who talk:text,t3:Max 20 linee:Description:textarea:20:100}
    {cli:profile=confluence-profile1|hideOutput=false|macros=true}
    --action storePage --space "myspace" --title "{getpagename}-point$t1" --parent "{getpagename}" --content "{attachments}"{cli}
    {run}
    

    How I can resolve this problem ?
    For my project excerpt macro is necessary....
    Thx

    1. You have macros=true which means the excerpt macro gets evaluated too early. Turn off macros and use the pre-defined variable $page_title to do what you want instead of getpagename. Same for your second problem, attachments macro is being evaluated too soon causing all the trouble.

      1. Great bob, you're a legend...Really thank you.

        • Can you tell me where is a link that lists, and explain,s these variables?
        • Or, you could, please, publish a list of these variables and macros that you can use inside?
  6. Hi Bob,

    we are looking for a way to mass change data that is stored by the scaffolding plugin. We tried to do direct database manipulation in the XML entries that get created by scaffolding but we were not able to export, modify and import the xml without corruption.

    Is there any chance that field modification could be done by the action modifyPage from CLI? I tried this with normal wiki text and the findReplace function is just what we need but it applies only to the direct content stored on the wiki page. Is there any chance this could work for scaffolding data? The page itself just contains the live-template.

    Thanks in advance and keep up the good work. Any other hint is highly also appreciated.

    1. No, it will only affect the source that can be retrieved from Confluence. None of the other page related data is exposed via the remote API. I assume this is kind of a one time thing. Suggest you look into a groovy or other script (Script Plugin for Confluence) and try to access the data through Confluence APIs and then use regex find/replace logic. I can't recall where Scaffolding stores the data, but it is probably content properties (https://developer.atlassian.com/display/CONFDEV/Persistence+in+Confluence) .

  7. Ok thanks for your answer. Yeah it's kind of a one time thing. I had another thought and will probably just change the value in Scaffolding, set  the default value to the desired value, update all pages with kind of modifyPage with your CLI and then go on to the next value. Not very elegant but it should work as Scaffolding drops values that got removed and goes back to default when a page update is done.

  8. Hi! Im having some weird issues when trying to run the ./confluence.sh --action GetSpacelist now.. it gives me this error:

    Exception in thread "main" java.lang.ClassFormatError: org.swift.confluence.cli.ConfluenceClient (unrecognized class file version)   

    at java.lang.VMClassLoader.defineClass(libgcj.so.7rh)   
    at java.lang.ClassLoader.defineClass(libgcj.so.7rh)   
    at java.security.SecureClassLoader.defineClass(libgcj.so.7rh)   
    at java.net.URLClassLoader.findClass(libgcj.so.7rh)   
    at java.lang.ClassLoader.loadClass(libgcj.so.7rh)   
    at java.lang.ClassLoader.loadClass(libgcj.so.7rh)   
    at gnu.java.lang.MainThread.run(libgcj.so.7rh)

    ANy ideas as to what can be wrong?

    1. It looks like you have some JAVA issues. Make sure you are using Java 1.6 or above. Google the class format error if you can't resolve it. If you need further assistance, open an issue.

  9. Is it possible to combine CLI with scaffolding-data or metadata: meaning - Would it be possible to change the data value using CLI ?

    1. No, not currently. There isn't a remote api available for changing metadata or similar. Please open an issue and explain in more detail what you are trying to do. I doubt Confluence will provide such an API, but there is a potential for the CLI to add its own remote APIs although we try to avoided that. Unlikely to happen anytime in near future (sad).

      1. Thank you! It is now  CSOAP-225 - Getting issue details... STATUS

  10. Hello Bob,

    The command line interface can only be used by the Confluence Admin or it can be used by a normal user of the system? I am a user and I am supposed to update the documentation as part of our sprint completion. We use JUnit testing to automate some of our testing. I can export the test results by clicking a button on the IntelliJ Test Results area in html or xml format and save it in my local directory. Can I have Confluence get this attachment from my local directory every time I run the test? Can I use the Confluence CLI plugin for this purpose? if so, how?

    1. The CLI can be used by any user. You have the same permissions you would has as if you were using the UI. In your case you would use addAttachment.

  11. Thanks, Bob. So, when I drop down the menu items by clicking on my user icon and click on the Atlassian Marketplace link from our Confluence page, I see 2 add-ons: "CLI Plugin for Confluence" and "Confluence Command Line Interface" - which one of these I should ask my Admin to install, based on what I am trying to do? A little guidance will help me request for the right one and avoid too much confusion.

     

    1. What is the difference between CLI clients and CLI plugins? - this explains the difference between clients and plugins. Regarding your question, I was answering that with respect to running the specific action from a client - that you would install yourself without your admin's immediate involvement. Continued use would require a license. However, you can also have your admin install the plugin and use it to do similar things from within Confluence via a macro. So, there you need see which model fits your scenario best and then follow the appropriate path. 

  12. Thank you, that makes sense to me. Have a wonderful day! (smile)

  13. One issue came up today when I was running the command "confluence.sh --action addAttachment --space @home --title "Test Results" --file "/<file directory>" - received the following error:

    Unable to log in to server: https://<confluence.server>/rpc/soap-axis/confluenceservice-v1 with user: <username>.
     Cause: ; nested exception is:
        javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

     

    And, I have the following in the confluence.sh file "java -jar `dirname $-0`/lib/confluence-cli-3.7.0.jar --server <server name> --user <server name> --password <password> "$@""

  14. Also, please note that, all I did was download "confluence-cli-3.7.0" and put in my user directory under /Users and updated the url, user name and password for the server in the confluence.sh.

     

    1. It still has to do with your server and getting the certificates for accessing it correct.

  15. Sounds, good. Thank you. I will check the link in your reference and try again with the updates.

  16. Can CLI actions be triggered by a user logging into, or attempting to login to Confluence?

    1. No. Nor am I aware of any event trigger APIs available from Confluence.