From d1191abf7efe55ba3394d04b5d1cb5c3ff1c8713 Mon Sep 17 00:00:00 2001 From: Loong Date: Tue, 8 Aug 2023 18:26:13 +0800 Subject: [PATCH 1/4] dev: optimize image build Signed-off-by: Loong --- .devcontainer/Dockerfile | 9 +++++++++ .devcontainer/devcontainer.json | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..88df8da34f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +FROM ghcr.io/linkerd/dev:v39 + +RUN rustup toolchain install --profile=minimal nightly + +RUN cargo +nightly install cargo-fuzz + +RUN scurl https://run.linkerd.io/install-edge | sh + +RUN mkdir -p "$HOME/bin" && ln -s "$HOME/.linkerd2/bin/linkerd" "$HOME/bin/linkerd" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index be0826f8e6..305a678b69 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "linkerd2-proxy", - "image": "ghcr.io/linkerd/dev:v40", + "dockerFile": "Dockerfile", "customizations": { "vscode": { "extensions": [ @@ -15,7 +15,12 @@ "settings": {} } }, - "onCreateCommand": ".devcontainer/on-create.sh", + "build": { + "args": { + "http_proxy": "${localEnv:http_proxy}", + "https_proxy": "${localEnv:https_proxy}" + } + }, // Support docker + debugger "runArgs": [ "--init", From 46c008d6e829c4e07ebfd091fb18126f477d8545 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Mon, 13 Nov 2023 22:36:30 +0000 Subject: [PATCH 2/4] formatting --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 305a678b69..d722df4143 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "linkerd2-proxy", - "dockerFile": "Dockerfile", + "dockerFile": "Dockerfile", "customizations": { "vscode": { "extensions": [ From 86c909bb2ec48be7a48d6195352363a331019b92 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Mon, 13 Nov 2023 22:53:53 +0000 Subject: [PATCH 3/4] Fix action-dev-check script for new dev config --- .devcontainer/Dockerfile | 14 ++++++-------- .devcontainer/devcontainer.json | 15 ++++++++------- justfile | 27 ++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 88df8da34f..438d99c9e1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,9 +1,7 @@ -FROM ghcr.io/linkerd/dev:v39 +ARG DEV_VERSION -RUN rustup toolchain install --profile=minimal nightly - -RUN cargo +nightly install cargo-fuzz - -RUN scurl https://run.linkerd.io/install-edge | sh - -RUN mkdir -p "$HOME/bin" && ln -s "$HOME/.linkerd2/bin/linkerd" "$HOME/bin/linkerd" +FROM ghcr.io/linkerd/dev:${DEV_VERSION} +RUN rustup toolchain install --profile=minimal nightly && \ + cargo +nightly install cargo-fuzz +RUN scurl https://run.linkerd.io/install-edge | sh && \ + mkdir -p "$HOME/bin" && ln -s "$HOME/.linkerd2/bin/linkerd" "$HOME/bin/linkerd" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d722df4143..174702c2c1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,13 @@ { "name": "linkerd2-proxy", - "dockerFile": "Dockerfile", + "build": { + "dockerfile": "Dockerfile", + "args": { + "DEV_VERSION": "v42", + "http_proxy": "${localEnv:http_proxy}", + "https_proxy": "${localEnv:https_proxy}" + } + }, "customizations": { "vscode": { "extensions": [ @@ -15,12 +22,6 @@ "settings": {} } }, - "build": { - "args": { - "http_proxy": "${localEnv:http_proxy}", - "https_proxy": "${localEnv:https_proxy}" - } - }, // Support docker + debugger "runArgs": [ "--init", diff --git a/justfile b/justfile index 177055cd23..f8c985d3a1 100644 --- a/justfile +++ b/justfile @@ -196,7 +196,32 @@ action-lint: @just-dev lint-actions action-dev-check: - @just-dev check-action-images + #!/usr/bin/env bash + # TODO(ver) consolidate this again with just-dev + #@just-dev check-action-images + set -euo pipefail + VERSION=$(j5j .devcontainer/devcontainer.json |jq -r '.build.args["DEV_VERSION"]') + EX=0 + while IFS= read filelineimg ; do + # Parse lines in the form `file:line img:tag` + fileline="${filelineimg%% *}" + file="${fileline%%:*}" + line="${fileline##*:}" + img="${filelineimg##* }" + name="${img%%:*}" + # Tag may be in the form of `version[-variant]` + tag="${img##*:}" + version="${tag%%-*}" + if [ "$name" = 'ghcr.io/linkerd/dev' ] && [ "$version" != "$VERSION" ]; then + if [ "${GITHUB_ACTIONS:-}" = "true" ]; then + echo "::error file=${file},line=${line}::Expected image 'ghcr.io/linkerd/dev:$VERSION'; found '${img}'" >&2 + else + echo "${file}:${line}: Expected image 'ghcr.io/linkerd/dev:$VERSION'; found '${img}'" >&2 + fi + EX=$(( EX+1 )) + fi + done < <( /usr/local/bin/action-images ) + exit $EX ## ## Linkerd From 381f0497701039c8253d7ff87adf7afef6a235f5 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Mon, 13 Nov 2023 22:56:13 +0000 Subject: [PATCH 4/4] Remove unused script --- .devcontainer/on-create.sh | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100755 .devcontainer/on-create.sh diff --git a/.devcontainer/on-create.sh b/.devcontainer/on-create.sh deleted file mode 100755 index b42b455e96..0000000000 --- a/.devcontainer/on-create.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -rustup toolchain install --profile=minimal nightly -cargo +nightly install cargo-fuzz - -scurl https://run.linkerd.io/install-edge | sh -mkdir -p "$HOME/bin" -(cd "$HOME/bin" && ln -s "$HOME/.linkerd2/bin/linkerd" .)