Skip to content

Commit d849e12

Browse files
[Git-Lfs] - Solution to #1072 issue - Can't download public key (#1124)
* [Git-Lfs] - Solution to #1072 issue * bumped patch version for ths feature
1 parent d1c0cc2 commit d849e12

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/git-lfs/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "git-lfs",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"name": "Git Large File Support (LFS)",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/git-lfs",
66
"description": "Installs Git Large File Support (Git LFS) along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like git and curl.",

src/git-lfs/install.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,33 @@ find_version_from_git_tags() {
6262

6363
# Get the list of GPG key servers that are reachable
6464
get_gpg_key_servers() {
65-
declare -A keyservers_curl_map=(
66-
["hkp://keyserver.ubuntu.com"]="http://keyserver.ubuntu.com:11371"
67-
["hkp://keyserver.ubuntu.com:80"]="http://keyserver.ubuntu.com"
68-
["hkps://keys.openpgp.org"]="https://keys.openpgp.org"
69-
["hkp://keyserver.pgp.com"]="http://keyserver.pgp.com:11371"
70-
)
71-
7265
local curl_args=""
7366
local keyserver_reachable=false # Flag to indicate if any keyserver is reachable
7467

7568
if [ ! -z "${KEYSERVER_PROXY}" ]; then
7669
curl_args="--proxy ${KEYSERVER_PROXY}"
7770
fi
7871

79-
for keyserver in "${!keyservers_curl_map[@]}"; do
80-
local keyserver_curl_url="${keyservers_curl_map[${keyserver}]}"
81-
if curl -s ${curl_args} --max-time 5 ${keyserver_curl_url} > /dev/null; then
72+
test_keyserver() {
73+
local keyserver="$1"
74+
local keyserver_curl_url="$2"
75+
if curl -s ${curl_args} --max-time 5 "${keyserver_curl_url}" > /dev/null; then
8276
echo "keyserver ${keyserver}"
8377
keyserver_reachable=true
8478
else
8579
echo "(*) Keyserver ${keyserver} is not reachable." >&2
8680
fi
87-
done
81+
}
82+
83+
# Explicitly test these in order because Bash v4.4.20 (Ubuntu Bionic)
84+
# enumerates associative array keys in a different order than Bash v5
85+
test_keyserver "hkp://keyserver.ubuntu.com" "http://keyserver.ubuntu.com:11371"
86+
test_keyserver "hkp://keyserver.ubuntu.com:80" "http://keyserver.ubuntu.com"
87+
test_keyserver "hkp://keyserver.pgp.com" "http://keyserver.pgp.com:11371"
88+
# Test this server last because keys.openpgp.org strips user IDs from keys unless
89+
# the owner gives permission, which causes gpg in Ubuntu Bionic to reject the key
90+
# (https://github.com/devcontainers/features/issues/1055)
91+
test_keyserver "hkps://keys.openpgp.org" "https://keys.openpgp.org"
8892

8993
if ! $keyserver_reachable; then
9094
echo "(!) No keyserver is reachable." >&2

0 commit comments

Comments
 (0)