From cfb214dd6b4512e19d1ae4a73ee9779dc41bd500 Mon Sep 17 00:00:00 2001 From: Daniel Braun Date: Sat, 30 Sep 2023 10:29:08 +0000 Subject: [PATCH] feat: gh-release allows additional flags --- src/gh-release/README.md | 1 + src/gh-release/devcontainer-feature.json | 13 ++++++++++++- src/gh-release/install.sh | 2 +- test/gh-release/scenarios.json | 12 ++++++++++++ test/gh-release/test_apiops.sh | 9 +++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 test/gh-release/test_apiops.sh diff --git a/src/gh-release/README.md b/src/gh-release/README.md index 3de176519..16e427018 100644 --- a/src/gh-release/README.md +++ b/src/gh-release/README.md @@ -23,5 +23,6 @@ Github Release feature will download, extract and add to path a release binary f | binLocation | Location to download the target binary to. Typically a location which exist under PATH variable | string | /usr/local/bin | | libName | Name for the lib dir (if exists). Will default to binary name if not given | string | - | | libLocation | Any lib files (if exists) will be downloaded into this location. The binary will then be soft linked from the lib location to the bin location | string | /usr/local/lib | +| additionalFlags | (Optional) Any additional flags for the 'nanolayer install gh-release' command | string | - | diff --git a/src/gh-release/devcontainer-feature.json b/src/gh-release/devcontainer-feature.json index 4b2c09836..3a34b1757 100644 --- a/src/gh-release/devcontainer-feature.json +++ b/src/gh-release/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "gh-release", - "version": "1.0.22", + "version": "1.0.23", "name": "Github Release", "documentationURL": "http://github.com/devcontainers-contrib/features/tree/main/src/gh-release", "description": "Github Release feature will download, extract and add to path a release binary from a given repo", @@ -63,6 +63,17 @@ "/usr/local/lib" ], "type": "string" + }, + "additionalFlags": { + "default": "", + "description": "(Optional) Any additional flags for the 'nanolayer install gh-release' command ", + "proposals": [ + "--no-filter-assets-by-platform", + "--no-filter-assets-by-architecture", + "--no-filter-assets-by-distro", + "--no-filter-assets-by-misc" + ], + "type": "string" } }, "installsAfter": [] diff --git a/src/gh-release/install.sh b/src/gh-release/install.sh index 8eb8ded5e..e16731dc7 100755 --- a/src/gh-release/install.sh +++ b/src/gh-release/install.sh @@ -20,5 +20,5 @@ $nanolayer_location \ install gh-release \ "$REPO" \ "$BINARYNAMES" --force \ - --version "$VERSION" --bin-location "$BINLOCATION" --lib-location "$LIBLOCATION" $asset_regex_cmd $lib_name_cmd $release_tag_regex + --version "$VERSION" --bin-location "$BINLOCATION" --lib-location "$LIBLOCATION" $asset_regex_cmd $lib_name_cmd $release_tag_regex $ADDITIONALFLAGS diff --git a/test/gh-release/scenarios.json b/test/gh-release/scenarios.json index bc4a30d03..452dd188c 100644 --- a/test/gh-release/scenarios.json +++ b/test/gh-release/scenarios.json @@ -50,5 +50,17 @@ "assetRegex": "^(?!.*(fxdependent))" } } + }, + "test_apiops": { + "image": "mcr.microsoft.com/devcontainers/base:debian", + "features": { + "gh-release": { + "version": "latest", + "repo": "Azure/apiops", + "binaryNames": "extractor", + "assetRegex": "^extractor\\.linux-.+\\.exe$", + "additionalFlags": "--no-filter-assets-by-platform" + } + } } } \ No newline at end of file diff --git a/test/gh-release/test_apiops.sh b/test/gh-release/test_apiops.sh new file mode 100755 index 000000000..0d95c627f --- /dev/null +++ b/test/gh-release/test_apiops.sh @@ -0,0 +1,9 @@ +#!/bin/bash -i + +set -e + +source dev-container-features-test-lib + +check "type extractor" type extractor + +reportResults