get.porter.sh/porter@v1.3.0/pkg/porter/action.go (about)

     1  package porter
     2  
     3  import (
     4  	"context"
     5  
     6  	"get.porter.sh/porter/pkg/storage"
     7  )
     8  
     9  // ExecuteAction runs the specified action. Supported actions are: install, upgrade, invoke.
    10  // The uninstall action works in reverse so it's implemented separately.
    11  func (p *Porter) ExecuteAction(ctx context.Context, installation storage.Installation, action BundleAction) error {
    12  	deperator := newDependencyExecutioner(p, installation, action)
    13  	err := deperator.Prepare(ctx)
    14  	if err != nil {
    15  		return err
    16  	}
    17  
    18  	err = deperator.Execute(ctx)
    19  	if err != nil {
    20  		return err
    21  	}
    22  
    23  	actionArgs, err := deperator.PrepareRootActionArguments(ctx)
    24  	if err != nil {
    25  		return err
    26  	}
    27  
    28  	return p.CNAB.Execute(ctx, actionArgs)
    29  }