Skip to content

Commit 412c51c

Browse files
authored
Merge pull request #104 from jsburckhardt/feat/hurl
feat(hurl): add hurl devcontainer feature
2 parents 56d58b0 + 99033da commit 412c51c

3 files changed

Lines changed: 65 additions & 29 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"features": {
3+
"ghcr.io/devcontainers/features/copilot-cli": {
4+
"version": "1.1.2",
5+
"resolved": "ghcr.io/devcontainers/features/copilot-cli@sha256:757c6c2899dc902c44a9f6164c1f7392832ced13c6bb632d8d60a880f2e92456",
6+
"integrity": "sha256:757c6c2899dc902c44a9f6164c1f7392832ced13c6bb632d8d60a880f2e92456"
7+
},
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
9+
"version": "2.16.1",
10+
"resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:ce078b7bf7d9ef3bcb9813b32103795d8d72172446890b64772cbe1dec6baafd",
11+
"integrity": "sha256:ce078b7bf7d9ef3bcb9813b32103795d8d72172446890b64772cbe1dec6baafd"
12+
},
13+
"ghcr.io/devcontainers/features/github-cli:latest": {
14+
"version": "1.1.0",
15+
"resolved": "ghcr.io/devcontainers/features/github-cli@sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671",
16+
"integrity": "sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671"
17+
},
18+
"ghcr.io/jsburckhardt/devcontainer-features/tmux:1": {
19+
"version": "1.0.0",
20+
"resolved": "ghcr.io/jsburckhardt/devcontainer-features/tmux@sha256:f75eb8e2c8f9ea30980729d5303b96071a4f17ad3d5eccab0c75efc5d8271498",
21+
"integrity": "sha256:f75eb8e2c8f9ea30980729d5303b96071a4f17ad3d5eccab0c75efc5d8271498"
22+
},
23+
"ghcr.io/jsburckhardt/devcontainer-features/yazi:1.0.1": {
24+
"version": "1.0.1",
25+
"resolved": "ghcr.io/jsburckhardt/devcontainer-features/yazi@sha256:35383727c0eee36d02f89ee7e805cbd94dfabe6c86d24c2e07e33b1a678e098a",
26+
"integrity": "sha256:35383727c0eee36d02f89ee7e805cbd94dfabe6c86d24c2e07e33b1a678e098a"
27+
},
28+
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {
29+
"version": "0.0.6",
30+
"resolved": "ghcr.io/stuartleeks/dev-container-features/shell-history@sha256:f266af2d093e0611921ccf510046e53affeccb353405ee05d2b91fcc4f69c1c9",
31+
"integrity": "sha256:f266af2d093e0611921ccf510046e53affeccb353405ee05d2b91fcc4f69c1c9"
32+
}
33+
}
34+
}

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,15 @@ Running `hurl --version` inside the built container will print the version of hu
437437
{
438438
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
439439
"features": {
440-
"ghcr.io/jsburckhardt/devcontainer-features/fzf:1": {}
441-
"ghcr.io/jsburckhardt/devcontainer-features/lazygit:1": {}
442-
"ghcr.io/jsburckhardt/devcontainer-features/ripgrep:1": {}
443-
"ghcr.io/jsburckhardt/devcontainer-features/fd:1": {}
444-
"ghcr.io/jsburckhardt/devcontainer-features/rtk:1": {}
445-
"ghcr.io/jsburckhardt/devcontainer-features/zoxide:1": {}
446-
"ghcr.io/jsburckhardt/devcontainer-features/hyperfine:1": {}
447-
"ghcr.io/jsburckhardt/devcontainer-features/glow:1": {}
448-
"ghcr.io/jsburckhardt/devcontainer-features/fx:1": {}
440+
"ghcr.io/jsburckhardt/devcontainer-features/fzf:1": {},
441+
"ghcr.io/jsburckhardt/devcontainer-features/lazygit:1": {},
442+
"ghcr.io/jsburckhardt/devcontainer-features/ripgrep:1": {},
443+
"ghcr.io/jsburckhardt/devcontainer-features/fd:1": {},
444+
"ghcr.io/jsburckhardt/devcontainer-features/rtk:1": {},
445+
"ghcr.io/jsburckhardt/devcontainer-features/zoxide:1": {},
446+
"ghcr.io/jsburckhardt/devcontainer-features/hyperfine:1": {},
447+
"ghcr.io/jsburckhardt/devcontainer-features/glow:1": {},
448+
"ghcr.io/jsburckhardt/devcontainer-features/fx:1": {},
449449
"ghcr.io/jsburckhardt/devcontainer-features/hurl:1": {}
450450
}
451451
}

