Skip to content

feat(integrations): add registration display name - #146

Merged
migmartri merged 4 commits into
chainloop-dev:mainfrom
migmartri:add-name-to-registration
Jun 9, 2023
Merged

feat(integrations): add registration display name#146
migmartri merged 4 commits into
chainloop-dev:mainfrom
migmartri:add-name-to-registration

Conversation

@migmartri

@migmartri migmartri commented Jun 7, 2023

Copy link
Copy Markdown
Member

Adds an optional display name to the subscription model that can be used to differentiate different integration instances.

For example, you might perform a registration (chainloop integration add) for an integration that represents a production instance of dep-track while another one will point to staging.

This will be specially relevant when we add new integrations like webhooks in which the webhook URL by itself can not be shown back to the user (since it's a secret). Even if we do, it has no information encoded in itself that indicate its purpose.

Examples

Register integration with optional display name set.

chainloop integration add dependency-track  --instance http://localhost:8081 --allow-project-auto-create  --display-name "my production instance"

┌──────────────────────────────────────┬────────────────────────┬─────────────────┬───────────────────────────────┬─────────────────────┐
│ ID                                   │ DESCRIPTION            │ KIND            │ CONFIG                        │ CREATED AT          │
├──────────────────────────────────────┼────────────────────────┼─────────────────┼───────────────────────────────┼─────────────────────┤
│ be7d1dc6-30b4-4341-ba1a-238e424cc730 │ my production instance │ dependencytrack │ domain: http://localhost:8081 │ 08 Jun 23 18:49 UTC │
│                                      │                        │                 │ allowAutoCreate: true         │                     │
└──────────────────────────────────────┴────────────────────────┴─────────────────┴───────────────────────────────┴─────────────────────┘

The list view also adds the column.

@danlishka

Copy link
Copy Markdown
Member

That makes sense, let me know when this is ready to review

migmartri added 2 commits June 8, 2023 20:23
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
@migmartri
migmartri force-pushed the add-name-to-registration branch from 887fab5 to f47a1c5 Compare June 8, 2023 18:44
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
@migmartri migmartri changed the title feat: add registration description feat(integrations): add registration display name Jun 8, 2023
@migmartri
migmartri marked this pull request as ready for review June 8, 2023 18:50
@migmartri
migmartri requested a review from danlishka June 8, 2023 18:50
Comment thread app/cli/cmd/integration_add.go Outdated
Short: "Add integration",
}

cmd.PersistentFlags().StringVar(&integrationDisplayName, "display-name", "", "integration registration description")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is added to the parent command so it can be reused by future integrations

@danlishka danlishka Jun 9, 2023

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.

I am not sure about calling it a display name, this is a bit confusing. Why do we try to call it a displayName in the CLI and use for an integration instance description? Why not just name or description?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My reasoning is as follows, and sorry I should have given this context before.

The integration model and DB entry describes an integration registration instance and in that context, the description term makes sense, it's a description of the registration entity.

Once we move to the CLI, to the integration add/list command, the description term can be ambiguous, is this the description of the registration or from the actual extension, shown as kind (which will likely have a description in the future). To make things worse I don't think we can call this registration description because the registration term has not been introduced in the UX.

So to summarize, description makes sense once you are in a specific context (db entry) but in the UX where both registration + extension information is shown it can be ambiguous.

That said, for consistency, and so we can tackle this in the future with a broader picture I'll rename this to description as well.

Thanks!

Comment thread app/cli/cmd/integration_list.go Outdated

t := newTableWriter()
t.AppendHeader(table.Row{"ID", "Name", "Config", "Created At"})
t.AppendHeader(table.Row{"ID", "Display Name", "Kind", "Config", "Created At"})

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I renamed name for kind for consistency. I changed it to name in a previous patch but I think it was a mistake, we need to think it through.

@migmartri

Copy link
Copy Markdown
Member Author

That makes sense, let me know when this is ready to review

@danlishka go for it!

Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
@migmartri

Copy link
Copy Markdown
Member Author

@danlishka ptal, I renamed the client code displayName.

See this comment for some context so we can re-evaluate it in the future #146 (comment)

@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.

Thanks!

@migmartri
migmartri merged commit cc14230 into chainloop-dev:main Jun 9, 2023
@migmartri
migmartri deleted the add-name-to-registration branch June 9, 2023 11:00
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