forked from devcontainers/features
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_git_from_src_alpine.sh
More file actions
33 lines (26 loc) · 1.01 KB
/
Copy pathinstall_git_from_src_alpine.sh
File metadata and controls
33 lines (26 loc) · 1.01 KB
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
33
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
# Resolves the latest stable git version from GitHub
get_latest_git_version() {
curl -sSL -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/git/git/tags" \
| grep -oP '"name":\s*"v\K[0-9]+\.[0-9]+\.[0-9]+(?=")' \
| sort -rV \
| head -n 1
}
# Verifies the installed git version matches the latest stable version on GitHub
check_git_is_latest_version() {
local latest_version installed_version
latest_version="$(get_latest_git_version)"
installed_version="$(git --version | awk '{print $3}')"
[ -n "$latest_version" ] && [ "$installed_version" = "$latest_version" ]
}
# Definition specific tests
check "version" git --version
check "version-is-latest" check_git_is_latest_version
cd /tmp && git clone https://github.com/devcontainers/feature-starter.git
cd feature-starter
check "perl" bash -c "git -c grep.patternType=perl grep -q 'a.+b'"
# Report result
reportResults