Skip to content

feat!: Use artifactory catalog - #377

Merged
yejseo01 merged 21 commits into
mainfrom
use-artifactory-catalog
Aug 5, 2026
Merged

feat!: Use artifactory catalog#377
yejseo01 merged 21 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 Outdated
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?

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.

How would caller handle them right now?

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.

right now, they just check != http.StatusOK. Maybe you're right, and we won't need it. Will fix it to != 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.

done - 09ac673

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

@awphi awphi left a comment

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.

Nice! Have approved arm/topo-project-catalog#8 so we can add the major version check.

Comment thread internal/catalog/catalog.go Outdated
Comment thread internal/fetch/fetch.go
Comment thread docs/development/DEVELOPMENT.md
Comment thread docs/development/DEVELOPMENT.md Outdated
Comment thread scripts/generate_catalog_types/main.go Outdated
Comment thread scripts/generate_catalog_types/main.go Outdated
Comment thread scripts/generate_catalog_types/main.go Outdated
Comment thread internal/catalog/catalog_schema_generated.go

@awphi awphi left a comment

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.

Nice! One implementation question and one error message nit!

Comment thread internal/catalog/catalog.go
Comment thread internal/catalog/catalog.go Outdated

@awphi awphi left a comment

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.

Couple more nits but nothing to block over (though please fix the variable casing!)

Comment thread internal/catalog/catalog.go Outdated
return nil, fmt.Errorf("failed schema validation: %w", err)
catalogVersion, versionErr := unmarshalCatalogVersion(b)
catalogVersionMajor := majorVersion(catalogVersion)
SchemaVersionMajor := majorVersion(CatalogSchemaVersion)

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.

Suggested change
SchemaVersionMajor := majorVersion(CatalogSchemaVersion)
schemaVersionMajor := majorVersion(CatalogSchemaVersion)

Alternatively, could add a var majorCatalogVersion = majorVersion(CatalogSchemaVersion) at the top and re-use in the defaultURL to avoid repeating. This isn't a blocker though

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.

done - f0a3cc0

Comment thread internal/catalog/catalog_test.go Outdated
assert.ErrorContains(t, err, `requested catalog version "" is incompatible`)
})

t.Run("reports catalog and schema versions when incompatible catalog fails to unmarshal", func(t *testing.T) {

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.

Suggested change
t.Run("reports catalog and schema versions when incompatible catalog fails to unmarshal", func(t *testing.T) {
t.Run("reports incompatible catalog", func(t *testing.T) {

Test name isn't overly verbose and wrong atm since it doesn't only report when unmarshaling fails

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.

done - f0a3cc0

@yejseo01
yejseo01 dismissed muchzill4’s stale review August 5, 2026 09:59

change applied

@yejseo01
yejseo01 merged commit 31f3303 into main Aug 5, 2026
5 checks passed
@yejseo01
yejseo01 deleted the use-artifactory-catalog branch August 5, 2026 10:41
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