浏览代码

Adjust ".template-helpers/generate-dockerfile-links-partial.sh" to allow for the local library to take precedence over explicit master (if we set BASHBREW_LIBRARY like Jenkins does)

Tianon Gravi 8 年之前
父节点
当前提交
de49192681
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      .template-helpers/generate-dockerfile-links-partial.sh

+ 8 - 3
.template-helpers/generate-dockerfile-links-partial.sh

@@ -1,13 +1,18 @@
 #!/bin/bash
-set -e
+set -Eeuo pipefail
 
-repo="$1"
+repo="${1:-}"
 if [ -z "$repo" ]; then
 	echo >&2 "usage: $0 repo"
 	echo >&2 "   ie: $0 hylang"
 	exit 1
 fi
 
+# if we haven't set BASHBREW_LIBRARY explicitly (like Jenkins does, for example), don't trust the local library
+if [ -z "${BASHBREW_LIBRARY:-}" ]; then
+	repo="https://github.com/docker-library/official-images/raw/master/library/$repo"
+fi
+
 bashbrew cat \
 		-F "$(dirname "$BASH_SOURCE")/$(basename "$BASH_SOURCE" .sh).tmpl" \
-		"https://github.com/docker-library/official-images/raw/master/library/$repo"
+		"$repo"