Skip to content

feat!: Use artifactory catalog - #377

Open
yejseo01 wants to merge 9 commits into
mainfrom
use-artifactory-catalog
Open

feat!: Use artifactory catalog#377
yejseo01 wants to merge 9 commits into
mainfrom
use-artifactory-catalog

Conversation

@yejseo01

@yejseo01 yejseo01 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Loads the catalog and schema from Artifactory.
  • Removes the embedded catalog and builtin source.
  • Makes --source always available.
  • Adds shared HTTP fetching for catalog, install, upgrade, and version checks.
  • Fixes the --source registration panic.
  • Adds fetcher tests.

Checklist

  • 🤖 This change is covered by tests as required.
  • 🤹 All required manual testing has been performed.
  • 📖 All documentation updates are complete.

@yejseo01
yejseo01 requested a review from a team as a code owner July 27, 2026 17:07
Comment thread internal/fetch/fetch.go Outdated
Comment thread internal/fetch/fetch.go
return nil, fmt.Errorf("sending request: %w", err)
}

if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not != http.StatusOK?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

well, since we are trying to make it generic, I thought we might want to accept 204 No Content and 206 Partial Content, and the caller would handle such. Can stick to != http.StatusOK if you think that's better?

Comment thread internal/catalog/catalog.go Outdated
Comment thread internal/fetch/fetch.go Outdated
Comment thread cmd/topo/projects.go Outdated
Comment thread internal/catalog/catalog.go Outdated
@muchzill4

Copy link
Copy Markdown
Contributor

Is fix a good category for this? It’s not fixing a bug.

@yejseo01 yejseo01 changed the title fix!: Use artifactory catalog feat!: Use artifactory catalog Jul 28, 2026
Comment thread internal/catalog/catalog.go Outdated
const (
DefaultURL = "https://artifacts.tools.arm.com/devx-topo-project-catalog/" + version + "/catalog/"
DefaultCatalogURL = DefaultURL + "catalog.json"
DefaultSchemaURL = DefaultURL + "catalog.schema.json"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It feels a little unfortunate to download the schema for artifactory every time for every type of source. It means even users who use file:// sources require a network connection + slows the command down to download a static file every time.

Maybe fine for a v1 but wonder if we should consider downloading + embedding the schema version that the CLI supports into the binary? Especially since the catalogDocument type is a mirror of the schema.


Bonus - wonder if we should generate go types based on the schema?!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Come to think of it, you’re right @awphi, this is a bit wasteful. I wonder if generating types based on the schema would be better. We could also do a pre-flight check of the $schema field in the received catalog - if it matches our expectation.

@yejseo01 yejseo01 Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea I was thinking this on the way back home. For Bartek's suggestion, I'm not sure how that would alleviate user with file:// source from needing network connection? I think to address that, we have no choice but to keep the schema in the same repository

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Another thing we can try is to fetch the schema on release of topo, and embed that in the binary on release

@yejseo01
yejseo01 force-pushed the use-artifactory-catalog branch from ed774fc to 5b3f922 Compare July 29, 2026 13:59
@yejseo01

Copy link
Copy Markdown
Contributor Author

for error messages to precisely compare the versions, this PR needs to be merged first to continue - arm/topo-project-catalog#8

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.

3 participants