-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It's rare but it's possible that a tagged version exists as a GitHub release but not as a docker image. Try a few different versions if the tag does not exist in the docker registry.
- Loading branch information
1 parent
6bdf176
commit 9e5a0b4
Showing
2 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
HISTORICAL_VERSIONS=10 | ||
RETRIES=3 | ||
|
||
versions=$(gh api --method GET /repos/returntocorp/semgrep/releases | jq 'reverse' | jq -r '.[].tag_name' | tail "-n${HISTORICAL_VERSIONS}" | head -n "${RETRIES}" | tr -d v) | ||
|
||
for version in $(echo "${versions}"); do | ||
docker pull "returntocorp/semgrep:${version}" | ||
if [[ "$?" == 0 ]]; then | ||
echo "${version}" | ||
echo "SEMGREP_OLD_VERSION=${version}" >> "${GITHUB_ENV}" | ||
exit 0 | ||
fi | ||
done | ||
|
||
echo "Could not determine historical version, tried: $(echo ${versions})" | ||
exit 1 |