-
Notifications
You must be signed in to change notification settings - Fork 3
feat: populate Config attribute in hook params #924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -217,6 +217,11 @@ func (r *ChangesetsRegistry) Apply( | |||||
| return fdeployment.ChangesetOutput{}, err | ||||||
| } | ||||||
|
|
||||||
| changesetConfig, err := applySnapshot.registryEntry.changeset.configuration() | ||||||
| if err != nil { | ||||||
| return fdeployment.ChangesetOutput{}, fmt.Errorf("failed to get changeset configuration: %w", err) | ||||||
| } | ||||||
|
|
||||||
| hookEnv := HookEnv{ | ||||||
| Name: e.Name, | ||||||
| Logger: e.Logger, | ||||||
|
|
@@ -225,6 +230,7 @@ func (r *ChangesetsRegistry) Apply( | |||||
| preParams := PreHookParams{ | ||||||
| Env: hookEnv, | ||||||
| ChangesetKey: key, | ||||||
| Config: changesetConfig, | ||||||
| } | ||||||
|
|
||||||
| for _, h := range applySnapshot.globalPreHooks { | ||||||
|
|
@@ -248,6 +254,7 @@ func (r *ChangesetsRegistry) Apply( | |||||
| postParams := PostHookParams{ | ||||||
| Env: hookEnv, | ||||||
| ChangesetKey: key, | ||||||
| Config: changesetConfig, | ||||||
| Output: output, | ||||||
| Err: applyErr, | ||||||
| } | ||||||
|
|
@@ -339,6 +346,16 @@ func (r *ChangesetsRegistry) GetChangesetOptions(key string) (ChangesetConfig, e | |||||
| return entry.options, nil | ||||||
| } | ||||||
|
|
||||||
| // GetConfiguration retrieves the configuration for a changeset. | ||||||
| func (r *ChangesetsRegistry) GetConfiguration(key string) (any, error) { | ||||||
| entry, ok := r.entries[key] | ||||||
| if !ok { | ||||||
| return ChangesetConfig{}, fmt.Errorf("changeset '%s' not found", key) | ||||||
|
||||||
| return ChangesetConfig{}, fmt.Errorf("changeset '%s' not found", key) | |
| return nil, fmt.Errorf("changeset '%s' not found", key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply()now computeschangesetConfigviachangeset.configuration()before running hooks, but this ignores theWithInput(...)ApplyOption. Whencfg.inputStris set, the changeset execution usesapplyWithInput(e, cfg.inputStr)(potentially usingconfigProviderWithInput), while hooks will receive a config derived from the default provider (often DURABLE_PIPELINE_INPUT), so hook params can diverge from the actual config used for the apply. Consider deriving the hookConfigfrom the same source asapplyWithInput(e.g., add aconfigurationWithInput(inputStr string)method tointernalChangeSet, or passcfg.inputStrintoconfiguration()and haveChangeSetImpluseconfigProviderWithInputwhen inputStr is non-empty).