Skip to content

Commit 2d0a0f0

Browse files
committed
More nginx builds
1 parent c1d5019 commit 2d0a0f0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

hooks/common

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ IS_MASTER_BUILD=$([ "$SOURCE_BRANCH" == "master" ] && echo 1 || echo 0)
66
# return list of "<fromTag>|<targetTag>" depending if we are building against master or a specific release
77
getBuildParams() {
88
local RELEASE=$(echo $SOURCE_BRANCH | cut -c2-)
9-
local TAGS=$(curl 'https://registry.hub.docker.com/v2/repositories/library/nginx/tags?page_size=1024&name=alpine' 2>/dev/null | grep -Po '"name":"([0-9]+\.[0-9]+-alpine)"' | cut -d'"' -f4 | sort -r | uniq)
9+
# get top 5 x.y, then for each get top 3 x.y.z.
10+
local TAGS=""
1011

1112
if [ $IS_MASTER_BUILD -eq 1 ]; then
13+
TAGS=$(curl 'https://registry.hub.docker.com/v2/repositories/library/nginx/tags?page_size=1024&name=alpine' 2>/dev/null | grep -Po '"name":"([0-9]+\.[0-9]+-alpine)"' | cut -d'"' -f4 | sort -r | uniq | head -n5)
1214
for MTAG in $(echo "$TAGS" | grep "master"); do
1315
strippedTag=$(echo "${MTAG}" | cut -d'-' -f1)
1416
echo "${MTAG}|${strippedTag}-master"
1517
done
1618
else
19+
TAGS=$(curl 'https://registry.hub.docker.com/v2/repositories/library/nginx/tags?page_size=1024&name=alpine' 2>/dev/null | grep -Po '"name":"([0-9]+\.[0-9]+-alpine)"' | cut -d'"' -f4 | cut -d'-' -f1 | sort -r | uniq | head -n5 | while read minor; do curl 'https://registry.hub.docker.com/v2/repositories/library/nginx/tags?page_size=1024&name=alpine' 2>/dev/null | grep -Po "\"name\":\"(${minor}\.[0-9]+-alpine)\"" | cut -d'"' -f4 | sort -r | uniq | head -n3; done)
20+
for MTAG in $(echo "$TAGS" | grep -v "master"); do
21+
strippedTag=$(echo "${MTAG}" | cut -d'-' -f1)
22+
echo "${MTAG}|${strippedTag}-${RELEASE}"
23+
done
24+
25+
TAGS=$(curl 'https://registry.hub.docker.com/v2/repositories/library/nginx/tags?page_size=1024&name=alpine' 2>/dev/null | grep -Po '"name":"([0-9]+\.[0-9]+-alpine)"' | cut -d'"' -f4 | sort -r | uniq | head -n5)
1726
for MTAG in $(echo "$TAGS" | grep -v "master"); do
1827
strippedTag=$(echo "${MTAG}" | cut -d'-' -f1)
1928
echo "${MTAG}|${strippedTag}-${RELEASE}"

0 commit comments

Comments
 (0)