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

Fixing handling of unprefixed provider versions #181

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/go-enry/go-license-detector/v4 v4.3.1
github.com/lib/pq v1.10.9
github.com/mitchellh/go-spdx v0.1.0
github.com/opentofu/libregistry v0.0.0-20240902143137-5bc965332079
github.com/opentofu/libregistry v0.0.0-20240905103355-13386c198ea1
github.com/opentofu/tofudl v0.0.0-20240730151408-3bd8529dae09
github.com/opentofu/tofutestutils v0.0.0-20240821111804-5fcfb797e0a7
golang.org/x/sync v0.8.0
Expand Down
2 changes: 2 additions & 0 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ github.com/opentofu/libregistry v0.0.0-20240902140652-883944ac1490 h1:GrgjoNMwx1
github.com/opentofu/libregistry v0.0.0-20240902140652-883944ac1490/go.mod h1:irS/XyfQZdwi3Ggm105FfDyj3d9deFAi5GraORIeMsI=
github.com/opentofu/libregistry v0.0.0-20240902143137-5bc965332079 h1:GdkIdGChrfnE4C/HkDsnffddAm3Qd4pms1gO/sf1GJ4=
github.com/opentofu/libregistry v0.0.0-20240902143137-5bc965332079/go.mod h1:irS/XyfQZdwi3Ggm105FfDyj3d9deFAi5GraORIeMsI=
github.com/opentofu/libregistry v0.0.0-20240905103355-13386c198ea1 h1:1+kxZxlnYwakDxdHf90YdaLwd9F+MBuY/70lIRmT2pA=
github.com/opentofu/libregistry v0.0.0-20240905103355-13386c198ea1/go.mod h1:irS/XyfQZdwi3Ggm105FfDyj3d9deFAi5GraORIeMsI=
github.com/opentofu/registry-address v0.0.0-20230922120653-901b9ae4061a h1:NyM/PPbc+kxxv2d4OKfE32C5fLtVTLceyg4YKKCYO9Y=
github.com/opentofu/registry-address v0.0.0-20230922120653-901b9ae4061a/go.mod h1:HzQhpVo/NJnGmN+7FPECCVCA5ijU7AUcvf39enBKYOc=
github.com/opentofu/tofudl v0.0.0-20240730151408-3bd8529dae09 h1:bA3Dy3Be9o896wdcQhK0Ky2Eco0ZwCWZgt73dSaYuDI=
Expand Down
6 changes: 4 additions & 2 deletions backend/internal/providerindex/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,18 @@ func (d *documentationGenerator) scrapeProvider(ctx context.Context, addr provid
}

func (d *documentationGenerator) scrapeVersion(ctx context.Context, addr providertypes.ProviderAddr, canonicalAddr provider.Addr, version provider.Version, blocked bool, blockedReason string) (providertypes.ProviderVersion, error) {
// We get the VCS version before normalizing as the tag name may be different.
vcsVersion := version.Version.ToVCSVersion()
version.Version = version.Version.Normalize()
d.log.Info(ctx, "Scraping documentation for %s version %s...", addr, version.Version)

// TODO get the release date instead of the tag date
tag, err := d.vcsClient.GetTagVersion(ctx, canonicalAddr.ToRepositoryAddr(), version.Version.ToVCSVersion())
tag, err := d.vcsClient.GetTagVersion(ctx, canonicalAddr.ToRepositoryAddr(), vcsVersion)
if err != nil {
return providertypes.ProviderVersion{}, err
}

workingCopy, err := d.vcsClient.Checkout(ctx, canonicalAddr.ToRepositoryAddr(), version.Version.ToVCSVersion())
workingCopy, err := d.vcsClient.Checkout(ctx, canonicalAddr.ToRepositoryAddr(), vcsVersion)
if err != nil {
return providertypes.ProviderVersion{}, err
}
Expand Down
Loading