File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -Eeuo pipefail
3
+
4
+ repo=" ${1:- } "
5
+ if [ -z " $repo " ]; then
6
+ echo >&2 " usage: $0 repo"
7
+ echo >&2 " ie: $0 hylang"
8
+ exit 1
9
+ fi
10
+
11
+ # if we haven't set BASHBREW_LIBRARY explicitly (like Jenkins does, for example), don't trust the local library
12
+ if [ -z " ${BASHBREW_LIBRARY:- } " ]; then
13
+ repo=" https://github.com/docker-library/official-images/raw/master/library/$repo "
14
+ fi
15
+
16
+ : " ${BASHBREW_CACHE:= $HOME / .cache/ bashbrew} "
17
+ export BASHBREW_CACHE
18
+
19
+ # see "generate-dockerfile-links-partial.tmpl" for where our arch-choosing complexity comes from
20
+ templateHeader=' {{- $archSpecific := getenv "ARCH_SPECIFIC_DOCS" -}}'
21
+ templateArchVar=' {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}'
22
+
23
+ tags=" $( bashbrew list --uniq " $repo " | cut -d: -f2-) "
24
+ tags=( $tags )
25
+ toFetch=()
26
+ for tag in " $tags " ; do
27
+ if ! bashbrew cat --format '
28
+ ' " $templateHeader " '
29
+ {{- $e := $.TagEntry -}}
30
+ ' " $templateArchVar " '
31
+ {{- if $e.HasArchitecture $arch -}}
32
+ {{- $from := $.ArchDockerFrom $arch $e -}}
33
+ {{- end -}}
34
+ ' " $repo :$tag " & > /dev/null; then
35
+ toFetch+=( " $repo :$tag " )
36
+ fi
37
+ done
38
+
39
+ if [ " ${# toFetch[@]} " -eq 0 ]; then
40
+ exit 0
41
+ fi
42
+
43
+ bashbrewFetchTemplate='
44
+ ' " $templateHeader " '
45
+ {{- range $i, $e := $.Entries -}}
46
+ ' " $templateArchVar " '
47
+ {{- if $e.HasArchitecture $arch -}}
48
+ {{- join "/" "refs/tags" $arch $.RepoName ($e.Tags | first) -}}
49
+ {{- ":" -}}
50
+ {{- "\n" -}}
51
+ {{- end -}}
52
+ {{- end -}}
53
+ '
54
+
55
+ bashbrew cat --format " $bashbrewFetchTemplate " " $repo " \
56
+ | xargs --no-run-if-empty git -C " $BASHBREW_CACHE /git" fetch --quiet --no-tags https://github.com/docker-library/commit-warehouse.git
Original file line number Diff line number Diff line change @@ -110,6 +110,9 @@ for image in "${images[@]}"; do
110
110
deprecated+=$' \n\n '
111
111
fi
112
112
113
+ echo ' GIT PREFETCH => "' " $repo " ' "'
114
+ " $helperDir /git-prefetch.sh" " $repo "
115
+
113
116
targetFile=" $repo /README.md"
114
117
115
118
{
You can’t perform that action at this time.
0 commit comments