Skip to content

feat(cli): list/describe available integrations - #154

Merged
migmartri merged 4 commits into
chainloop-dev:mainfrom
migmartri:available-list
Jun 13, 2023
Merged

feat(cli): list/describe available integrations#154
migmartri merged 4 commits into
chainloop-dev:mainfrom
migmartri:available-list

Conversation

@migmartri

@migmartri migmartri commented Jun 13, 2023

Copy link
Copy Markdown
Member

List and describe the available integrations loaded in the controlplane.

NOTE: the jsonschema parser should be considered a first version. For example, it does not support nested schemas, which in fact we should prevent in the SDK itself. Or it does not show oneofs. This will get fixed in a future patch.

$ go run main.go --insecure integration available ls                      
┌─────────────────┬─────────┐
│ ID              │ VERSION │
├─────────────────┼─────────┤
│ dependencytrack │ 1.0     │
└─────────────────┴─────────┘

Describe has two modes, a default mode that's meant for the user to udnerstand the inputs outputs

┌─────────────────┬─────────┐
│ ID              │ VERSION │
├─────────────────┼─────────┤
│ dependencytrack │ 1.0     │
└─────────────────┴─────────┘
┌─────────────────────────────────────────────────────────────────────────────────┐
│ Registration inputs                                                             │
├─────────────────┬─────────┬──────────┬──────────────────────────────────────────┤
│ FIELD           │ TYPE    │ REQUIRED │ DESCRIPTION                              │
├─────────────────┼─────────┼──────────┼──────────────────────────────────────────┤
│ instanceURI     │ string  │ true     │ The URL of the Dependency-Track instance │
│ apiKey          │ string  │ true     │ The API key to use for authentication    │
│ allowAutoCreate │ boolean │ false    │ Support of creating projects on demand   │
└─────────────────┴─────────┴──────────┴──────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────────────────────────────┐
│ Attachment inputs                                                                         │
├─────────────┬────────┬──────────┬─────────────────────────────────────────────────────────┤
│ FIELD       │ TYPE   │ REQUIRED │ DESCRIPTION                                             │
├─────────────┼────────┼──────────┼─────────────────────────────────────────────────────────┤
│ projectID   │ string │ false    │ The ID of the existing project to send the SBOMs to     │
│ projectName │ string │ false    │ The name of the project to create and send the SBOMs to │
└─────────────┴────────┴──────────┴─────────────────────────────────────────────────────────┘

and a more advanced mode enabled with --full

┌─────────────────┬─────────┐
│ ID              │ VERSION │
├─────────────────┼─────────┤
│ dependencytrack │ 1.0     │
└─────────────────┴─────────┘
┌─────────────────────────────────────────────────────────────────────────────────┐
│ Registration inputs                                                             │
├─────────────────┬─────────┬──────────┬──────────────────────────────────────────┤
│ FIELD           │ TYPE    │ REQUIRED │ DESCRIPTION                              │
├─────────────────┼─────────┼──────────┼──────────────────────────────────────────┤
│ apiKey          │ string  │ true     │ The API key to use for authentication    │
│ allowAutoCreate │ boolean │ false    │ Support of creating projects on demand   │
│ instanceURI     │ string  │ true     │ The URL of the Dependency-Track instance │
└─────────────────┴─────────┴──────────┴──────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Registration JSON schema                                                                                                        │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ {                                                                                                                               │
│   "$schema": "https://json-schema.org/draft/2020-12/schema",                                                                    │
│   "$id": "https://github.com/chainloop-dev/chainloop/app/controlplane/extensions/core/dependencytrack/v1/registration-request", │
│   "$ref": "#/$defs/registrationRequest",                                                                                        │
│   "$defs": {                                                                                                                    │
│     "registrationRequest": {                                                                                                    │
│       "properties": {                                                                                                           │
│         "instanceURI": {                                                                                                        │
│           "type": "string",                                                                                                     │
│           "format": "uri",                                                                                                      │
│           "description": "The URL of the Dependency-Track instance"                                                             │
│         },                                                                                                                      │
│         "apiKey": {                                                                                                             │
│           "type": "string",                                                                                                     │
│           "description": "The API key to use for authentication"                                                                │
│         },                                                                                                                      │
│         "allowAutoCreate": {                                                                                                    │
│           "type": "boolean",                                                                                                    │
│           "description": "Support of creating projects on demand"                                                               │
│         }                                                                                                                       │
│       },                                                                                                                        │
│       "additionalProperties": false,                                                                                            │
│       "type": "object",                                                                                                         │
│       "required": [                                                                                                             │
│         "instanceURI",                                                                                                          │
│         "apiKey"                                                                                                                │
│       ]                                                                                                                         │
│     }                                                                                                                           │
│   }                                                                                                                             │
│ }                                                                                                                               │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────────────────────────────┐
│ Attachment inputs                                                                         │
├─────────────┬────────┬──────────┬─────────────────────────────────────────────────────────┤
│ FIELD       │ TYPE   │ REQUIRED │ DESCRIPTION                                             │
├─────────────┼────────┼──────────┼─────────────────────────────────────────────────────────┤
│ projectID   │ string │ false    │ The ID of the existing project to send the SBOMs to     │
│ projectName │ string │ false    │ The name of the project to create and send the SBOMs to │
└─────────────┴────────┴──────────┴─────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Attachment JSON schema                                                                                                        │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ {                                                                                                                             │
│   "$schema": "https://json-schema.org/draft/2020-12/schema",                                                                  │
│   "$id": "https://github.com/chainloop-dev/chainloop/app/controlplane/extensions/core/dependencytrack/v1/attachment-request", │
│   "$ref": "#/$defs/attachmentRequest",                                                                                        │
│   "$defs": {                                                                                                                  │
│     "attachmentRequest": {                                                                                                    │
│       "oneOf": [                                                                                                              │
│         {                                                                                                                     │
│           "required": [                                                                                                       │
│             "projectID"                                                                                                       │
│           ],                                                                                                                  │
│           "title": "projectID"                                                                                                │
│         },                                                                                                                    │
│         {                                                                                                                     │
│           "required": [                                                                                                       │
│             "projectName"                                                                                                     │
│           ],                                                                                                                  │
│           "title": "projectName"                                                                                              │
│         }                                                                                                                     │
│       ],                                                                                                                      │
│       "properties": {                                                                                                         │
│         "projectID": {                                                                                                        │
│           "type": "string",                                                                                                   │
│           "minLength": 1,                                                                                                     │
│           "description": "The ID of the existing project to send the SBOMs to"                                                │
│         },                                                                                                                    │
│         "projectName": {                                                                                                      │
│           "type": "string",                                                                                                   │
│           "minLength": 1,                                                                                                     │
│           "description": "The name of the project to create and send the SBOMs to"                                            │
│         }                                                                                                                     │
│       },                                                                                                                      │
│       "additionalProperties": false,                                                                                          │
│       "type": "object"                                                                                                        │
│     }                                                                                                                         │
│   }                                                                                                                           │
│ }                                                                                                                             │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘


Refs #38 

Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
@migmartri
migmartri requested a review from danlishka June 13, 2023 12:27
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
@migmartri
migmartri requested a review from danlishka June 13, 2023 14:32

@danlishka danlishka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@migmartri
migmartri merged commit 2ae0e82 into chainloop-dev:main Jun 13, 2023
@migmartri
migmartri deleted the available-list branch June 13, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants