Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to display multiple repositories #219

Open
nanjingfm opened this issue Mar 15, 2023 · 4 comments
Open

how to display multiple repositories #219

nanjingfm opened this issue Mar 15, 2023 · 4 comments

Comments

@nanjingfm
Copy link
Contributor

If a component builds multiple images and pushes them to different repositories, such as project/aaa and project/bbb, is there a way to display the information of these two repositories on the entity page at the same time?

@Vad1mo
Copy link
Collaborator

Vad1mo commented Mar 15, 2023

hmm not aware of. But this is a good use case.

@nanjingfm
Copy link
Contributor Author

I intend to support this scenario and have written a technical design document.

Looking forward to anyone's feedback! 😁


Scene Description

Consider some business scenarios where a component may be associated with multiple harbor repositories, e.g:

  1. Monorepo project, which may build multiple images, such as frontend and backend.
  2. (artifact promotion)The image in the test environment may be pushed to a test harbor instance, and after verification, it will be promoted to the production environment harbor instance.

To meet the above scenario, two things need to be supported:

  1. The backend plugin supports configuration of multiple harbor instances
  2. Entity annotation supports association with multiple harbor repositories, and the UI can display multiple repositories.

Technical Design

Configuration

Config Item Description Required Example
harbor.baseUrl The address of harbor instance. If multiple instances (harbor.instances) are configured and the entity annotation does not specify a host, then this value will be used as the default No https://harbor.yourdomain.com
harbor.username The username of the harbor instance No admin
harbor.password The password of the harbor No admin
harbor.instances[].host The address of the harbor instance, if empty it will take the host part of harbor.baseUrl No harbor.yourdomain.com
harbor.instances[].username The username of the harbor instance
If empty harbor.username will be used
No admin
harbor.instances[].password The Password of the harbor instance
If empty harbor.password will be used
No admin
harbor.instances[].apiBaseUrl The address of harbor instance.
If empty, https://${harbor.instances[].host} will be used as the default value
No https://harbor.yourdomain.com

Note: harbor.baseUrlharbor.username and harbor.password are old configurations, which are made optional here for compatibility.

Example:

harbor:
  baseUrl: https://harbor.yourdomain.com
  username: ""
  password: ""
  instances:
    - host: harbor.yourdomain.com
      username: ""
      password: ""
      apiBaseUrl: https://harbor.yourdomain.com

Configuration Compatibility

Multi-instance support will be compatible with existing configurations and the existed configurations will be automatically converted to multi-instance configurations. The conversion rules are as follows:

  1. harbor.baseUrl(host part) => harbor.instances[].host
  2. harbor.username => harbor.instances[].username
  3. harbor.password => harbor.instances[].password
  4. harbor.baseUrl => harbor.instances[].apiBaseUrl

Original configuration:

harbor:
  baseUrl: https://harbor.yourdomain.com
  username: "aaa"
  password: "bbb"

Configuration after conversion:

harbor:
  instances:
    - host: harbor.yourdomain.com
      username: "aaa"
      password: "bbb"
      baseUrl: https://harbor.yourdomain.com

Annotation

Reuse the goharbor.io/repository-slug annotation to associate harbor projects, with the difference being that it supports writing a full repository address, e.g:

# before
goharbor.io/repository-slug: my-project/my-repo

# after
goharbor.io/repository-slug: harbor.yourdomain.com/my-project/my-repo

The domain name part (harbor.yourdomain.com) needs to be consistent with harbor.instances[].host in the configuration file.

Configuration Compatibility

If no host is specified in the entity annotation, then the host part of harbor.baseUrl will be used as the default, and if harbor.baseUrl is also not configured, then the first instance defined in harbor.instances will be used as the default.

Entity supports association of multiple repositories

If an entity is associated with multiple harbor items, they can be separated by commas, e.g:

  1. Default harbor instances, multiple repositories
goharbor.io/repository-slug: my-project/my-repo, my-project/my-repo2
  1. Non-default harbor instances, multiple repositories
goharbor.io/repository-slug: dev.example.com/my-project/my-repo, dev.example.com/my-project/my-repo2
  1. Multiple harbor instances, multiple repositories
goharbor.io/repository-slug: dev.example.com/my-project/my-repo, prod.example.com/my-project/my-repo

UI Display

Repository Widget

If the entity is associated with more than one harbor repository, a dropdown box is added to the top right corner of the widget. If the entity is associated with only one harbor repository, then the dropdown box will not be displayed.

image

Repository Table

If the entity is associated with more than one harbor repository, multiple tables will be displayed, each corresponding to one harbor repository.

@Vad1mo
Copy link
Collaborator

Vad1mo commented Apr 24, 2023

makes sense,
would you mind making a few mock up screens of what it would look like in backstage?

@KatharinaSick
Copy link
Contributor

Hi,

I would start working on that if that's fine? 🙂 About the UI mockup - I think it's pretty well described in the "UI Display" section above but I could of course create additional mockups if you want.

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

No branches or pull requests

3 participants