-
Notifications
You must be signed in to change notification settings - Fork 27
161 lines (135 loc) · 5.55 KB
/
smoke-test.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Smoke Test
on:
push:
branches: [ main ]
pull_request:
# Manual trigger
workflow_dispatch:
defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
uses: snapcore/action-build@v1
id: snapcraft
with:
snapcraft-args: snap --output docker_${{ github.run_id}}.snap
- name: Upload
uses: actions/upload-artifact@v4
with:
name: docker_${{ github.run_id}}.snap
path: ${{ steps.snapcraft.outputs.snap }}
smoke-test:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: docker_${{ github.run_id }}.snap
- name: Prep
run: |
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
# TODO figure out a better way to get Go and friends out of our path than dropping a nuke
sudo rm -rf /opt/hostedtoolcache/*
sudo apt-get purge --auto-remove -y 'docker.*' 'containerd.*' 'moby.*' 'runc.*'
sudo rm -rf /var/lib/docker /etc/docker /run/docker* /var/lib/containerd /run/containerd*
sudo ip link delete docker0 || :
sudo apt update
sudo apt install -y snapd
sudo snap refresh
sudo snap refresh --channel beta snapd
sudo snap list
- name: Install
run: |
sudo snap install --dangerous ./docker_${{ github.run_id }}.snap
# it will immediately be failing to start, so let's head that off as quickly as we can
sudo snap stop --disable docker.dockerd
sudo killall dockerd || :
- name: Connect
run: |
echo '{ "log-level": "debug" }' | sudo tee /var/snap/docker/current/config/daemon.json
# normally, snap does this automatically during install, but not when we install from a local file (for security)
sudo snap connect docker:docker-cli docker:docker-daemon
sudo snap connect docker:firewall-control :firewall-control
sudo snap connect docker:home :home
sudo snap connect docker:network-control :network-control
sudo snap connect docker:support :docker-support
sudo snap connect docker:privileged :docker-support
sudo snap stop --disable docker.dockerd # for good measure
sleep 1
sudo snap start --enable docker.dockerd
sleep 1
sudo snap logs docker.dockerd
- name: Verify
run: |
trap 'ps faux | grep -i docker; sudo systemctl status snap.docker.dockerd.service' ERR
sudo dmesg | tail -n20
sleep 1
sudo snap logs -n=20 docker.dockerd
sleep 1
sudo docker version
sudo docker info
sudo docker buildx version
sudo docker compose version
- name: Save & Load
run: |
docker pull hello-world
docker save hello-world > hello-world.tar
xz -T0 < hello-world.tar > hello-world.txz
docker rmi hello-world
docker load --input hello-world.txz
- name: Hello World
run: sudo docker run --rm hello-world
- name: Hello World (journald)
run: |
trap 'echo "error, sad day ($?)"; sleep 1; sudo snap logs -n=20 docker.dockerd; sleep 1; sudo tail -n20 /var/log/*.log; sudo dmesg | tail -n20; sudo journalctl --no-pager | grep DENIED | grep docker' ERR
expectedOutput="testing-journald-log-driver-$RANDOM-$RANDOM"
sudo docker run --name test-journald --log-driver journald bash -c 'echo "$@"' -- "$expectedOutput"
actualOutput="$(sudo docker logs test-journald)"
[ "$actualOutput" = "$expectedOutput" ]
docker rm test-journald
- name: Hello World (init)
run: sudo docker run --rm --init hello-world
- name: Docker Build
run: |
sudo docker build --pull -t debian-hello - <<'EOF'
FROM debian:buster-slim
RUN set -eux; \
apt-get update; \
apt-get install -y hello; \
rm -rf /var/lib/apt/lists/*
CMD ["hello"]
EOF
sudo docker run --rm debian-hello
sudo docker image rm debian-hello
- name: Docker Build (git)
run: |
sudo docker build --pull -t tianon/gosleep https://github.com/tianon/gosleep.git
sudo docker run --rm tianon/gosleep gosleep --help
sudo docker image rm tianon/gosleep
- name: Docker BuildKit
run: |
trap 'echo "error, sad day ($?)"; sleep 1; sudo snap logs -n=20 docker.dockerd; sleep 1; sudo tail -n20 /var/log/*.log; sudo dmesg | tail -n20; sudo journalctl --no-pager | grep DENIED | grep docker' ERR
sudo DOCKER_BUILDKIT=1 docker build --pull -t debian-hello - <<'EOF'
FROM debian:buster-slim
RUN set -eux; \
apt-get update; \
apt-get install -y hello; \
rm -rf /var/lib/apt/lists/*
CMD ["hello"]
EOF
sudo docker run --rm debian-hello
sudo docker image rm debian-hello
- name: Docker BuildKit (git)
run: |
sudo DOCKER_BUILDKIT=1 docker build --pull -t tianon/gosleep https://github.com/tianon/gosleep.git
sudo docker run --rm tianon/gosleep gosleep --help
sudo docker image rm tianon/gosleep