diff --git a/src/k6/devcontainer-feature.json b/src/k6/devcontainer-feature.json index 2b955d3..8c22b9f 100644 --- a/src/k6/devcontainer-feature.json +++ b/src/k6/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "A modern load testing tool, using Go and JavaScript", "id": "k6", - "version": "1.0.0", + "version": "1.0.1", "description": "**k6** is a modern load-testing tool, built on our years of experience in the performance and testing industries. It's built to be powerful, extensible, and full-featured. The key design goal is to provide **the best developer experience**.", "documentationURL": "https://github.com/grafana/k6", "options": { diff --git a/src/k6/gh-release-installer-patched.sh b/src/k6/gh-release-installer-patched.sh index 19e204d..749be6e 100644 --- a/src/k6/gh-release-installer-patched.sh +++ b/src/k6/gh-release-installer-patched.sh @@ -2,18 +2,16 @@ set -e -if ! which curl > /dev/null; then - if grep -q "alpine" /etc/os-release; then - apk add --no-cache curl - else +if ! which wget > /dev/null; then + if grep -vq "alpine" /etc/os-release; then apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y -q curl ca-certificates + DEBIAN_FRONTEND=noninteractive apt-get install -y -q wget ca-certificates fi fi get_version() { if [ -z "$VERSION" ] || [ "$VERSION" = "latest" ]; then - url=$(curl "https://github.com/${OWNER}/${NAME}/releases/latest" -s -L -I -o /dev/null -w '%{url_effective}') + url=$(wget -q -O - --spider -S "https://github.com/${OWNER}/${NAME}/releases/latest" 2>&1 | grep Location) echo -n "${url##*v}" else echo -n "$VERSION" @@ -47,5 +45,5 @@ PLATFORM="$(get_platform)" echo "Activating feature '${NAME}' version $VERSION on platform $PLATFORM" -curl -sL "https://github.com/${OWNER}/${NAME}/releases/download/v${VERSION}/${NAME}-v${VERSION}-${PLATFORM}.tar.gz" | \ - tar -xzf - -C /usr/local/bin --strip-components=1 --wildcards "${NAME}*/${NAME}" +wget -qO - "https://github.com/${OWNER}/${NAME}/releases/download/v${VERSION}/${NAME}-v${VERSION}-${PLATFORM}.tar.gz" | \ + tar x -zf - -C /usr/local/bin --strip-components 1 "${NAME}-v${VERSION}-${PLATFORM}/k6" diff --git a/src/xk6/devcontainer-feature.json b/src/xk6/devcontainer-feature.json index 0282fb8..f93680c 100644 --- a/src/xk6/devcontainer-feature.json +++ b/src/xk6/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Build k6 with extensions", "id": "xk6", - "version": "1.0.0", + "version": "1.0.1", "description": "This command line tool and associated Go package makes it easy to make custom builds of [k6](https://github.com/grafana/k6). It is used heavily by k6 extension developers as well as anyone who wishes to make custom `k6` binaries (with or without extensions).", "documentationURL": "https://github.com/grafana/xk6", "options": { diff --git a/src/xk6/gh-release-installer.sh b/src/xk6/gh-release-installer.sh index 29b1d9f..f4e062e 100644 --- a/src/xk6/gh-release-installer.sh +++ b/src/xk6/gh-release-installer.sh @@ -2,18 +2,16 @@ set -e -if ! which curl > /dev/null; then - if grep -q "alpine" /etc/os-release; then - apk add --no-cache curl - else +if ! which wget > /dev/null; then + if grep -vq "alpine" /etc/os-release; then apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y -q curl ca-certificates + DEBIAN_FRONTEND=noninteractive apt-get install -y -q wget ca-certificates fi fi get_version() { if [ -z "$VERSION" ] || [ "$VERSION" = "latest" ]; then - url=$(curl "https://github.com/${OWNER}/${NAME}/releases/latest" -s -L -I -o /dev/null -w '%{url_effective}') + url=$(wget -q -O - --spider -S "https://github.com/${OWNER}/${NAME}/releases/latest" 2>&1 | grep Location) echo -n "${url##*v}" else echo -n "$VERSION" @@ -47,4 +45,5 @@ PLATFORM="$(get_platform)" echo "Activating feature '${NAME}' version $VERSION on platform $PLATFORM" -curl -sL "https://github.com/${OWNER}/${NAME}/releases/download/v${VERSION}/${NAME}_${VERSION}_${PLATFORM}.tar.gz" | tar -xzf - -C /usr/local/bin ${NAME} +wget -qO - "https://github.com/${OWNER}/${NAME}/releases/download/v${VERSION}/${NAME}_${VERSION}_${PLATFORM}.tar.gz" | \ + tar x -zf - -C /usr/local/bin ${NAME} diff --git a/test/_global/alpine.sh b/test/_global/alpine.sh new file mode 100644 index 0000000..0f03763 --- /dev/null +++ b/test/_global/alpine.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +. ./all.sh $@ diff --git a/test/_global/debian.sh b/test/_global/debian.sh new file mode 100644 index 0000000..0f03763 --- /dev/null +++ b/test/_global/debian.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +. ./all.sh $@ diff --git a/test/_global/scenarios.json b/test/_global/scenarios.json index 41fae92..845a0e2 100644 --- a/test/_global/scenarios.json +++ b/test/_global/scenarios.json @@ -1,9 +1,23 @@ { - "all": { + "ubuntu": { "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { "xk6": {}, "k6": {} } + }, + "debian": { + "image": "mcr.microsoft.com/devcontainers/base:debian", + "features": { + "xk6": {}, + "k6": {} + } + }, + "alpine": { + "image": "mcr.microsoft.com/devcontainers/base:alpine", + "features": { + "xk6": {}, + "k6": {} + } } } diff --git a/test/_global/ubuntu.sh b/test/_global/ubuntu.sh new file mode 100644 index 0000000..0f03763 --- /dev/null +++ b/test/_global/ubuntu.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +. ./all.sh $@ diff --git a/test/k6/k6.sh b/test/k6/k6-with-version.sh similarity index 100% rename from test/k6/k6.sh rename to test/k6/k6-with-version.sh diff --git a/test/k6/scenarios.json b/test/k6/scenarios.json index a6e201b..6addf39 100644 --- a/test/k6/scenarios.json +++ b/test/k6/scenarios.json @@ -1,5 +1,5 @@ { - "k6": { + "k6-with-version": { "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { "k6": { diff --git a/test/k6/test.sh b/test/k6/test.sh index 3f1dedc..3324b52 100644 --- a/test/k6/test.sh +++ b/test/k6/test.sh @@ -9,8 +9,9 @@ set -e source dev-container-features-test-lib # Feature-specific tests -url=$(curl "https://github.com/grafana/k6/releases/latest" -s -L -I -o /dev/null -w '%{url_effective}') -latest="${url##*v}" +url=$(wget -q -O - --spider -S "https://github.com/grafana/k6/releases/latest" 2>&1 | grep Location) +echo -n "${url##*v}" + check "execute command" bash -c "k6 --version | grep '$latest'" # Report results diff --git a/test/xk6/scenarios.json b/test/xk6/scenarios.json index 209e6f5..e4ad073 100644 --- a/test/xk6/scenarios.json +++ b/test/xk6/scenarios.json @@ -1,5 +1,5 @@ { - "xk6": { + "xk6-with-version": { "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { "xk6": { diff --git a/test/xk6/xk6.sh b/test/xk6/xk6-with-version.sh similarity index 100% rename from test/xk6/xk6.sh rename to test/xk6/xk6-with-version.sh