Configure Moderne DX with Artifactory access: LSTs

Artifactory serves as a source of LST artifacts. This integration uses Artifactory Query Language (AQL) to identify LST artifacts.

This guide will walk you through how to configure the Moderne DX service to connect to your Artifactory instance to retrieve the list LST artifacts.

If you're wanting to configure Artifactory to support recipe artifacts, please see this guide instead.

Prerequisites

  • You will need a username and password for an Artifactory user that is allowed to issue the relevant AQL queries that will be configured

Configuring the Moderne DX service

The following table contains all of the variables/arguments you need to add to your Moderne DX service run command in order for it to get LST artifacts from your Artifactory instance. Please note that these variables/arguments must be combined with ones found in other steps in the Configuring the Moderne DX service guide.

You can configure multiple Artifactory servers by including multiple entries, each with a different {index}. Within a given Artifactory server configuration, you can configure multiple LST query filters by including multiple entries, each with a different {index}.

Variables:

  • MODERNE_DX_ARTIFACTORY_{index}_URLThe URL of your Artifactory instance.

  • MODERNE_DX_ARTIFACTORY_{index}_USERNAMEThe username used to connect to your Artifactory instance. This user must have permission to run AQL queries.

  • MODERNE_DX_ARTIFACTORY_{index}_PASSWORDThe password used to connect to your Artifactory instance.

  • MODERNE_DX_ARTIFACTORY_{index}_ASTQUERYFILTERS_{index}The AQL query fragment used to select LST artifacts to send to Moderne. If multiple are specified, they are combined together with an AND.

  • MODERNE_DX_ARTIFACTORY_{index}_SKIPSSL(Optional) Specifies whether or not to skip SSL verification for HTTP connections from the service to this Artifactory instance. This must be set to true if you use a self-signed SSL/TLS certificate. Defaults to false.

  • MODERNE_DX_ARTIFACTORY_{index}_SKIPVALIDATECONNECTIVITY(Optional) By default, on startup dx we validate that it can connect to the configured resource, and fail to start up the dx if we cannot. Set this to true to skip this validation. Defaults to false.

  • MODERNE_DX_ARTIFACTSYNC_SINCE(Optional) Specifies how long in the past to sync your artifacts. Defaults to syncing all time. It is recommended to set a start date of the sync or it will try to search your entire artifactory.

Example:

docker run \
# ... Existing variables
-e MODERNE_DX_ARTIFACTORY_0_URL=https://myartifactory.example.com/artifactory/ \
-e MODERNE_DX_ARTIFACTORY_0_USERNAME=admin \
-e MODERNE_DX_ARTIFACTORY_0_PASSWORD=password \
-e MODERNE_DX_ARTIFACTORY_0_ASTQUERYFILTERS_0='"name":{"$match":"*-ast.jar"}' \
-e MODERNE_DX_ARTIFACTORY_0_ASTQUERYFILTERS_1='"repo":{"$eq":"example-maven"}' \
-e MODERNE_DX_ARTIFACTSYNC_SINCE=2024-01-01T00:00:00Z
# ... Additional variables

Confirming it works

After starting up Moderne DX, it will then ask your artifact repository for LST artifacts. This process can take several minutes. You can test it worked by making a curl command to https://<moderne-dx-url>/graphql with the following query:

query orgs {
  organizations {
    id
    repositoriesPages {
      count
      edges {
        node {
          origin
          path
          branch
        }
      }
    }
    parent {
      id
    }
  }
}

Here's an example of what this call might look like:

curl -X POST -H "Content-Type: application/json" -d '{"query":"query orgs { organizations { id repositoriesPages { count edges { node { origin path branch } } } parent { id } } }"}' https://<moderne-dx-url>/graphql

If you run this immediately after startup, you may get no results. Once your index operation is completed, you will get results similar to the following:

{
  "data": {
    "organizations": [
      {
        "id": "All",
        "name": "All",
        "repositoriesPages": {
          "count": 2,
          "edges": [
            {
              "node": {
                "origin": "github.com",
                "path": "organization/repository1",
                "branch": "main"
              }
            },
            {
              "node": {
                "origin": "github.com",
                "path": "organization/repository2",
                "branch": "main"
              }
            }
          ]
        }
      }
    ]
  }
}

Note that if you set up an organizations service, the returned results from this query will be organized into organizations rather than repositories.

Last updated