src/hurl/install.sh

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,26 @@ check_packages() {
2828
fi
2929
}
3030

31-
# Make sure we have curl, jq, and hurl runtime dependencies
32-
check_packages curl jq ca-certificates libxml2 libcurl4 libssl3
31+
# Make sure we have curl and jq
32+
check_packages curl jq ca-certificates
33+
34+
# Install libxml2 runtime dependency
35+
# On newer Ubuntu (25.04+), the package is libxml2-16 and provides libxml2.so.16
36+
# but hurl is linked against libxml2.so.2, so we need a compatibility symlink
37+
if [ "$(find /var/lib/apt/lists/* 2>/dev/null | wc -l)" = "0" ]; then
38+
apt-get update -y
39+
fi
40+
if apt-cache show libxml2 2>&1 | grep -q "^Version:"; then
41+
check_packages libxml2
42+
else
43+
check_packages libxml2-16
44+
# Create compatibility symlink for binaries expecting libxml2.so.2
45+
LIBXML2_SO=$(find /usr/lib -name "libxml2.so.*" ! -name "*.so.*.*" | head -1)
46+
if [ -n "$LIBXML2_SO" ] && [ ! -e "$(dirname "$LIBXML2_SO")/libxml2.so.2" ]; then
47+
ln -s "$LIBXML2_SO" "$(dirname "$LIBXML2_SO")/libxml2.so.2"
48+
ldconfig
49+
fi
50+
fi
3351

3452
# Function to get the latest version from GitHub API
3553
get_latest_version() {
@@ -38,17 +56,14 @@ get_latest_version() {
3856

3957
# Check if a version is passed as an argument
4058
if [ -z "$HURL_VERSION" ] || [ "$HURL_VERSION" == "latest" ]; then
41-
# No version provided, get the latest version
4259
HURL_VERSION=$(get_latest_version)
4360
echo "No version provided or 'latest' specified, installing the latest version: $HURL_VERSION"
4461
else
4562
echo "Installing version from environment variable: $HURL_VERSION"
4663
fi
4764

4865
# Determine the OS and architecture
49-
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
5066
ARCH=$(uname -m)
51-
5267
case "$ARCH" in
5368
x86_64)
5469
ARCH="x86_64"
@@ -62,21 +77,8 @@ case "$ARCH" in
6277
;;
6378
esac
6479

65-
case "$OS" in
66-
linux)
67-
OS="unknown-linux-gnu"
68-
;;
69-
darwin)
70-
OS="apple-darwin"
71-
;;
72-
*)
73-
echo "Unsupported OS: $OS"
74-
exit 1
75-
;;
76-
esac
77-
7880
# Construct the download URL
79-
DOWNLOAD_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${HURL_VERSION}/hurl-${HURL_VERSION}-${ARCH}-${OS}.tar.gz"
81+
DOWNLOAD_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${HURL_VERSION}/hurl-${HURL_VERSION}-${ARCH}-unknown-linux-gnu.tar.gz"
8082

8183
# Create a temporary directory for the download
8284
TMP_DIR=$(mktemp -d)
@@ -102,7 +104,7 @@ mv "${EXTRACTED_DIR}/bin/hurl" /usr/local/bin/
102104
mv "${EXTRACTED_DIR}/bin/hurlfmt" /usr/local/bin/
103105

104106
# Cleanup
105-
cd - || exit
107+
cd / || exit
106108
rm -rf "$TMP_DIR"
107109

108110
# Clean up

0 commit comments

Comments
 (0)