Skip to content

Commit dbe78b7

Browse files
authored
Update version comments (#1271)
1 parent a320e9d commit dbe78b7

File tree

126 files changed

+192
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+192
-104
lines changed

build/lint.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,12 @@ else
153153

154154
# Check for version warning comments in examples
155155
output=$(cd "$ROOT/examples" && find . -type f \
156-
! -name "README.md" \
156+
! -path "./README.md" \
157+
! -path "./utils/*" \
157158
! -name "*.json" \
158159
! -name "*.txt" \
159160
! -name ".*" \
160-
-exec grep -L "WARNING: you are on the master branch, please refer to the examples on the branch that matches your \`cortex version\`" {} \;)
161+
-exec grep -L "WARNING: you are on the master branch; please refer to examples on the branch corresponding to your \`cortex version\` (e\.g\. for version [0-9]*\.[0-9]*\.\*, run \`git checkout -b [0-9]*\.[0-9]*\` or switch to the \`[0-9]*\.[0-9]*\` branch on GitHub)" {} \;)
161162
if [[ $output ]]; then
162163
echo "example file(s) are missing version appropriate comment:"
163164
echo "$output"

dev/update_version_comments.sh

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,50 @@ set -euo pipefail
1919

2020
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null && pwd)"
2121

22+
arg1="${1:-""}"
23+
2224
git_branch="${CIRCLE_BRANCH:-""}"
2325
if [ "$git_branch" = "" ]; then
2426
git_branch=$(cd "$ROOT" && git rev-parse --abbrev-ref HEAD)
2527
fi
2628

29+
if [ -z "$git_branch" ]; then
30+
echo "error: unable to determine git branch"
31+
exit 1
32+
fi
33+
34+
if [ "$git_branch" = "master" ]; then
35+
if [ -z "$arg1" ]; then
36+
echo "error: use \`./dev/update_version_comments.sh <minor_version>\` to update all docs and examples warnings"
37+
exit 1
38+
fi
39+
40+
if [[ "$OSTYPE" == "darwin"* ]]; then
41+
cd "$ROOT" && find . -type f \
42+
! -path "./build/lint.sh" \
43+
! -path "./dev/update_version_comments.sh" \
44+
! -path "./vendor/*" \
45+
! -path "./bin/*" \
46+
! -path "./.git/*" \
47+
! -name ".*" \
48+
-print0 | \
49+
xargs -0 sed -i '' -e "s/WARNING: you are on the master branch; please refer to examples on the branch corresponding to your \`cortex version\` [(]e\.g\. for version [0-9]*\.[0-9]*\.\*, run \`git checkout -b [0-9]*\.[0-9]*\` or switch to the \`[0-9]*\.[0-9]*\` branch on GitHub[)]/WARNING: you are on the master branch; please refer to examples on the branch corresponding to your \`cortex version\` (e.g. for version ${arg1}.*, run \`git checkout -b ${arg1}\` or switch to the \`${arg1}\` branch on GitHub)/"
50+
else
51+
cd "$ROOT" && find . -type f \
52+
! -path "./build/lint.sh" \
53+
! -path "./dev/update_version_comments.sh" \
54+
! -path "./vendor/*" \
55+
! -path "./bin/*" \
56+
! -path "./.git/*" \
57+
! -name ".*" \
58+
-print0 | \
59+
xargs -0 sed -i "s/WARNING: you are on the master branch; please refer to examples on the branch corresponding to your \`cortex version\` [(]e\.g\. for version [0-9]*\.[0-9]*\.\*, run \`git checkout -b [0-9]*\.[0-9]*\` or switch to the \`[0-9]*\.[0-9]*\` branch on GitHub[)]/WARNING: you are on the master branch; please refer to examples on the branch corresponding to your \`cortex version\` (e.g. for version ${arg1}.*, run \`git checkout -b ${arg1}\` or switch to the \`${arg1}\` branch on GitHub)/"
60+
fi
61+
62+
echo "done"
63+
exit 0
64+
fi
65+
2766
if ! echo "$git_branch" | grep -Eq ^[0-9]+.[0-9]+$; then
2867
echo "error: this is meant to be run on release branches"
2968
exit 1
@@ -60,7 +99,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
6099
! -path "./.git/*" \
61100
! -name ".*" \
62101
-print0 | \
63-
xargs -0 sed -i '' -e "s/WARNING: you are on the master branch, please refer to the examples on the branch that matches your \`cortex version\`/this is an example for cortex release ${git_branch} and may not deploy correctly on other releases of cortex/"
102+
xargs -0 sed -i '' -e "s/WARNING: you are on the master branch; please refer to examples on the branch corresponding to your \`cortex version\` [(]e\.g\. for version [0-9]*\.[0-9]*\.\*, run \`git checkout -b [0-9]*\.[0-9]*\` or switch to the \`[0-9]*\.[0-9]*\` branch on GitHub[)]/this is an example for cortex release ${git_branch} and may not deploy correctly on other releases of cortex/"
64103
else
65104
cd "$ROOT" && find . -type f \
66105
! -path "./build/lint.sh" \
@@ -70,7 +109,7 @@ else
70109
! -path "./.git/*" \
71110
! -name ".*" \
72111
-print0 | \
73-
xargs -0 sed -i "s/WARNING: you are on the master branch, please refer to the examples on the branch that matches your \`cortex version\`/this is an example for cortex release ${git_branch} and may not deploy correctly on other releases of cortex/"
112+
xargs -0 sed -i "s/WARNING: you are on the master branch; please refer to examples on the branch corresponding to your \`cortex version\` [(]e\.g\. for version [0-9]*\.[0-9]*\.\*, run \`git checkout -b [0-9]*\.[0-9]*\` or switch to the \`[0-9]*\.[0-9]*\` branch on GitHub[)]/this is an example for cortex release ${git_branch} and may not deploy correctly on other releases of cortex/"
74113
fi
75114

