forked from docker-library/official-images
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pr-urls.sh
executable file
·32 lines (26 loc) · 901 Bytes
/
pr-urls.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
set -Eeuo pipefail
#
# usage:
# $ ./pr-urls.sh PR-NUMBER
# $ ./pr-urls.sh PR-NUMBER IMAGE1 IMAGE2:TAG1 IMAGE3:TAG2
#
# $ ./pr-urls.sh 12072
# $ ./pr-urls.sh 12072 hello-world:linux
# $ ./pr-urls.sh 12072 | xargs -rt bashbrew build
# $ ./pr-urls.sh 12072 | xargs -rt bashbrew list --uniq
# $ ./pr-urls.sh 12072 | xargs -rt bashbrew list --uniq | xargs -rt ./test/run.sh
#
# (rough replacement for the old "test-pr.sh" script and its associated complexity)
#
pr="$1"
shift
patch="$(wget -qO- "https://github.com/docker-library/official-images/pull/$pr.patch")"
commit="$(grep <<<"$patch" -oE '^From [0-9a-f]+ ' | tail -1 | cut -d' ' -f2)"
if [ "$#" -eq 0 ]; then
files="$(grep <<<"$patch" -oE '^[+]{3} b/library/.+' | cut -d/ -f3 | sort -u)"
set -- $files
fi
for file; do
echo "https://github.com/docker-library/official-images/raw/$commit/library/$file"
done