feat: install stable snapd #466
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Smoke Test | |
on: | |
push: | |
branches: [ main, smoke-test-24.0.5 ] | |
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: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.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 | |
sudo snap install snapd | |
sudo snap refresh 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 |