dev: Use a common action-dev-check (#1895)
This change updates to the v28 devcontainer, which includes an extracted `action-dev-check` script that replaces the inlined just recipe. This change also renames some recipes (like action-lint, md-lint, and sh-lint) to be uniform with the recipes in other repos. Signed-off-by: Oliver Gould <ver@buoyant.io> Signed-off-by: Oliver Gould <ver@buoyant.io>
This commit is contained in:
parent
c253a0304b
commit
ab8aac3cf9
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "linkerd2-proxy",
|
"name": "linkerd2-proxy",
|
||||||
"image": "ghcr.io/linkerd/dev:v26",
|
"image": "ghcr.io/linkerd/dev:v28",
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"DavidAnson.vscode-markdownlint",
|
"DavidAnson.vscode-markdownlint",
|
||||||
"kokakiwi.vscode-just",
|
"kokakiwi.vscode-just",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
FROM ghcr.io/linkerd/dev:v26-rust
|
FROM ghcr.io/linkerd/dev:v28-rust
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,14 @@ jobs:
|
||||||
actionlint:
|
actionlint:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
container: ghcr.io/linkerd/dev:v26-tools
|
container: ghcr.io/linkerd/dev:v28-tools
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just actions-lint
|
- run: just action-lint
|
||||||
|
|
||||||
devcontainer-versions:
|
devcontainer-versions:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-tools
|
container: ghcr.io/linkerd/dev:v28-tools
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just actions-dev-versions
|
- run: just action-dev-check
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
check-all:
|
check-all:
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just fetch
|
- run: just fetch
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ jobs:
|
||||||
needs: list-changed-crates
|
needs: list-changed-crates
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
crate: ${{ fromJson(needs.list-changed-crates.outputs.crates) }}
|
crate: ${{ fromJson(needs.list-changed-crates.outputs.crates) }}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
container:
|
container:
|
||||||
image: docker://ghcr.io/linkerd/dev:v26-rust
|
image: docker://ghcr.io/linkerd/dev:v28-rust
|
||||||
options: --security-opt seccomp=unconfined # 🤷
|
options: --security-opt seccomp=unconfined # 🤷
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ jobs:
|
||||||
deprecated:
|
deprecated:
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just fetch
|
- run: just fetch
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ jobs:
|
||||||
test:
|
test:
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just fetch
|
- run: just fetch
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ jobs:
|
||||||
clippy:
|
clippy:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just fetch
|
- run: just fetch
|
||||||
|
|
@ -30,7 +30,7 @@ jobs:
|
||||||
fmt:
|
fmt:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just check-fmt
|
- run: just check-fmt
|
||||||
|
|
@ -38,7 +38,7 @@ jobs:
|
||||||
docs:
|
docs:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just fetch
|
- run: just fetch
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,15 @@ permissions:
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '**/*.sh'
|
|
||||||
- .github/workflows/shellcheck.yml
|
- .github/workflows/shellcheck.yml
|
||||||
|
- '**/*.sh'
|
||||||
|
- justfile
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
markdownlint:
|
sh-lint:
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-tools
|
container: ghcr.io/linkerd/dev:v28-tools
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just shellcheck
|
- run: just sh-lint
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
meshtls:
|
meshtls:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just fetch
|
- run: just fetch
|
||||||
|
|
@ -42,7 +42,7 @@ jobs:
|
||||||
unit:
|
unit:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: just fetch
|
- run: just fetch
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
devcontainer:
|
devcontainer:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-rust
|
container: ghcr.io/linkerd/dev:v28-rust
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- run: |
|
- run: |
|
||||||
|
|
@ -42,7 +42,7 @@ jobs:
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/linkerd/dev:v26-tools
|
container: ghcr.io/linkerd/dev:v28-tools
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
- shell: bash
|
- shell: bash
|
||||||
|
|
|
||||||
75
justfile
75
justfile
|
|
@ -82,8 +82,8 @@ _test := if env_var_or_default("GITHUB_ACTIONS", "") == "true" { "test" } else {
|
||||||
# Recipes
|
# Recipes
|
||||||
#
|
#
|
||||||
|
|
||||||
# Run all tests and build the proxy
|
# Run all lints
|
||||||
default: fetch check-fmt lint test build
|
lint: sh-lint md-lint clippy doc action-lint action-dev-check
|
||||||
|
|
||||||
# Fetch dependencies
|
# Fetch dependencies
|
||||||
fetch:
|
fetch:
|
||||||
|
|
@ -96,9 +96,6 @@ fmt:
|
||||||
check-fmt:
|
check-fmt:
|
||||||
{{ cargo }} fmt -- --check
|
{{ cargo }} fmt -- --check
|
||||||
|
|
||||||
# Run all lints
|
|
||||||
lint: shellcheck markdownlint clippy doc actions-lint actions-dev-versions
|
|
||||||
|
|
||||||
check *flags:
|
check *flags:
|
||||||
{{ cargo }} check --workspace --all-targets --frozen {{ flags }} {{ _fmt }}
|
{{ cargo }} check --workspace --all-targets --frozen {{ flags }} {{ _fmt }}
|
||||||
|
|
||||||
|
|
@ -184,23 +181,17 @@ docker mode='load':
|
||||||
{{ if features != "" { "--build-arg PROXY_FEATURES=" + features } else { "" } }} \
|
{{ if features != "" { "--build-arg PROXY_FEATURES=" + features } else { "" } }} \
|
||||||
{{ if mode == 'push' { "--push" } else { "--load" } }}
|
{{ if mode == 'push' { "--push" } else { "--load" } }}
|
||||||
|
|
||||||
# Display the git history minus dependabot updates
|
|
||||||
history *paths='.':
|
|
||||||
@-git log --oneline --graph --invert-grep --author="dependabot" -- {{ paths }}
|
|
||||||
|
|
||||||
# Lints all shell scripts in the repo.
|
# Lints all shell scripts in the repo.
|
||||||
shellcheck:
|
sh-lint:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
files=$(for f in $(find . -type f ! \( -path ./.git/\* -or -path \*/target/\* \)) ; do
|
files=$(while IFS= read -r f ; do
|
||||||
if [ $(file -b --mime-type $f) = text/x-shellscript ]; then
|
if [ "$(file -b --mime-type "$f")" = text/x-shellscript ]; then echo "$f"; fi
|
||||||
echo -n "$f "
|
done < <(find . -type f ! \( -path ./.git/\* -or -path \*/target/\* \)) | xargs)
|
||||||
fi
|
echo "shellcheck $files" >&2
|
||||||
done)
|
|
||||||
echo shellcheck $files
|
|
||||||
shellcheck $files
|
shellcheck $files
|
||||||
|
|
||||||
markdownlint:
|
md-lint:
|
||||||
markdownlint-cli2 '**/*.md' '!target'
|
markdownlint-cli2 '**/*.md' '!target'
|
||||||
|
|
||||||
# Format actionlint output for Github Actions if running in CI.
|
# Format actionlint output for Github Actions if running in CI.
|
||||||
|
|
@ -209,52 +200,16 @@ _actionlint-fmt := if env_var_or_default("GITHUB_ACTIONS", "") != "true" { "" }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Lints all GitHub Actions workflows
|
# Lints all GitHub Actions workflows
|
||||||
actions-lint:
|
action-lint:
|
||||||
actionlint \
|
actionlint \
|
||||||
{{ if _actionlint-fmt != '' { "-format '" + _actionlint-fmt + "'" } else { "" } }} \
|
{{ if _actionlint-fmt != '' { "-format '" + _actionlint-fmt + "'" } else { "" } }} \
|
||||||
.github/workflows/*
|
.github/workflows/*
|
||||||
|
|
||||||
# Ensure all devcontainer versions are in sync
|
action-dev-check:
|
||||||
actions-dev-versions:
|
action-dev-check
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
# Display the git history minus dependabot updates
|
||||||
IMAGE=$(json5-to-json <.devcontainer/devcontainer.json |jq -r '.image')
|
history *paths='.':
|
||||||
check_image() {
|
@-git log --oneline --graph --invert-grep --author="dependabot" -- {{ paths }}
|
||||||
if [ "$1" != "$IMAGE" ]; then
|
|
||||||
# Report all line numbers with the unexpected image.
|
|
||||||
for n in $(grep -nF "$1" "$2" | cut -d: -f1) ; do
|
|
||||||
if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
|
|
||||||
echo "::error file=${2},line=${n}::Expected image '${IMAGE}'; found '${1}'">&2
|
|
||||||
else
|
|
||||||
echo "${2}:${n}: Expected image '${IMAGE}'; found '${1}'" >&2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
EX=0
|
|
||||||
# Check workflows for devcontainer images
|
|
||||||
for f in .github/workflows/* ; do
|
|
||||||
# Find all container images that look like our dev image, dropping the
|
|
||||||
# `-suffix` from the tag.
|
|
||||||
for i in $(yq '.jobs.* | (.container | select(.) | (.image // .)) | match("ghcr.io/linkerd/dev:v[0-9]+").string' < "$f") ; do
|
|
||||||
if ! check_image "$i" "$f" ; then
|
|
||||||
EX=$((EX+1))
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
# Check actions for devcontainer images
|
|
||||||
while IFS= read -r f ; do
|
|
||||||
for i in $(awk 'toupper($1) ~ "FROM" { print $2 }' "$f" \
|
|
||||||
| sed -Ene 's,(ghcr\.io/linkerd/dev:v[0-9]+).*,\1,p')
|
|
||||||
do
|
|
||||||
if ! check_image "$i" "$f" ; then
|
|
||||||
EX=$((EX+1))
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done < <(find .github/actions -name Dockerfile\*)
|
|
||||||
exit $EX
|
|
||||||
|
|
||||||
# vim: set ft=make :
|
# vim: set ft=make :
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue