Azure Pipelines

Native plugin directly available in the Marketplace

Setup

You can get the plugin directly from the Visual Studio Marketplace.

Prerequisites

manifest.yml file

Place the manifest.yml file containing the correct information about your project in your project repository. You can use any path you want, this is passed to the LeanIX pipeline task as an input parameter.

miCiCd-init.gradle

If you are using Gradle as a dependency manager on your project, you need to use the contents of the file mentioned below, in the root of your repository with the name 'miCiCd-init.gradle'.

initscript {
    repositories {
        maven {
            url 'https://plugins.gradle.org/m2/'
        }
    }

    dependencies {
        classpath 'com.github.jk1:gradle-license-report:1.16'
    }
}

import com.github.jk1.license.render.*

allprojects {
    rootProject.allprojects {
        apply plugin: 'java'
        apply plugin: 'maven-publish'
        apply plugin: com.github.jk1.license.LicenseReportPlugin
        licenseReport {
            // Set custom report renderer, implementing ReportRenderer.
            // Yes, you can write your own to support any format necessary.
            renderers = [new JsonReportRenderer('licenses.json')]
        }
                publishing {
            publications {
                maven(MavenPublication) {
                    groupId = 'org.gradle.sample'
                    artifactId = 'library'
                    version = '1.1'

                    from components.java
                }
            }
        }
    }
}

Secret LeanIX API token

In the “Edit”-section of your pipeline in which the LeanIX task is used, a secret must be created, the value of which is a valid LeanIX token for the host that is used in the task.

For the use of secrets in Azure DevOps pipelines see also Define variables - Azure Pipelines

Configuration

Adding the task to your Azure DevOps pipeline

If you want to add the LeanIX task to an Azure DevOps pipeline, you can either use the example pipeline code listed below or use the search field for tasks in the edit mode of your Azure DevOps pipeline. For more information on how to use tasks, see also Key concepts for new Azure Pipelines users and the related pages.

In the search field search for “LeanIX” and click on the upcoming result task. In the appearing input dialog for the task specify the input parameters according to the description of the parameters below on this page. Of course you can also use environment variables as input parameters here ( Define variables - Azure Pipelines ).

Monitoring of pipeline runs

The monitoring of the pipeline including the LeanIx task can be done in the runs overview belonging to the pipeline or for continuous monitoring you can see also Add continuous monitoring to your release pipeline- Azure Monitor .

Simple example pipeline with the LeanIX DevOps task

The input parameters used in the example are explained in more detail in the "Inputs" section.

📘

In the example below, the API token to access the LeanIX API is read from the secret variable $(apitoken) (see also Secret LeanIX API token).

trigger:
    - main
    
    pool:
      vmImage: ubuntu-latest
      
    steps:
    
    - task: [email protected]
      inputs:
        apitoken: '$(apitoken)'
        host: 'app.leanix.net'
        manifestpath: '/lx-manifest.yml'
        stage: 'test'
        version: '1.2.4'
        dependencymanager: 'NPM'
        allowfailure: true

Mandatory and optional definitions

The steps and assignments carried out in the example are necessary for the use of the LeanIX task. In addition to the input parameters of the task under “inputs:” to be set correctly, you can choose the following values ​​yourself:

  • “-task: [email protected]": By changing the version of the task after “@” you can choose which version of the LeanIX task you want to use, if more than one is available in the Visual Studio Marketplace.

Inputs

api-token

Required

The LeanIX API token for secure access to the LeanIX API on the chosen host. Use the variable you specified in the pipeline variables for it here.

host

Required

The LeanIX host where the integration is located that you want the task to connect to, e.g.: eu.leanix.net

manifest-path

Required

The path to the LeanIX manifest in your repository. Default: /lx-manifest.yml

dependency-manager

Required

Type of the dependency manager used for the project. Supported possible values: NPM, MAVEN, GRADLE, NUGET.

stage

The stage the pipeline is triggered for. Default: production

version

Required

The current version the pipeline is triggered for.

allow-failure

Flag that indicates whether the entire pipeline is allowed to continue if an error occurs in the LeanIX task. "True" means, the pipeline continues upon error in the task, "false" makes it exit with error. Default: true

📘

Capture public dependencies for Gradle and Maven

In a scenario where capturing the dependencies declared in a private repository is not possible, the plugin captures at least the dependencies that are public-facing for Gradle and Maven dependency managers.

For Gradle, ensure you have updated miCiCd-init.gradle file.

Note: This feature is not supported for other dependency managers like NPM and NUGET (Coming Soon!)


Did this page help you?