Skip to content

Commit 09e2417

Browse files
authored
Update stack version in docs and samples with a bash script (#1413) (#1415)
Add a bash script to automatically update all referenced stack versions in docs and samples. The script was applied with 7.2.0 (7.2.1 should be available soon, but isn't yet). I had to deal with sed tricks to make it compatible with both OSX sed and GNU sed. To avoid dealing with curl responses from Elasticsearch (GET /), I chose to shortcut the version section of the response to a simple {...}. Another way of doing this would be to templatize docs and samples entirely, and generate them from the template. Which would be a bit cleaner, but also many more files. I thought this first step would maybe be good enough (until we have too many special cases). * Add a bash script to replace all stack versions in docs and samples * Run the script with 7.2.0 * Remove the version section of ES API response * Set a version independant custom image tag example * Replace image by tag
1 parent c335761 commit 09e2417

12 files changed

+57
-48
lines changed

docs/accessing-services.asciidoc

+1-11
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,7 @@ You can now reach Elasticsearch:
249249
"name" : "hulk-es-4qk62zd928",
250250
"cluster_name" : "hulk",
251251
"cluster_uuid" : "q6itjqFqRqW576FXF0uohg",
252-
"version" : {
253-
"number" : "7.2.0",
254-
"build_flavor" : "default",
255-
"build_type" : "docker",
256-
"build_hash" : "508c38a",
257-
"build_date" : "2019-06-20T15:54:18.811730Z",
258-
"build_snapshot" : false,
259-
"lucene_version" : "8.0.0",
260-
"minimum_wire_compatibility_version" : "6.8.0",
261-
"minimum_index_compatibility_version" : "6.0.0-beta1"
262-
},
252+
"version" : {...},
263253
"tagline" : "You Know, for Search"
264254
}
265255
----

docs/advanced-node-scheduling.asciidoc

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ kind: Elasticsearch
2424
metadata:
2525
name: quickstart
2626
spec:
27-
version: 7.1.0
27+
version: 7.2.0
2828
nodes:
2929
# 3 dedicated master nodes
3030
- nodeCount: 3
@@ -59,7 +59,7 @@ kind: Elasticsearch
5959
metadata:
6060
name: quickstart
6161
spec:
62-
version: 7.1.0
62+
version: 7.2.0
6363
nodes:
6464
- nodeCount: 3
6565
podTemplate:
@@ -86,7 +86,7 @@ kind: Elasticsearch
8686
metadata:
8787
name: quickstart
8888
spec:
89-
version: 7.1.0
89+
version: 7.2.0
9090
nodes:
9191
- nodeCount: 3
9292
podTemplate:
@@ -103,7 +103,7 @@ kind: Elasticsearch
103103
metadata:
104104
name: quickstart
105105
spec:
106-
version: 7.1.0
106+
version: 7.2.0
107107
nodes:
108108
- nodeCount: 3
109109
podTemplate:
@@ -149,7 +149,7 @@ kind: Elasticsearch
149149
metadata:
150150
name: quickstart
151151
spec:
152-
version: 7.1.0
152+
version: 7.2.0
153153
nodes:
154154
- nodeCount: 3
155155
podTemplate:
@@ -168,7 +168,7 @@ kind: Elasticsearch
168168
metadata:
169169
name: quickstart
170170
spec:
171-
version: 7.1.0
171+
version: 7.2.0
172172
nodes:
173173
- nodeCount: 3
174174
podTemplate:
@@ -208,7 +208,7 @@ kind: Elasticsearch
208208
metadata:
209209
name: quickstart
210210
spec:
211-
version: 7.1.0
211+
version: 7.2.0
212212
nodes:
213213
- nodeCount: 1
214214
config:
@@ -276,7 +276,7 @@ kind: Elasticsearch
276276
metadata:
277277
name: quickstart
278278
spec:
279-
version: 7.1.0
279+
version: 7.2.0
280280
nodes:
281281
# hot nodes, with high CPU and fast IO
282282
- nodeCount: 3

docs/apm.asciidoc

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ metadata:
3232
name: apm-server-quickstart
3333
namespace: default
3434
spec:
35-
version: "7.2.0"
35+
version: 7.2.0
3636
nodeCount: 1
3737
elasticsearchRef:
3838
name: quickstart
@@ -52,8 +52,8 @@ kubectl get apmservers
5252

5353
[source,sh]
5454
----
55-
NAME HEALTH NODES VERSION AGE
56-
apm-server-quickstart green 1 7.2.0 8m
55+
NAME HEALTH NODES VERSION AGE
56+
apm-server-quickstart green 1 7.2.0 8m
5757
----
5858
And you can list all the Pods belonging to a given deployment:
5959

@@ -85,7 +85,7 @@ metadata:
8585
name: apm-server-quickstart
8686
namespace: default
8787
spec:
88-
version: "7.2.0"
88+
version: 7.2.0
8989
nodeCount: 1
9090
config:
9191
output:
@@ -120,7 +120,7 @@ metadata:
120120
name: apm-server-quickstart
121121
namespace: default
122122
spec:
123-
version: "7.2.0"
123+
version: 7.2.0
124124
nodeCount: 1
125125
secureSettings:
126126
secretName: apm-secret-settings
@@ -159,7 +159,7 @@ metadata:
159159
name: apm-server-quickstart
160160
namespace: default
161161
spec:
162-
version: "7.2.0"
162+
version: 7.2.0
163163
nodeCount: 1
164164
secureSettings:
165165
secretName: apm-secret-settings

docs/elasticsearch-spec.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ kind: Elasticsearch
381381
metadata:
382382
name: quickstart
383383
spec:
384-
version: 7.1.0
384+
version: 7.2.0
385385
nodes:
386386
- nodeCount: 3
387387
config:

docs/k8s-quickstart.asciidoc

+1-11
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,7 @@ NOTE: For testing purposes only, you can specify the `-k` option to turn off cer
160160
"name" : "quickstart-es-r56c9dzzcr",
161161
"cluster_name" : "quickstart",
162162
"cluster_uuid" : "XqWg0xIiRmmEBg4NMhnYPg",
163-
"version" : {
164-
"number" : "7.2.0",
165-
"build_flavor" : "default",
166-
"build_type" : "docker",
167-
"build_hash" : "04116c9",
168-
"build_date" : "2019-05-08T06:20:03.781729Z",
169-
"build_snapshot" : true,
170-
"lucene_version" : "8.0.0",
171-
"minimum_wire_compatibility_version" : "6.8.0",
172-
"minimum_index_compatibility_version" : "6.0.0-beta1"
173-
},
163+
"version" : {...},
174164
"tagline" : "You Know, for Search"
175165
}
176166
----

