|
3 | 3 | # |
4 | 4 | # Build entry script for elasticsearch-serverless-js |
5 | 5 | # |
6 | | -# Must be called: ./.buildkite/make.sh <target> <params> |
| 6 | +# Must be called: ./.ci/make.sh <target> <params> |
7 | 7 | # |
8 | 8 | # Version: 1.1.0 |
9 | 9 | # |
@@ -46,83 +46,83 @@ echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m" |
46 | 46 | echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m" |
47 | 47 |
|
48 | 48 | case $CMD in |
49 | | - clean) |
50 | | - echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m" |
51 | | - rm -rf "$output_folder" |
52 | | - echo -e "\033[32;1mdone.\033[0m" |
53 | | - exit 0 |
54 | | - ;; |
55 | | - assemble) |
56 | | - if [ -v $VERSION ]; then |
57 | | - echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m" |
58 | | - exit 1 |
59 | | - fi |
60 | | - echo -e "\033[36;1mTARGET: assemble artifact $VERSION\033[0m" |
61 | | - TASK=release |
62 | | - TASK_ARGS=("$VERSION" "$output_folder") |
63 | | - ;; |
64 | | - codegen) |
65 | | - if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then |
66 | | - # fall back to branch name or `main` if no VERSION is set |
67 | | - branch_name=$(git rev-parse --abbrev-ref HEAD) |
68 | | - if [[ "$branch_name" =~ ^[0-9]+\.[0-9]+ ]]; then |
69 | | - echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m" |
70 | | - VERSION="$branch_name" |
71 | | - else |
72 | | - echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using \`main\`\033[0m" |
73 | | - VERSION="main" |
74 | | - fi |
75 | | - fi |
76 | | - if [ "$VERSION" = 'main' ]; then |
77 | | - echo -e "\033[36;1mTARGET: codegen API $VERSION\033[0m" |
78 | | - else |
79 | | - echo -e "\033[36;1mTARGET: codegen API v$VERSION\033[0m" |
80 | | - fi |
81 | | - |
82 | | - TASK=codegen |
83 | | - TASK_ARGS=("$VERSION") |
84 | | - ;; |
85 | | - docsgen) |
86 | | - if [ -v $VERSION ]; then |
87 | | - echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m" |
88 | | - exit 1 |
89 | | - fi |
90 | | - echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m" |
91 | | - TASK=codegen |
92 | | - TASK_ARGS=("$VERSION" "$codegen_folder") |
93 | | - ;; |
94 | | - examplesgen) |
95 | | - echo -e "\033[36;1mTARGET: generate examples\033[0m" |
96 | | - TASK=codegen |
97 | | - TASK_ARGS=("$VERSION" "$codegen_folder") |
98 | | - ;; |
99 | | - bump) |
100 | | - if [ -v $VERSION ]; then |
101 | | - echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m" |
102 | | - exit 1 |
103 | | - fi |
104 | | - echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m" |
105 | | - TASK=bump |
106 | | - TASK_ARGS=("$VERSION") |
107 | | - ;; |
108 | | - bumpmatrix) |
109 | | - if [ -v $VERSION ]; then |
110 | | - echo -e "\033[31;1mTARGET: bumpmatrix -> missing version parameter\033[0m" |
111 | | - exit 1 |
112 | | - fi |
113 | | - echo -e "\033[36;1mTARGET: bump stack in test matrix to version $VERSION\033[0m" |
114 | | - TASK=bumpmatrix |
115 | | - TASK_ARGS=("$VERSION") |
116 | | - ;; |
117 | | - *) |
118 | | - echo -e "\n'$CMD' is not supported right now\n" |
119 | | - echo -e "\nUsage:" |
120 | | - echo -e "\t $0 release \$VERSION\n" |
121 | | - echo -e "\t $0 bump \$VERSION" |
122 | | - echo -e "\t $0 codegen \$VERSION" |
123 | | - exit 1 |
124 | | -esac |
| 49 | +clean) |
| 50 | + echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m" |
| 51 | + rm -rf "$output_folder" |
| 52 | + echo -e "\033[32;1mdone.\033[0m" |
| 53 | + exit 0 |
| 54 | + ;; |
| 55 | +assemble) |
| 56 | + if [ -v $VERSION ]; then |
| 57 | + echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m" |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | + echo -e "\033[36;1mTARGET: assemble artifact $VERSION\033[0m" |
| 61 | + TASK=release |
| 62 | + TASK_ARGS=("$VERSION" "$output_folder") |
| 63 | + ;; |
| 64 | +codegen) |
| 65 | + if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then |
| 66 | + # fall back to branch name or `main` if no VERSION is set |
| 67 | + branch_name=$(git rev-parse --abbrev-ref HEAD) |
| 68 | + if [[ "$branch_name" =~ ^[0-9]+\.[0-9]+ ]]; then |
| 69 | + echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m" |
| 70 | + VERSION="$branch_name" |
| 71 | + else |
| 72 | + echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using \`main\`\033[0m" |
| 73 | + VERSION="main" |
| 74 | + fi |
| 75 | + fi |
| 76 | + if [ "$VERSION" = 'main' ]; then |
| 77 | + echo -e "\033[36;1mTARGET: codegen API $VERSION\033[0m" |
| 78 | + else |
| 79 | + echo -e "\033[36;1mTARGET: codegen API v$VERSION\033[0m" |
| 80 | + fi |
125 | 81 |
|
| 82 | + TASK=codegen |
| 83 | + TASK_ARGS=("$VERSION") |
| 84 | + ;; |
| 85 | +docsgen) |
| 86 | + if [ -v $VERSION ]; then |
| 87 | + echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m" |
| 88 | + exit 1 |
| 89 | + fi |
| 90 | + echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m" |
| 91 | + TASK=codegen |
| 92 | + TASK_ARGS=("$VERSION" "$codegen_folder") |
| 93 | + ;; |
| 94 | +examplesgen) |
| 95 | + echo -e "\033[36;1mTARGET: generate examples\033[0m" |
| 96 | + TASK=codegen |
| 97 | + TASK_ARGS=("$VERSION" "$codegen_folder") |
| 98 | + ;; |
| 99 | +bump) |
| 100 | + if [ -v $VERSION ]; then |
| 101 | + echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m" |
| 102 | + exit 1 |
| 103 | + fi |
| 104 | + echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m" |
| 105 | + TASK=bump |
| 106 | + TASK_ARGS=("$VERSION") |
| 107 | + ;; |
| 108 | +bumpmatrix) |
| 109 | + if [ -v $VERSION ]; then |
| 110 | + echo -e "\033[31;1mTARGET: bumpmatrix -> missing version parameter\033[0m" |
| 111 | + exit 1 |
| 112 | + fi |
| 113 | + echo -e "\033[36;1mTARGET: bump stack in test matrix to version $VERSION\033[0m" |
| 114 | + TASK=bumpmatrix |
| 115 | + TASK_ARGS=("$VERSION") |
| 116 | + ;; |
| 117 | +*) |
| 118 | + echo -e "\n'$CMD' is not supported right now\n" |
| 119 | + echo -e "\nUsage:" |
| 120 | + echo -e "\t $0 release \$VERSION\n" |
| 121 | + echo -e "\t $0 bump \$VERSION" |
| 122 | + echo -e "\t $0 codegen \$VERSION" |
| 123 | + exit 1 |
| 124 | + ;; |
| 125 | +esac |
126 | 126 |
|
127 | 127 | # ------------------------------------------------------- # |
128 | 128 | # Build Container |
|
179 | 179 | # ------------------------------------------------------- # |
180 | 180 |
|
181 | 181 | if [[ "$CMD" == "assemble" ]]; then |
182 | | - if compgen -G ".buildkite/output/*" > /dev/null; then |
183 | | - echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m" |
184 | | - else |
185 | | - echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m" |
186 | | - exit 1 |
187 | | - fi |
| 182 | + if compgen -G ".buildkite/output/*" >/dev/null; then |
| 183 | + echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m" |
| 184 | + else |
| 185 | + echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m" |
| 186 | + exit 1 |
| 187 | + fi |
188 | 188 | fi |
189 | 189 |
|
190 | 190 | if [[ "$CMD" == "bump" ]]; then |
191 | | - if [ -n "$(git status --porcelain)" ]; then |
192 | | - echo -e "\033[32;1mTARGET: successfully bumped client v$VERSION\033[0m" |
193 | | - else |
194 | | - echo -e "\033[31;1mTARGET: failed bumped client v$VERSION\033[0m" |
| 191 | + if [ -n "$(git status --porcelain)" ]; then |
| 192 | + echo -e "\033[32;1mTARGET: successfully bumped client v$VERSION\033[0m" |
| 193 | + else |
| 194 | + echo -e "\033[31;1mTARGET: failed bumped client v$VERSION\033[0m" |
195 | 195 | exit 1 |
196 | 196 | fi |
197 | 197 | fi |
198 | 198 |
|
199 | 199 | if [[ "$CMD" == "codegen" ]]; then |
200 | | - if [ -n "$(git status --porcelain)" ]; then |
201 | | - echo -e "\033[32;1mTARGET: successfully generated client v$VERSION\033[0m" |
202 | | - else |
203 | | - echo -e "\033[31;1mTARGET: failed generating client v$VERSION\033[0m" |
| 200 | + if [ -n "$(git status --porcelain)" ]; then |
| 201 | + echo -e "\033[32;1mTARGET: successfully generated client v$VERSION\033[0m" |
| 202 | + else |
| 203 | + echo -e "\033[31;1mTARGET: failed generating client v$VERSION\033[0m" |
204 | 204 | exit 1 |
205 | 205 | fi |
206 | 206 | fi |
207 | 207 |
|
208 | 208 | if [[ "$CMD" == "docsgen" ]]; then |
209 | | - echo "TODO" |
| 209 | + echo "TODO" |
210 | 210 | fi |
211 | 211 |
|
212 | 212 | if [[ "$CMD" == "examplesgen" ]]; then |
213 | | - echo "TODO" |
| 213 | + echo "TODO" |
214 | 214 | fi |
0 commit comments