From 64daa9e6de5d31ef7dc8c7cf70ce6a2ef508b4b7 Mon Sep 17 00:00:00 2001 From: Josh Spicer Date: Mon, 22 Aug 2022 22:26:54 +0000 Subject: [PATCH 1/3] fix rust error when choose a non-default version. port of https://github.com/microsoft/vscode-dev-containers/pull/1592 --- src/rust/devcontainer-feature.json | 2 +- src/rust/install.sh | 4 ++-- test-scenarios/rust_at_pinned_version.sh | 0 test-scenarios/scenarios.json | 8 ++++++++ 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 test-scenarios/rust_at_pinned_version.sh diff --git a/src/rust/devcontainer-feature.json b/src/rust/devcontainer-feature.json index 016e464db..8212b3482 100644 --- a/src/rust/devcontainer-feature.json +++ b/src/rust/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "rust", - "version": "1.0.2", + "version": "1.0.3", "name": "Rust", "description": "Installs Rust, common Rust utilities, and their required dependencies", "options": { diff --git a/src/rust/install.sh b/src/rust/install.sh index 3970bb2aa..a84716cdc 100755 --- a/src/rust/install.sh +++ b/src/rust/install.sh @@ -179,8 +179,8 @@ else apt-get -y install --no-install-recommends git fi - echo ${RUST_VERSION} | grep -q "nightly" - is_nightly=$? + is_nightly=0 + echo ${RUST_VERSION} | grep -q "nightly" || is_nightly=$? if [ $is_nightly = 0 ]; then check_nightly_version_formatting RUST_VERSION else diff --git a/test-scenarios/rust_at_pinned_version.sh b/test-scenarios/rust_at_pinned_version.sh new file mode 100644 index 000000000..e69de29bb diff --git a/test-scenarios/scenarios.json b/test-scenarios/scenarios.json index 853da2ff4..b440c64ef 100644 --- a/test-scenarios/scenarios.json +++ b/test-scenarios/scenarios.json @@ -91,5 +91,13 @@ "version": "3" } } + }, + "rust_at_pinned_version": { + "image": "ubuntu:focal", + "features": { + "rust": { + "version": "1.63.0" + } + } } } From bfec2c4418a53e0bc34dba62adde0e122c5c4e54 Mon Sep 17 00:00:00 2001 From: Josh Spicer Date: Mon, 22 Aug 2022 23:16:18 +0000 Subject: [PATCH 2/3] actually include rust_at_pinned.sh --- test-scenarios/rust_at_pinned_version.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test-scenarios/rust_at_pinned_version.sh b/test-scenarios/rust_at_pinned_version.sh index e69de29bb..3108d5e3e 100644 --- a/test-scenarios/rust_at_pinned_version.sh +++ b/test-scenarios/rust_at_pinned_version.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Definition specific tests +check "cargo version" cargo --version +check "rustc version" rustc --version + + +# Report result +reportResults \ No newline at end of file From ce27aedd1fd79f767735418f0871700370371613 Mon Sep 17 00:00:00 2001 From: Josh Spicer Date: Mon, 22 Aug 2022 23:20:46 +0000 Subject: [PATCH 3/3] assert rust version --- test-scenarios/rust_at_pinned_version.sh | 1 + test-scenarios/scenarios.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test-scenarios/rust_at_pinned_version.sh b/test-scenarios/rust_at_pinned_version.sh index 3108d5e3e..2954a7acb 100644 --- a/test-scenarios/rust_at_pinned_version.sh +++ b/test-scenarios/rust_at_pinned_version.sh @@ -8,6 +8,7 @@ source dev-container-features-test-lib # Definition specific tests check "cargo version" cargo --version check "rustc version" rustc --version +check "correct rust version" rustc --version | grep 1.62.0 # Report result diff --git a/test-scenarios/scenarios.json b/test-scenarios/scenarios.json index ca0818011..c7ec8af5d 100644 --- a/test-scenarios/scenarios.json +++ b/test-scenarios/scenarios.json @@ -96,7 +96,7 @@ "image": "ubuntu:focal", "features": { "rust": { - "version": "1.63.0" + "version": "1.62.0" } } },