Skip to content

Commit b12ac78

Browse files
author
Shlomi Noach
authored
Merge pull request #703 from github/hints-owner-token
added: --hooks-hint-owner, --hooks-hint-token
2 parents 79ddcec + 1671530 commit b12ac78

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

doc/hooks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ 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_HOOKS_HINT_OWNER` - copy of `--hooks-hint-owner` value
73+
- `GH_OST_HOOKS_HINT_TOKEN` - copy of `--hooks-hint-token` value
7274
- `GH_OST_DRY_RUN` - whether or not the `gh-ost` run is a dry run
7375

7476
The following variable are available on particular hooks:

go/base/context.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ type MigrationContext struct {
126126
PanicFlagFile string
127127
HooksPath string
128128
HooksHintMessage string
129+
HooksHintOwner string
130+
HooksHintToken string
129131

130132
DropServeSocket bool
131133
ServeSocketFile string

go/cmd/gh-ost/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ func main() {
109109

110110
flag.StringVar(&migrationContext.HooksPath, "hooks-path", "", "directory where hook files are found (default: empty, ie. hooks disabled). Hook files found on this path, and conforming to hook naming conventions will be executed")
111111
flag.StringVar(&migrationContext.HooksHintMessage, "hooks-hint", "", "arbitrary message to be injected to hooks via GH_OST_HOOKS_HINT, for your convenience")
112+
flag.StringVar(&migrationContext.HooksHintOwner, "hooks-hint-owner", "", "arbitrary name of owner to be injected to hooks via GH_OST_HOOKS_HINT_OWNER, for your convenience")
113+
flag.StringVar(&migrationContext.HooksHintToken, "hooks-hint-token", "", "arbitrary token to be injected to hooks via GH_OST_HOOKS_HINT_TOKEN, for your convenience")
112114

113115
flag.UintVar(&migrationContext.ReplicaServerId, "replica-server-id", 99999, "server id used by gh-ost process. Default: 99999")
114116

go/logic/hooks.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ 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_HOOKS_HINT_OWNER=%s", this.migrationContext.HooksHintOwner))
68+
env = append(env, fmt.Sprintf("GH_OST_HOOKS_HINT_TOKEN=%s", this.migrationContext.HooksHintToken))
6769
env = append(env, fmt.Sprintf("GH_OST_DRY_RUN=%t", this.migrationContext.Noop))
6870

6971
for _, variable := range extraVariables {

0 commit comments

Comments
 (0)