76115
echo "done"

examples/apisplitter/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Splitting traffic between APIs
22

3-
_WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`_
3+
_WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub)_
44

55
This example shows how to split traffic between 2 different iris-classifiers deployed as SyncAPIs.
66

examples/apisplitter/cortex.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`
1+
# WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub)
22

33
- name: iris-classifier-onnx
44
kind: SyncAPI

examples/apisplitter/onnx_predictor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`
1+
# WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub)
22

33
labels = ["setosa", "versicolor", "virginica"]
44

examples/apisplitter/tensorflow_predictor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`
1+
# WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub)
22

33
labels = ["setosa", "versicolor", "virginica"]
44

examples/batch/image-classifier/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Deploy models as Batch APIs
22

3-
_WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`_
3+
_WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub)_
44

55
This example shows how to deploy a batch image classification api that accepts a list of image urls as input, downloads the images, classifies them, and writes the results to S3.
66

examples/batch/image-classifier/cortex.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`
1+
# WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub)
22

33
- name: image-classifier
44
kind: BatchAPI

examples/batch/image-classifier/predictor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`
1+
# WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub)
22

33
import os
44
import requests

examples/batch/onnx/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Batch Image Classifier in ONNX
22

3-
You can deploy this example by cloning this repo with `git clone -b v<CORTEX_VERSION> https://github.com/cortexlabs/cortex`. The `<CORTEX_VERSION>` should be substituted with the version of your Cortex CLI. For example, if the output of `cortex version` is 0.18.1, the clone command would be `git clone -b v0.18.1 https://github.com/cortexlabs/cortex`. Then navigate to this example directory.
3+
_WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub)_
44

55
<!-- CORTEX_VERSION_MINOR -->
66
Please refer to the [tutorial](https://docs.cortex.dev/v/master/batchapi/image-classifier#deploy-your-batch-api) to see how to deploy a Batch API with Cortex.

0 commit comments

Comments
 (0)