Skip to content

Commit

Permalink
basic logic done?
Browse files Browse the repository at this point in the history
Signed-off-by: schristoff <28318173+schristoff@users.noreply.github.com>
  • Loading branch information
schristoff committed Oct 9, 2023
1 parent 868bc57 commit 4255504
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/porter/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ func (e *dependencyExecutioner) identifyDependencies(ctx context.Context) error
// If we hit here, there is a bug somewhere
return span.Error(errors.New("identifyDependencies failed to load the bundle because no bundle was specified. Please report this bug to https://github.com/getporter/porter/issues/new/choose"))
}

//NOTE: (schristoff) if v2, time to jump
if bun.HasDependenciesV2() {
e.resolveSharedDeps_v2(ctx, bun)
}

locks, err := bun.ResolveDependencies(bun)
if err != nil {
return span.Error(err)
Expand Down Expand Up @@ -289,6 +283,11 @@ func (e *dependencyExecutioner) executeDependency(ctx context.Context, dep *queu
if errors.Is(err, storage.ErrNotFound{}) {
depInstallation = storage.NewInstallation(e.parentOpts.Namespace, depName)
depInstallation.SetLabel("sh.porter.parentInstallation", e.parentArgs.Installation.String())

//if using v2, set label for sharing group so we can find it later
if dep.SharingMode {
depInstallation.SetLabel("sh.porter.SharingGroup", dep.SharingGroup)
}
// For now, assume it's okay to give the dependency the same credentials as the parent
depInstallation.CredentialSets = e.parentInstallation.CredentialSets
if err = e.Installations.InsertInstallation(ctx, depInstallation); err != nil {
Expand All @@ -307,11 +306,12 @@ func (e *dependencyExecutioner) executeDependency(ctx context.Context, dep *queu
}
// If it exists and they're in the same group, it'll be either installed or uninstalled
// If installed, wire things up, if uninstalled, error
if dep.SharingGroup == depInstallation.Labels["SharingGroup"] {
if dep.SharingGroup == depInstallation.Labels["sh.porter.SharingGroup"] {
if depInstallation.Uninstalled {
return fmt.Errorf("error executing dependency, in uninstalled status %s", depInstallation.Name)
}
//Wire up outputs & params
//note (schristoff):I think below we wire up params so the only thing needs to be tied is
// credentials maybe?
}
//If we get here, we need to call someone for help
return fmt.Errorf("how are you here?")
Expand Down

0 comments on commit 4255504

Please sign in to comment.