Tutorial: Include OSS licenses

Load information about software licenses via an extension for the CI/CD pipeline integration

Overview

With this custom processor license information gathered by the out-of-the-box CI/CD integration can be processed into a new Fact Sheet type and set into relation to the rest of your development landscape. This allows a detailed view on which licenses are in use and by which Software Artifact and Library.

1822

Setup

🚧

BEFORE TESTING THE PROCESSOR

This integration requires a new Fact Sheet type and relations, which cannot be set up in customer facing self-service today. Please get in touch with your LeanIX contact, the chatbot or via [email protected] to arrange the setup.

To set up the rest of the integration, add the below processor to your workspace under Administration > Integration API > Create New Processor. The out-of-the-box CI/CD integration will trigger it with each of its runs. For a simple test of the data, you can manually trigger the processor with the sample data provided below.

1822
{
    "processors": [
        {
            "processorType": "inboundFactSheet",
            "type": "License",
            "filter": {
                "advanced": "${content.type == 'dependency'}"
            },
            "identifier": {
                "external": {
                    "id": {
                        "expr": "${data.license}"
                    },
                    "type": {
                        "expr": "cicdId"
                    }
                }
            },
            "run": 105,
            "updates": [
                {
                    "key": {
                        "expr": "name"
                    },
                    "values": [
                        {
                            "expr": "${data.license}"
                        }
                    ]
                },
                {
                        "key": {
                            "expr": "approvalStatus"
                        },
                        "values": [
                            {
                                "expr": "${lx.factsheet.approvalStatus}"
                            },
                            {
                                "expr": "Approval Pending"
                            }
                        ]
                    }
                ],
                "read": {
                    "fields": ["approvalStatus"]
                }
        },
        {
            "processorType": "inboundRelation",
            "processorName": "Rel from License to Library",
            "processorDescription": "Creates LeanIX Relations between the created or updated Licenses and Libaries",
            "type": "relLibraryToLicense",
            "filter": {
                "advanced": "${content.type == 'dependency'}"
            },
            "from": {
                "external": {
                    "id": {
                        "expr": "${content.id}"
                    },
                    "type": {
                        "expr": "cicdId"
                    }
                }
            },
            "to": {
                "external": {
                    "id": {
                        "expr": "${data.license}"
                    },
                    "type": {
                        "expr": "cicdId"
                    }
                }
            },
            "run": 106,
            "logLevel": "debug"
        },
        {
            "processorType": "inboundRelation",
            "processorName": "Rel from License to Software Artifact",
            "processorDescription": "Creates LeanIX Relations between the created or updated Licenses and SAs",
            "type": "relMicroserviceToLicense",
            "filter": {
                "advanced": "${content.type == 'service' || content.type == 'dependency'}"
            },
            "from": {
                "external": {
                    "id": {
                        "expr": "${header.customFields.microserviceId}"
                    },
                    "type": {
                        "expr": "cicdId"
                    }
                }
            },
            "to": {
                "external": {
                    "id": {
                        "expr": "${data.license}"
                    },
                    "type": {
                        "expr": "cicdId"
                    }
                }
            },
            "run": 107,
            "logLevel": "debug"
        }
    ],
    "variables": {},
    "executionGroups": [
        "vsmCiCd"
    ]
}
{
    "content": [
        {
            "id": "cider",
            "type": "service",
            "data": {
                "name": "cider",
                "description": "test",
                "owner": "[email protected]",
                "self": "http://test.github.com",
                "links": [
                    {
                        "name": "api-resource",
                        "url": "http://something.resource.com"
                    }
                ],
                "tags": [
                    {
                        "tagGroup": "envirnoment",
                        "tagName": "staging"
                    }
                ],
                "lifecycle": {
                  "planned": "2021-11-01",
                  "earlyAccess": "2021-11-02",
                  "generalAvailability": "2021-11-03",
                  "deprecated": "2021-11-04",
                  "unsupported": "2021-11-05"
                },
                "custom": {
                    "some-additional": "some-value"
                }
            }
        },
        {
            "type": "deployment",
            "id": "cider/production/1.3.3",
            "data": {
                "version": "1.3.3",
                "timestamp": "2021-02-08T08:21:59.498Z”,
                “microserviceId”: "cider”,
                “stage”: "production"
            }
        },
        {
            "type": "dependency",
            "id": "eslint/eslint/5.5.0",
            "data": {
                "owner": "eslint",
                "name": "eslint",
                "version": "5.5.0",
                "url": "https://github.com/eslint/eslint",
                "microserviceId": "cider",
                "deploymentId": "cider/production/1.3.3",
                "dependencyManager": "NPM",
                "license": "MIT OR Apache 2.0"
            }
        }
    ],
    "customFields": {
        "microserviceId": "cider",
        "deploymentStage": "production"
    },
    "connectorType": "leanix-cicd",
    "lxVersion": "1.0.0",
    "connectorId": "leanix-continuous-integration-connector",
    "description": "",
    "processingDirection": "inbound",
    "processingMode": "full"
}