Skip to content

Commit db401e4

Browse files
author
Spencer
authored
add simple description of how to pin es snapshot versions (#51225)
1 parent 1dc08d4 commit db401e4

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

packages/kbn-es/README.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,62 @@ Cloned location of elasticsearch repository, used when running from source
5959

6060
Type: `String`
6161

62-
Location where snapshots are cached
62+
Location where snapshots are cached
63+
64+
## Snapshot Pinning
65+
66+
Sometimes we need to pin snapshots for a specific version. We'd really like to get this automated, but until that is completed here are the steps to take to build, upload, and switch to pinned snapshots for a branch.
67+
68+
To use these steps you'll need to setup the google-cloud-sdk, which can be installed on macOS with `brew cask install google-cloud-sdk`. Login with the CLI and you'll have access to the `gsutil` to do efficient/parallel uploads to GCS from the command line.
69+
70+
1. Clone the elasticsearch repo somewhere
71+
2. Checkout the branch you want to build
72+
3. Run the following to delete old distributables
73+
74+
```
75+
find distribution/archives -type f \( -name 'elasticsearch-*-*.tar.gz' -o -name 'elasticsearch-*-*.zip' \) -not -path *no-jdk* -exec rm {} \;
76+
```
77+
78+
4. Build the new artifacts
79+
80+
```
81+
./gradlew -p distribution/archives assemble --parallel
82+
```
83+
84+
4. Copy new artifacts to your `~/Downloads/tmp-artifacts`
85+
86+
```
87+
rm -rf ~/Downloads/tmp-artifacts
88+
mkdir ~/Downloads/tmp-artifacts
89+
find distribution/archives -type f \( -name 'elasticsearch-*-*.tar.gz' -o -name 'elasticsearch-*-*.zip' \) -not -path *no-jdk* -exec cp {} ~/Downloads/tmp-artifacts \;
90+
```
91+
92+
5. Calculate shasums of the uploads
93+
94+
```
95+
cd ~/Downloads/tmp-artifacts
96+
find * -exec bash -c "shasum -a 512 {} > {}.sha512" \;
97+
```
98+
99+
6. Check that the files in `~/Downloads/tmp-artifacts` look reasonable
100+
7. Upload the files to GCS
101+
102+
```
103+
gsutil -m rsync . gs://kibana-ci-tmp-artifacts/
104+
```
105+
106+
8. Once the artifacts are uploaded, modify `packages/kbn-es/src/custom_snapshots.js` in a PR to use a URL formatted like:
107+
108+
```
109+
// force use of manually created snapshots until ReindexPutMappings fix
110+
if (!process.env.KBN_ES_SNAPSHOT_URL && !process.argv.some(isVersionFlag)) {
111+
// return undefined;
112+
return 'https://storage.googleapis.com/kibana-ci-tmp-artifacts/{name}-{version}-{os}-x86_64.{ext}';
113+
}
114+
```
115+
116+
For 6.8, the format of the url should look like:
117+
118+
```
119+
'https://storage.googleapis.com/kibana-ci-tmp-artifacts/{name}-{version}.{ext}';
120+
```

0 commit comments

Comments
 (0)