Compare commits
3 commits
master
...
evan/skipI
Author | SHA1 | Date | |
---|---|---|---|
|
9c4d67d50a | ||
|
5664332d0a | ||
|
be0ebf4ba7 |
|
@ -5,6 +5,9 @@
|
|||
|
||||
### Bug Fixes
|
||||
|
||||
- [cli] - Respect provider aliases
|
||||
[#7166](https://github.com/pulumi/pulumi/pull/7166)
|
||||
|
||||
- [cli] - Send plugin install output to stderr, so that it doesn't
|
||||
clutter up --json, automation API scenarios, and so on.
|
||||
[#7115](https://github.com/pulumi/pulumi/pull/7115)
|
||||
|
|
|
@ -254,6 +254,18 @@ func (r *Registry) Check(urn resource.URN, olds, news resource.PropertyMap,
|
|||
return inputs, nil, nil
|
||||
}
|
||||
|
||||
// RegisterAliases takes the computed alias map, and updates the registry such that the new URNSs
|
||||
// point to the alised providers
|
||||
func (r *Registry) RegisterAliases(aliases map[resource.URN]resource.URN) {
|
||||
for prev, new := range aliases {
|
||||
for ref, prov := range r.providers {
|
||||
if ref.urn == prev {
|
||||
r.setProvider(mustNewReference(new, ref.id), prov)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Diff diffs the configuration of the indicated provider. The provider corresponding to the given URN must have
|
||||
// previously been loaded by a call to Check.
|
||||
func (r *Registry) Diff(urn resource.URN, id resource.ID, olds, news resource.PropertyMap,
|
||||
|
|
|
@ -317,6 +317,55 @@ func TestNewRegistryOldState(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestRegistryAliases(t *testing.T) {
|
||||
old := newProviderState("pkgA", "a", "id1", false, nil)
|
||||
olds := []*resource.State{
|
||||
old,
|
||||
}
|
||||
loaders := []*providerLoader{
|
||||
newSimpleLoader(t, "pkgA", "", nil),
|
||||
}
|
||||
host := newPluginHost(t, loaders)
|
||||
|
||||
r, err := NewRegistry(host, olds, false, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, r)
|
||||
|
||||
assert.Equal(t, len(olds), len(r.providers))
|
||||
|
||||
alias := newProviderState("pkgA", "alias", "id1", false, nil)
|
||||
aliases := map[resource.URN]resource.URN{
|
||||
old.URN: alias.URN,
|
||||
}
|
||||
|
||||
r.RegisterAliases(aliases)
|
||||
|
||||
all := []*resource.State{
|
||||
old, alias,
|
||||
}
|
||||
|
||||
for _, old := range all {
|
||||
ref, err := NewReference(old.URN, old.ID)
|
||||
assert.NoError(t, err)
|
||||
|
||||
p, ok := r.GetProvider(ref)
|
||||
assert.True(t, ok)
|
||||
assert.NotNil(t, p)
|
||||
|
||||
assert.True(t, p.(*testProvider).configured)
|
||||
|
||||
assert.Equal(t, GetProviderPackage(old.Type), p.Pkg())
|
||||
|
||||
ver, err := GetProviderVersion(old.Inputs)
|
||||
assert.NoError(t, err)
|
||||
if ver != nil {
|
||||
info, err := p.GetPluginInfo()
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, info.Version.GTE(*ver))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewRegistryOldStateNoProviders(t *testing.T) {
|
||||
olds := []*resource.State{
|
||||
newProviderState("pkgA", "a", "id1", false, nil),
|
||||
|
|
|
@ -233,6 +233,9 @@ func (sg *stepGenerator) generateSteps(event RegisterResourceEvent) ([]Step, res
|
|||
}
|
||||
}
|
||||
|
||||
// register aliases with the provider registry
|
||||
sg.deployment.providers.RegisterAliases(sg.aliased)
|
||||
|
||||
// Create the desired inputs from the goal state
|
||||
inputs := goal.Properties
|
||||
if hasOld {
|
||||
|
|
|
@ -374,7 +374,7 @@ func (info PluginInfo) Install(tgz io.ReadCloser) error {
|
|||
if err != nil && !os.IsNotExist(err) {
|
||||
return errors.Wrap(err, "loading PulumiPlugin.yaml")
|
||||
}
|
||||
if proj != nil {
|
||||
if proj != nil && !proj.SkipInstall {
|
||||
runtime := strings.ToLower(proj.Runtime.Name())
|
||||
// For now, we only do this for Node.js and Python. For Go, the expectation is the binary is
|
||||
// already built. For .NET, similarly, a single self-contained binary could be used, but
|
||||
|
|
|
@ -157,6 +157,8 @@ func (proj *PolicyPackProject) Save(path string) error {
|
|||
type PluginProject struct {
|
||||
// Runtime is a required runtime that executes code.
|
||||
Runtime ProjectRuntimeInfo `json:"runtime" yaml:"runtime"`
|
||||
// skips installation of runtime depenencies
|
||||
SkipInstall bool `json:"skipInstall" yaml:"skipInstall"`
|
||||
}
|
||||
|
||||
func (proj *PluginProject) Validate() error {
|
||||
|
|
Loading…
Reference in a new issue