Skip to content

Commit

Permalink
Merge pull request #181 from opentofu/fix-provider-version-prefix
Browse files Browse the repository at this point in the history
Fixing handling of unprefixed provider versions
  • Loading branch information
abstractionfactory authored Sep 5, 2024
2 parents 78cd3a4 + e3c6ac6 commit 1150a91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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

0 comments on commit 1150a91

Please sign in to comment.