Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions common/changeset/run_changeset.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package changeset

import (
"fmt"

"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
)

type WrappedChangeSet[C any] struct {
operation deployment.ChangeSetV2[C]
}
Comment thread
ajaskolski marked this conversation as resolved.

// RunChangeset is used to run a changeset in another changeset
// It executes VerifyPreconditions internally to handle changeset errors.
func RunChangeset[C any](
operation deployment.ChangeSetV2[C],
Comment thread
ajaskolski marked this conversation as resolved.
env deployment.Environment,
config C,
) (deployment.ChangesetOutput, error) {
cs := WrappedChangeSet[C]{operation: operation}

err := cs.operation.VerifyPreconditions(env, config)
if err != nil {
return deployment.ChangesetOutput{}, fmt.Errorf("failed to run precondition: %w", err)
Comment thread
ajaskolski marked this conversation as resolved.
}

return cs.operation.Apply(env, config)
}
Loading