Skip to content

Commit 9391a8a

Browse files
authored
Explain skip directive a bit more (#127)
#126 (comment)
1 parent ab96bad commit 9391a8a

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

packages/hooks/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,36 @@ Compatible with Gantry v2.3.7 and newer.
3737
`SKIP_SMOKE` will require additional setup. Consider setting the environment variable on your API based on the surrounding CI environment,
3838
like the build message or an explicit environment variable against the build.
3939

40+
For example, your Gantry resource file could look like this:
41+
42+
```yaml
43+
kind: Service
44+
env:
45+
SKIP_SMOKE: '{{ with env "BUILDKITE_MESSAGE" | lower }}{{ if contains "[skip smoke]" . }}true{{ else }}false{{ end }}{{ end }}'
46+
```
47+
48+
Or, some magic to handle combinations like `[skip ci dev-deploy smoke]`:
49+
50+
```yaml
51+
kind: Service
52+
env:
53+
SKIP_SMOKE: '{{ with env "BUILDKITE_MESSAGE" | lower }}{{ if regexMatch "\\[skip\\b[^\\]]*\\bsmoke\\b[^\\]]*\\]" . }}true{{ else }}false{{ end }}{{ end }}'
54+
```
55+
56+
With these in place,
57+
you can push a new commit or manually create a new build that includes `[skip smoke]` somewhere in its title:
58+
59+
```yaml
60+
[skip smoke] Re-deploy for disaster recovery
61+
Re-deploy for disaster recovery [sKiP SmOkE]
62+
63+
# you can also work with multiple directives if you chose the magic approach
64+
[skip ci smoke] Re-deploy for disaster recovery
65+
Please [skip smoke dev-deploy] work
66+
```
67+
68+
The resulting Buildkite build will set `process.env.SKIP_SMOKE = true` on the ECS task and enable it to skip pre-deployment checks.
69+
4070
### `isLambdaHook`
4171

4272
Whether the Lambda invocation originated from AWS CodeDeploy Hooks.
@@ -81,6 +111,20 @@ const lambdaEnvironment = {
81111
};
82112
```
83113

114+
With this in place,
115+
you can push a new commit or manually create a new build that includes `[skip smoke]` somewhere in its title:
116+
117+
```yaml
118+
[skip smoke] Re-deploy for disaster recovery
119+
Re-deploy for disaster recovery [sKiP SmOkE]
120+
121+
# you can also work with multiple directives
122+
[skip ci smoke] Re-deploy for disaster recovery
123+
Please [skip smoke dev-deploy] work
124+
```
125+
126+
The resulting Buildkite build will set `process.env.SKIP_SMOKE = true` on the Lambda function and enable it to skip pre-deployment checks.
127+
84128
### `smokeTest.koaMiddleware`
85129

86130
A Koa middleware that executes a smoke test function to check whether the application is broadly operational and ready to serve requests.

0 commit comments

Comments
 (0)