Skip to content

Commit 09a005d

Browse files
committed
Populate the env with dry run status
Updates the `applyEnvironmentVariables` function to populate whether or not the current execution context is running as a dry run or not which can then be used in hooks.
1 parent 17b170d commit 09a005d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

doc/hooks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ The following variables are available on all hooks:
6969
- `GH_OST_INSPECTED_HOST`
7070
- `GH_OST_EXECUTING_HOST`
7171
- `GH_OST_HOOKS_HINT` - copy of `--hooks-hint` value
72+
- `GH_OST_DRY_RUN` - whether or not the `gh-ost` run is a dry run
7273

7374
The following variable are available on particular hooks:
7475

go/logic/hooks.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func (this *HooksExecutor) applyEnvironmentVariables(extraVariables ...string) [
6464
env = append(env, fmt.Sprintf("GH_OST_INSPECTED_HOST=%s", this.migrationContext.GetInspectorHostname()))
6565
env = append(env, fmt.Sprintf("GH_OST_EXECUTING_HOST=%s", this.migrationContext.Hostname))
6666
env = append(env, fmt.Sprintf("GH_OST_HOOKS_HINT=%s", this.migrationContext.HooksHintMessage))
67+
env = append(env, fmt.Sprintf("GH_OST_DRY_RUN=%t", this.migrationContext.Noop))
6768

6869
for _, variable := range extraVariables {
6970
env = append(env, variable)

0 commit comments

Comments
 (0)