forked from linkerd/linkerd2
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (44 loc) · 1.64 KB
/
devcontainer.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Devcontainer
# When a pull request is opened that changes the Devcontainer configuration,
# ensure that the container continues to build properly.
on:
pull_request:
paths:
- .devcontainer/devcontainer.json
- .github/workflows/devcontainer.yml
- rust-toolchain
permissions:
contents: read
jobs:
rust-version:
runs-on: ubuntu-latest
container: ghcr.io/linkerd/dev:v32-rust
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- run: |
dev=$(cargo version | cut -d' ' -f2)
tc=$(cat rust-toolchain)
if [ "$dev" != "$tc" ]; then
echo "::error file=rust-toolchain,line=1::rust-toolchain ($tc) does not match devcontainer ($dev)"
exit 1
fi
devcontainer-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get -y --no-install-recommends install jq
- run: |
# Strip jsonc comments because `jq` doesn't support them.
image=$(sed -E '/^\s*\/\/.*/d' .devcontainer/devcontainer.json |jq -Mr .image)
line=$(grep -nF '"image"' .devcontainer/devcontainer.json |cut -d':' -f1 |head -n1)
if [ "$image" == "null" ]; then
echo "::error file=.devcontainer/devcontainer.json,line=$line::Missing image"
exit 1
fi
if ! docker pull "$image" ; then
echo "::error file=.devcontainer/devcontainer.json,line=$line::Unable to pull image: $image"
exit 1
fi