Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: optimize image build #2452

Merged
merged 5 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG DEV_VERSION

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"
10 changes: 8 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"name": "linkerd2-proxy",
"image": "ghcr.io/linkerd/dev:v42",
"build": {
"dockerfile": "Dockerfile",
"args": {
"DEV_VERSION": "v42",
"http_proxy": "${localEnv:http_proxy}",
"https_proxy": "${localEnv:https_proxy}"
}
},
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -15,7 +22,6 @@
"settings": {}
}
},
"onCreateCommand": ".devcontainer/on-create.sh",
// Support docker + debugger
"runArgs": [
"--init",
Expand Down
10 changes: 0 additions & 10 deletions .devcontainer/on-create.sh

This file was deleted.

27 changes: 26 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down