diff --git a/.ci-mgmt.yaml b/.ci-mgmt.yaml index b47849e..0c0ce4d 100644 --- a/.ci-mgmt.yaml +++ b/.ci-mgmt.yaml @@ -1,10 +1,7 @@ provider: archive major-version: 0 -lint: false providerDefaultBranch: main makeTemplate: bridged publishRegistry: false env: ARCHIVE_TOKEN: ${{ secrets.ARCHIVE_TOKEN }} -team: ecosystem - diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2df61c0..b6f527e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -182,6 +182,10 @@ jobs: s3FullURI="s3://${{ secrets.S3_COVERAGE_BUCKET_NAME }}/summaries/${summaryName}" aws s3 cp "${{ env.COVERAGE_OUTPUT_DIR }}/summary.json" "${s3FullURI}" --acl bucket-owner-full-control + lint: + name: lint + uses: ./.github/workflows/lint.yml + secrets: inherit license_check: name: License Check uses: ./.github/workflows/license.yml diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index e996750..63c4a84 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -127,6 +127,10 @@ jobs: - dotnet - go - java + lint: + name: lint + uses: ./.github/workflows/lint.yml + secrets: inherit license_check: name: License Check uses: ./.github/workflows/license.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c02048..d518445 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -126,6 +126,10 @@ jobs: - dotnet - go - java + lint: + name: lint + uses: ./.github/workflows/lint.yml + secrets: inherit license_check: name: License Check uses: ./.github/workflows/license.yml diff --git a/.github/workflows/run-acceptance-tests.yml b/.github/workflows/run-acceptance-tests.yml index f6b35a4..596fc2f 100644 --- a/.github/workflows/run-acceptance-tests.yml +++ b/.github/workflows/run-acceptance-tests.yml @@ -152,6 +152,12 @@ jobs: issue-number: ${{ github.event.client_payload.github.payload.issue.number }} repository: ${{ github.event.client_payload.github.payload.repository.full_name }} token: ${{ secrets.PULUMI_BOT_TOKEN }} + lint: + if: github.event_name == 'repository_dispatch' || + github.event.pull_request.head.repo.full_name == github.repository + name: lint + uses: ./.github/workflows/lint.yml + secrets: inherit prerequisites: if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository @@ -264,6 +270,7 @@ jobs: needs: - test - license_check + - lint runs-on: ubuntu-latest steps: - name: Workflow is not a success diff --git a/provider/cmd/pulumi-resource-archive/bridge-metadata.json b/provider/cmd/pulumi-resource-archive/bridge-metadata.json index 302f19d..246ecc4 100644 --- a/provider/cmd/pulumi-resource-archive/bridge-metadata.json +++ b/provider/cmd/pulumi-resource-archive/bridge-metadata.json @@ -27,6 +27,7 @@ } } }, + "auto-settings": {}, "renames": { "resources": { "archive:index/file:File": "archive_file" diff --git a/provider/resources.go b/provider/resources.go index cc3ee84..25d5f10 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -16,14 +16,10 @@ package provider import ( _ "embed" // Embed bridge metadata - "fmt" "path" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/x" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens" "github.com/pulumi/pulumi-archive/provider/pkg/version" ) @@ -35,32 +31,6 @@ const providerName = "archive" var pkgVersion = version.Version -// TODO: preConfigureCallback validates configuration to provide actionable errors. This is -// generally needed when the upstream provider does not provide high quality error messages. -func preConfigureCallback(vars resource.PropertyMap, c shim.ResourceConfig) error { - // stringValue := func(vars resource.PropertyMap, prop resource.PropertyKey, envs []string) (string, error) { - // val, ok := vars[prop] - // if ok && val.IsString() { - // return val.StringValue(), nil - // } - // for _, env := range envs { - // val, ok := os.LookupEnv(env) - // if ok { - // return val, nil - // } - // } - // return "", fmt.Errorf("provider configuration %s:%s and env vars %v not defined", providerName, prop, envs) - // } - - // _, err := stringValue(vars, "token", []string{"ARCHIVE_TOKEN"}) - - // if err != nil { - // return fmt.Errorf("failed to configure API token: %w", err) - // } - - return nil -} - // Provider returns additional overlaid schema and metadata associated with the provider.. func Provider() tfbridge.ProviderInfo { prov := tfbridge.ProviderInfo{ @@ -76,18 +46,8 @@ func Provider() tfbridge.ProviderInfo { // Change this to your personal name (or a company name) that you // would like to be shown in the Pulumi Registry if this package is published // there. - Publisher: "Pulumi", - // LogoURL is optional but useful to help identify your package in the Pulumi Registry - // if this package is published there. - // - // You may host a logo on a domain you control or add an SVG logo for your package - // in your repository and use the raw content URL for that file as your logo URL. - LogoURL: "", - // PluginDownloadURL is an optional URL used to download the Provider - // for use in Pulumi programs - // e.g https://github.com/org/pulumi-provider-name/releases/ - PluginDownloadURL: "", - Description: "A Pulumi package for creating and managing Archive cloud resources.", + Publisher: "Pulumi", + Description: "A Pulumi package for creating and managing Archive cloud resources.", // category/cloud tag helps with categorizing the package in the Pulumi Registry. // For all available categories, see `Keywords` in // https://www.pulumi.com/docs/guides/pulumi-packages/schema/#package. @@ -98,16 +58,6 @@ func Provider() tfbridge.ProviderInfo { // The GitHub Org hosting the upstream provider - defaults to `terraform-providers`. Note that // this should match the TF provider module's require directive, not any replace directives. GitHubOrg: "terraform-providers", - Config: map[string]*tfbridge.SchemaInfo{ - // Add any required configuration here, this provides structured docs for configuration. - // "mode": { - // Default: &tfbridge.DefaultInfo{ - // EnvVars: []string{"ARCHIVE_MODE"}, // Multiple vars can be used - // Value: "local", - // }, - // }, - }, - PreConfigureCallback: preConfigureCallback, JavaScript: &tfbridge.JavaScriptInfo{ Dependencies: map[string]string{ "@pulumi/pulumi": "^3.0.0", @@ -141,18 +91,10 @@ func Provider() tfbridge.ProviderInfo { }, } - err := x.ComputeDefaults( - &prov, - x.TokensSingleModule( - fmt.Sprintf("%s_", providerName), - "index", - x.MakeStandardToken(providerName), - ), - ) - contract.AssertNoErrorf(err, "Failed to compute defaults") + prov.MustComputeTokens(tokens.SingleModule(providerName+"_", "index", + tokens.MakeStandard(providerName))) - err = x.AutoAliasing(&prov, prov.GetMetadata()) - contract.AssertNoErrorf(err, "Failed to apply aliasing") + prov.MustApplyAutoAliases() prov.SetAutonaming(255, "-")