Add providerURL to package definition

This commit is contained in:
Lee Briggs 2020-07-01 17:57:38 -07:00
parent 45d2fa95d6
commit f310c21b85
No known key found for this signature in database
GPG key ID: A4D09B96FDFEB505
4 changed files with 18 additions and 4 deletions

View file

@ -3,8 +3,11 @@ CHANGELOG
## HEAD (Unreleased)
- Add providerURL field to package definition
[#4947](https://github.com/pulumi/pulumi/pull/4947)
- Go program gen: Improved handling for pulumi.Map types
[#491](https://github.com/pulumi/pulumi/pull/4914)
[#4914](https://github.com/pulumi/pulumi/pull/4914)
- Go SDK: Input type interfaces should declare pointer type impls where appropriate
[#4911](https://github.com/pulumi/pulumi/pull/4911)

View file

@ -1221,7 +1221,8 @@ type npmPackage struct {
}
type npmPulumiManifest struct {
Resource bool `json:"resource,omitempty"`
Resource bool `json:"resource,omitempty"`
ProviderURL string `json:"providerURL,omitempty"`
}
func genNPMPackageMetadata(pkg *schema.Package, info NodePackageInfo) string {
@ -1253,7 +1254,8 @@ func genNPMPackageMetadata(pkg *schema.Package, info NodePackageInfo) string {
},
DevDependencies: devDependencies,
Pulumi: npmPulumiManifest{
Resource: true,
Resource: true,
ProviderURL: pkg.ProviderURL,
},
}

View file

@ -774,7 +774,11 @@ func genPackageMetadata(tool string, pkg *schema.Package, requires map[string]st
fmt.Fprintf(w, " def run(self):\n")
fmt.Fprintf(w, " install.run(self)\n")
fmt.Fprintf(w, " try:\n")
fmt.Fprintf(w, " check_call(['pulumi', 'plugin', 'install', 'resource', '%s', '${PLUGIN_VERSION}'])\n", pkg.Name)
if pkg.ProviderURL == "" {
fmt.Fprintf(w, " check_call(['pulumi', 'plugin', 'install', 'resource', '%s', '${PLUGIN_VERSION}'])\n", pkg.Name)
} else {
fmt.Fprintf(w, " check_call(['pulumi', 'plugin', 'install', 'resource', '%s', '${PLUGIN_VERSION}', '--server', '%s'])\n", pkg.Name, pkg.ProviderURL)
}
fmt.Fprintf(w, " except OSError as error:\n")
fmt.Fprintf(w, " if error.errno == errno.ENOENT:\n")
fmt.Fprintf(w, " print(\"\"\"\n")

View file

@ -303,6 +303,8 @@ type Package struct {
Repository string
// LogoURL is the URL for the package's logo, if any.
LogoURL string
// ProviderURL is the URL to use to acquire the provider binary, if any.
ProviderURL string
// Types is the list of non-resource types defined by the package.
Types []Type
@ -681,6 +683,8 @@ type PackageSpec struct {
Repository string `json:"repository,omitempty"`
// LogoURL is the URL for the package's logo, if any.
LogoURL string `json:"logoUrl,omitempty"`
// ProviderURL is the URL to use to acquire the provider binary, if any.
ProviderURL string `json:"providerURL,omitempty"`
// Meta contains information for the importer about this package.
Meta *MetadataSpec `json:"meta,omitempty"`
@ -783,6 +787,7 @@ func ImportSpec(spec PackageSpec, languages map[string]Language) (*Package, erro
License: spec.License,
Attribution: spec.Attribution,
Repository: spec.Repository,
ProviderURL: spec.ProviderURL,
Config: config,
Types: typeList,
Provider: provider,