Skip to content

CI Pipelines

Sending data to Metaport using an agent is not recommended in CI pipelines because of the transient environments they run in. Unless you and your team has specifically designed its CI pipelines appropriately, the data is unlikely to be representative of an actual production environment.

In Metaport, larger software components - typically associated with end-of-life dates - are known as "Components". Examples might be Nginx, Laravel, or Postgresql. By default Metaport will attempt to query its own database for component records which are periodically fetched from 3rd parties and will match them against incoming agent data. However, Metaport is also capable of iterogating version control systems (VCS) such github and gitlab for components declared in Terraform files and Helm charts.

CI/CD pipelines are the ideal means to trigger this mechanism, but since agents are not used in this context, a qualifying payload is required instead which authenticates and authorizes a pipeline to "report in".

curl -X PUT \
  -H "User-Agent: metaport-ci" \
  -H "Content-Type: application/json"
  -H "Authorization: Basic <token>" \
  -d @./<payload>.json https://<metaport_host>/api/v1/app

Where the JSON payload has the following structure:

{
  "format": "MetaportIngest",
  "version": "1.0",
  "data": {
    "identifier": "c8a96227-3460-48cb-8a86-34a4b5c3283a",
    "environment": "PROD",
    "domain": "my-app.xyz",
    "stack":"PHP/Composer",
    "version": "1.2.3",
    "source": "CI"
  }
}

Tip

Model your own CI jobs on this example Github Workflow.

Tip

You can obtain each individual setting or entire JSON blob into your computer's clipboard using the "Developer Export" found in each application's "Settings" area. You can also download the Developer Export as a file which just contains the individual values.

Setup

Navigate to: Settings > EOL Source Settings:

Warning

Github and Gitlab API tokens need to be appropriately scoped with api and read permissions. We recommend you do not provide them with destructive permissions such as write or delete.

Metaport/Agent

No further configuration is necessary as Agent is the system-wide default. In this mode, data is received from an agent.

Terraform

Metaport will use the configured version control system (VCS) e.g. Github to interrogate a repository for any file named with a .tf extension.

  • Ingestion Source field: Select "Terraform"
  • Version control system (VCS) field: Select your VCS e.g. "Github"
  • Repository identifier field: Use the repository's name e.g. myorg/myproject or an identifier or a complete URL (for internally hosted repositories)
  • API Key or Token field: Use an appropriately scoped personal access token generated in the selected VCS

Helm

Metaport will use the configured version control system (VCS) e.g. Github to interrogate a repository for Chart.yml|.yaml and values.yml|.yaml files.

  • Ingestion System field: Select "Helm"
  • Version control system (VCS) field: Select your VCS e.g. "Github"
  • Repository identifier field: Use the repository's name e.g. myorg/myproject or an identifier or a complete URL (for internally hosted repositories)
  • API Key or Token field: Use an appropriately scoped personal access token generated in the selected VCS