@@ -197,78 +197,79 @@ EOF
197
197
https://api.github.com/repos/fluent/fluent-package-builder/pulls/$PULL_NUMBER | jq --raw-output ' .head | .ref + " " + .sha' )
198
198
head_branch=$( echo $response | cut -d' ' -f1)
199
199
head_sha=$( echo $response | cut -d' ' -f2)
200
- rm -f dl.list
201
- for d in ` seq 1 5 ` ; do
200
+ rm -f dl.* . list
201
+ for d in ` seq 1 20 ` ; do
202
202
curl --silent --location \
203
203
-H " Accept: application/vnd.github+json" \
204
204
-H " Authorization: Bearer $GITHUB_ACCESS_TOKEN " \
205
205
-H " X-GitHub-Api-Version: 2022-11-28" \
206
206
" https://api.github.com/repos/fluent/fluent-package-builder/actions/artifacts?per_page=100&page=$d " | \
207
- jq --raw-output ' .artifacts[] | select(.workflow_run.head_branch == "' $head_branch ' " and .workflow_run.head_sha == "' $head_sha ' ") | .name + " " + (.size_in_bytes|tostring) + " " + .archive_download_url' > dl.list
208
- filesize=$( stat -c " %s" dl.list)
207
+ jq --raw-output ' .artifacts[] | select(.workflow_run.head_branch == "' $head_branch ' " and .workflow_run.head_sha == "' $head_sha ' ") | .name + " " + (.size_in_bytes|tostring) + " " + .archive_download_url' > dl.$d .list
208
+ filesize=$( stat -c " %s" dl.$d .list)
209
+
209
210
if [ $filesize -eq 0 ]; then
210
211
echo " Failed to fetch artifacts list"
211
- rm -f dl.list
212
+ rm -f dl.$d . list
212
213
continue
213
- else
214
- break
215
214
fi
216
- done
217
- while read line
218
- do
219
- package=$( echo $line | cut -d' ' -f1)
220
- download_url=$( echo $line | cut -d' ' -f3)
221
- echo " Downloading $package .zip from $download_url "
222
- case $package in
223
- * debian* |* ubuntu* )
224
- mkdir -p apt/repositories
225
- (cd apt/repositories &&
226
- rm -f $package .zip &&
227
- curl --silent --location --output $package .zip \
228
- -H " Authorization: Bearer $GITHUB_ACCESS_TOKEN " $download_url ) &
229
- ;;
230
- * centos* |* rockylinux* |* almalinux* |* amazonlinux* )
231
- mkdir -p yum/repositories
232
- (cd yum/repositories &&
233
- rm -f $package .zip &&
234
- curl --silent --location --output $package .zip \
235
- -H " Authorization: Bearer $GITHUB_ACCESS_TOKEN " $download_url ) &
236
- ;;
237
- * )
238
- curl --silent --location --output $package .zip \
239
- -H " Authorization: Bearer $GITHUB_ACCESS_TOKEN " $download_url &
240
- ;;
241
- esac
242
- done < dl.list
243
- wait
215
+ while read line
216
+ do
217
+ package=$( echo $line | cut -d' ' -f1)
218
+ download_url=$( echo $line | cut -d' ' -f3)
219
+ echo " Downloading $package .zip from $download_url "
220
+ case $package in
221
+ * debian* |* ubuntu* )
222
+ mkdir -p apt/repositories
223
+ (cd apt/repositories &&
224
+ rm -f $package .zip &&
225
+ curl --silent --location --output $package .zip \
226
+ -H " Authorization: Bearer $GITHUB_ACCESS_TOKEN " $download_url ) &
227
+ ;;
228
+ * centos* |* rockylinux* |* almalinux* |* amazonlinux* )
229
+ mkdir -p yum/repositories
230
+ (cd yum/repositories &&
231
+ rm -f $package .zip &&
232
+ curl --silent --location --output $package .zip \
233
+ -H " Authorization: Bearer $GITHUB_ACCESS_TOKEN " $download_url ) &
234
+ ;;
235
+ * )
236
+ curl --silent --location --output $package .zip \
237
+ -H " Authorization: Bearer $GITHUB_ACCESS_TOKEN " $download_url &
238
+ ;;
239
+ esac
240
+ done < dl.$d .list
241
+ wait
244
242
245
- verified=1
246
- while read line
247
- do
248
- package=$( echo $line | cut -d' ' -f1)
249
- download_size=$( echo $line | cut -d' ' -f2)
250
- case $package in
251
- * debian* |* ubuntu* )
252
- actual_size=$( stat --format=" %s" apt/repositories/$package .zip)
253
- ;;
254
- * rockylinux* |* almalinux* |* amazonlinux* )
255
- actual_size=$( stat --format=" %s" yum/repositories/$package .zip)
256
- ;;
257
- * )
258
- actual_size=$( stat --format=" %s" $package .zip)
259
- ;;
260
- esac
261
- if [ $download_size = " $actual_size " ]; then
262
- echo -e " [\e[32m\e[40mOK\e[0m] Verify apt/repositories/$package .zip"
263
- else
264
- echo -e " [\e[31m\e[40mNG\e[0m] Verify apt/repositories/$package .zip (expected: $download_size actual: $actual_size )"
265
- verified=0
243
+ verified=1
244
+ while read line
245
+ do
246
+ package=$( echo $line | cut -d' ' -f1)
247
+ download_size=$( echo $line | cut -d' ' -f2)
248
+ case $package in
249
+ * debian* |* ubuntu* )
250
+ actual_size=$( stat --format=" %s" apt/repositories/$package .zip)
251
+ ;;
252
+ * rockylinux* |* almalinux* |* amazonlinux* )
253
+ actual_size=$( stat --format=" %s" yum/repositories/$package .zip)
254
+ ;;
255
+ * )
256
+ actual_size=$( stat --format=" %s" $package .zip)
257
+ ;;
258
+ esac
259
+ if [ $download_size = " $actual_size " ]; then
260
+ echo -e " [\e[32m\e[40mOK\e[0m] Verify apt/repositories/$package .zip"
261
+ else
262
+ echo -e " [\e[31m\e[40mNG\e[0m] Verify apt/repositories/$package .zip (expected: $download_size actual: $actual_size )"
263
+ verified=0
264
+ fi
265
+ done < dl.$d .list
266
+ if [ $verified -eq 0 ]; then
267
+ echo " Downloaded artifacts were corrupted! Check the downloaded artifacts."
268
+ exit 1
266
269
fi
267
- done < dl.list
268
- if [ $verified -eq 0 ]; then
269
- echo " Downloaded artifacts were corrupted! Check the downloaded artifacts."
270
- exit 1
271
- fi
270
+ done
271
+ mkdir -p apt/repositories
272
+ mkdir -p yum/repositories
272
273
(cd apt/repositories && find . -name ' *.zip' -exec unzip -u -o {} \; )
273
274
(cd yum/repositories && find . -name ' *.zip' -exec unzip -u -o {} \; )
274
275
;;
0 commit comments