docs/snapshots.asciidoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ kind: Elasticsearch
2828
metadata:
2929
name: elasticsearch-sample
3030
spec:
31-
version: 7.1.0
32-
image: your/custom/image:7.1.0
31+
version: 7.2.0
32+
image: your/custom/image:tag
3333
nodes:
3434
- nodeCount: 1
3535
----
@@ -43,7 +43,7 @@ kind: Elasticsearch
4343
metadata:
4444
name: elasticsearch-sample
4545
spec:
46-
version: 7.1.0
46+
version: 7.2.0
4747
nodes:
4848
- podTemplate:
4949
spec:

operators/config/samples/apm/apm_es_kibana.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ kind: Elasticsearch
55
metadata:
66
name: elasticsearch-sample
77
spec:
8-
version: "7.2.0"
8+
version: 7.2.0
99
nodes:
1010
- nodeCount: 3
1111
---
@@ -14,7 +14,7 @@ kind: ApmServer
1414
metadata:
1515
name: apm-server-sample
1616
spec:
17-
version: "7.2.0"
17+
version: 7.2.0
1818
nodeCount: 1
1919
elasticsearchRef:
2020
name: "elasticsearch-sample"
@@ -24,7 +24,7 @@ kind: Kibana
2424
metadata:
2525
name: kibana-sample
2626
spec:
27-
version: "7.2.0"
27+
version: 7.2.0
2828
nodeCount: 1
2929
elasticsearchRef:
3030
name: "elasticsearch-sample"

operators/config/samples/apm/apmserver.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: ApmServer
33
metadata:
44
name: apmserver-sample
55
spec:
6-
version: "7.2.0"
6+
version: 7.2.0
77
nodeCount: 1
88
config:
99
output.console:

operators/config/samples/elasticsearch/elasticsearch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: Elasticsearch
44
metadata:
55
name: elasticsearch-sample
66
spec:
7-
version: "7.2.0"
7+
version: 7.2.0
88
nodes:
99
- config:
1010
# most Elasticsearch configuration parameters are possible to set, e.g:

operators/config/samples/kibana/kibana.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: Kibana
44
metadata:
55
name: kibana-sample
66
spec:
7-
version: "7.1.0"
7+
version: 7.2.0
88
elasticsearch:
99
url: https://url.to.elasticsearch:9200
1010
auth:

operators/config/samples/kibana/kibana_es.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: Elasticsearch
44
metadata:
55
name: elasticsearch-sample
66
spec:
7-
version: "7.1.0"
7+
version: 7.2.0
88
nodes:
99
- nodeCount: 1
1010
---
@@ -13,7 +13,7 @@ kind: Kibana
1313
metadata:
1414
name: kibana-sample
1515
spec:
16-
version: "7.1.0"
16+
version: 7.2.0
1717
nodeCount: 1
1818
elasticsearchRef:
1919
name: "elasticsearch-sample"
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4+
# or more contributor license agreements. Licensed under the Elastic License;
5+
# you may not use this file except in compliance with the Elastic License.
6+
7+
#
8+
# Update the Elastic stack version in samples and documentation.
9+
# Usage: ./hack/update-doc-stack-version.sh <version>
10+
#
11+
12+
set -eu
13+
14+
# Elastic stack version
15+
VERSION="$1"
16+
17+
# Directories containing version references to replace
18+
: "${DIRS:="config/samples ../docs"}"
19+
20+
# For all yaml and asciidoc files in the directory trees, replace the existing version with sed.
21+
# We use the "-i.bak" trick to be compatible with both Linux and OSX.
22+
# We are replacing occurrences of:
23+
# - version: 1.2.3<EOL>
24+
# - version: "1.2.3"<EOL>
25+
# - quickstart green 1 1.2.3 (special case for es & apm quickstart)
26+
LC_CTYPE=C LANG=C find ${DIRS} -type f \( -iname \*.asciidoc -o -iname \*.yaml \) \
27+
-exec sed -i.bak -E "s|version: \"?[0-9]\.[0-9]\.[0-9]\"?$|version: $VERSION|g" "{}" \; \
28+
-exec sed -i.bak -E "s|quickstart[[:space:]]+green[[:space:]]+1[[:space:]]+[0-9]\.[0-9]\.[0-9] |quickstart green 1 $VERSION |g" "{}" \; \
29+
-exec rm "{}.bak" \;

0 commit comments

Comments
 (0)