Configure an agent with Bitbucket access
Configuring your Moderne Agent instance with Bitbucket is a prerequisite for both viewing recipe results within the Moderne application and committing changes from a recipe.
This guide will walk you through configuring a new Application Link within your Bitbucket Server or Bitbucket Data Center instance.

Prerequisites

  • Administrator access to your BitBucket on-premise instance.

Step 1 - Generate a public and private key for Bitbucket

openssl genrsa -out bitbucket_privatekey.pem 1024
openssl req -newkey rsa:1024 -x509 -key bitbucket_privatekey.pem -out bitbucket_publickey.cer -days 365
openssl pkcs8 -topk8 -nocrypt -in bitbucket_privatekey.pem -out bitbucket_privatekey.pcks8
openssl x509 -pubkey -noout -in bitbucket_publickey.cer > bitbucket_publickey.pem
  1. 1.
    Go to the Administration page of Bitbucket
  2. 2.
    Select Application Links from the System section
  3. 3.
    Click on "Create link"
  4. 4.
    Ensure that the Application Type is set to Atlassian product (this looks weird, but this is the documented path for external applications to integrate)
  5. 5.
    Enter the the URL for your Moderne instances as the Application URL
    ​
  6. 6.
    Click Continue
  7. 7.
    Define a new Incoming Application with the following settings:
    Field
    Value
    Application Name
    Moderne
    Application Type
    Generic Application
    Service Provider Name
    moderne
    Consumer key
    OauthKey
    Request token URL
    https://your-domain.moderne.io
    Access token URL
    https://your-domain.moderne.io
    Authorize URL
    https://your-domain.moderne.io
    Create incoming link
    βœ…
  8. 8.
    Click Continue
  9. 9.
    Complete the Incoming Link configuration
    Field
    Value
    Consumer Key
    OauthKey
    Consumer Name
    Moderne
    Public Key
    Paste the public key (bitbucket_publickey.pem) from step 1
  10. 10.
    Click Continue to complete the Application Link creation

Step 3 - Configure the Moderne Agent with a Bitbucket private key

To complete the set-up of Bitbucket with the agent we will need to define the private key, bitbucket_privatekey.pcks8, we generated in Step 1 as a run-time parameter for the agent.
  1. 1.
    Open up bitbucket_privatekey.pcks8 in a text editor.
  2. 2.
    Remove the first and last line (header and footer) of the private key.
    1. 1.
      First and last lines would be: -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY-----
  3. 3.
    Remove all newline and return characters and copy the contents of the file as a single-line string.
  4. 4.
    ​Depending on how you run your Agent, you will define the run-time variables moderne.agent.bitbucket[0].private-key with the single-line private key.
Using Bash or other shells?
Quickly get a single-line instance of your private key with the key header/footer removed
cat bitbucket_privatekey.pcks8 | sed '1d;$d' | tr -d '\n'

Argument configuration

Please note that the commands and options below omit standard options documented at Standard configuration. You will need to merge the standard options into the commands documented below, which is indicated via ellipses.
OCI Container
Executable JAR
You can configure multiple bitbuckets by including multiple entries with different indices. The private key of each index must match up with the host for that index.
  • MODERNE_AGENT_BITBUCKET_{index}_PRIVATEKEY - Private key configured in previous step
  • MODERNE_AGENT_BITBUCKET_{index}_URL - fully-qualified URL of running bitbucket instance. example: https://bitbucket.org
  • MODERNE_AGENT_BITBUCKET_{index}_SKIPSSL - skip SSL validation for HTTP connections to this Bitbucket instance (defaults to false)
Example using Docker (note that host and private-key are fake):
docker run \
...
-e MODERNE_AGENT_BITBUCKET_0_PRIVATEKEY=ABCDE \
-e MODERNE_AGENT_BITBUCKET_0_URL=https://bitbucket.myorg.com \
-e MODERNE_AGENT_BITBUCKET_1_PRIVATEKEY=FGHIJ \
-e MODERNE_AGENT_BITBUCKET_1_URL=http://bitbucket2.myorg.com \
...
You can configure multiple bitbuckets by including multiple entries with different indices. The private key of each index must match up with the host for that index.
  • moderne.agent.bitbucket[{index}].private-key - Private key configured in previous step
  • moderne.agent.bitbucket[{index}].url - fully-qualified URL of running bucketbucket instance. example: https://bitbucket.org
  • moderne.agent.bitbucket[{index}].skipSsl - skip SSL validation for HTTP connections to this Bitbucket instance (defaults to false)
Note: system properties can be used in place of arguments. As an example, use -Dmoderne.agent.token={token_value} as an argument instead of --moderne.agent.token={token_value} as an argument.
Example (note that host and private-key are fake):
java -jar moderne-agent-{version}.jar \
...
--moderne.agent.bitbucket[0].private-key=ABCDE \
--moderne.agent.bitbucket[0].url=https://bitbucket.myorg.com \
--moderne.agent.bitbucket[1].private-key=FGHIJ \
--moderne.agent.bitbucket[1].url=http://bitbucket2.myorg.com \
...
Export as PDF
Copy link
On this page
Step 1 - Generate a public and private key for Bitbucket
Step 2 - Create an Application Link in Bitbucket
Step 3 - Configure the Moderne Agent with a Bitbucket private key
Argument configuration