From 7ed3d2b7bc5407a3a9e84862cc7579c381f2c792 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 23 Oct 2026 22:37:00 -0700 Subject: [PATCH] Remove CI leftovers and stale test images - Delete script/docker and script/docker.conf, a SysV init script and upstart config that nothing references since Travis CI was removed - Drop the /opt/docker PATH hack in the Rakefile, also a Travis leftover - Replace swipely/base and tianon/true with hello-world in specs and the unpack task. Both old images are amd64-only and unmaintained; hello-world is tiny and multi-arch, so the suite runs on arm64 hosts - Update the TESTING.md prerequisites Signed-off-by: Tim Smith --- Rakefile | 4 +- TESTING.md | 4 +- script/docker | 149 ---------------------------------- script/docker.conf | 61 -------------- spec/docker/container_spec.rb | 4 +- spec/docker/image_spec.rb | 16 ++-- 6 files changed, 13 insertions(+), 225 deletions(-) delete mode 100644 script/docker delete mode 100644 script/docker.conf diff --git a/Rakefile b/Rakefile index 6c3318ff5..42e0170fd 100644 --- a/Rakefile +++ b/Rakefile @@ -2,8 +2,6 @@ require 'bundler/setup' -ENV['PATH'] = "/opt/docker/:#{ENV['PATH']}" if ENV['CI'] == 'true' - require 'docker' require 'rspec/core/rake_task' @@ -16,7 +14,7 @@ end desc 'Download the necessary base images' task :unpack do - %w( swipely/base registry busybox:uclibc tianon/true debian:stable ).each do |image| + %w( hello-world registry busybox:uclibc debian:stable ).each do |image| system "docker pull #{image}" end end diff --git a/TESTING.md b/TESTING.md index 52e3dc98a..4ea91c20c 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,10 +1,10 @@ # Prerequisites To develop on this gem, you must the following installed: -* a sane Ruby 1.9+ environment with `bundler` +* a Ruby 2.4+ environment with `bundler` ```shell $ gem install bundler ``` -* Docker v1.3.1 or greater +* a currently supported Docker Engine release (or Podman) diff --git a/script/docker b/script/docker deleted file mode 100644 index 357662bff..000000000 --- a/script/docker +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/sh -set -e - -### BEGIN INIT INFO -# Provides: docker -# Required-Start: $syslog $remote_fs -# Required-Stop: $syslog $remote_fs -# Should-Start: cgroupfs-mount cgroup-lite -# Should-Stop: cgroupfs-mount cgroup-lite -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Create lightweight, portable, self-sufficient containers. -# Description: -# Docker is an open-source project to easily create lightweight, portable, -# self-sufficient containers from any application. The same container that a -# developer builds and tests on a laptop can run at scale, in production, on -# VMs, bare metal, OpenStack clusters, public clouds and more. -### END INIT INFO - -export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin - -BASE=$(basename $0) - -# modify these in /etc/default/$BASE (/etc/default/docker) -DOCKER=/usr/bin/$BASE -# This is the pid file managed by docker itself -DOCKER_PIDFILE=/var/run/$BASE.pid -# This is the pid file created/managed by start-stop-daemon -DOCKER_SSD_PIDFILE=/var/run/$BASE-ssd.pid -DOCKER_LOGFILE=/var/log/$BASE.log -DOCKER_OPTS= -DOCKER_DESC="Docker" - -# Get lsb functions -. /lib/lsb/init-functions - -if [ -f /etc/default/$BASE ]; then - . /etc/default/$BASE -fi - -# Check docker is present -if [ ! -x $DOCKER ]; then - log_failure_msg "$DOCKER not present or not executable" - exit 1 -fi - -check_init() { - # see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it directly) - if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then - log_failure_msg "$DOCKER_DESC is managed via upstart, try using service $BASE $1" - exit 1 - fi -} - -fail_unless_root() { - if [ "$(id -u)" != '0' ]; then - log_failure_msg "$DOCKER_DESC must be run as root" - exit 1 - fi -} - -cgroupfs_mount() { - # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount - if grep -v '^#' /etc/fstab | grep -q cgroup \ - || [ ! -e /proc/cgroups ] \ - || [ ! -d /sys/fs/cgroup ]; then - return - fi - if ! mountpoint -q /sys/fs/cgroup; then - mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup - fi - ( - cd /sys/fs/cgroup - for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do - mkdir -p $sys - if ! mountpoint -q $sys; then - if ! mount -n -t cgroup -o $sys cgroup $sys; then - rmdir $sys || true - fi - fi - done - ) -} - -case "$1" in - start) - check_init - - fail_unless_root - - cgroupfs_mount - - touch "$DOCKER_LOGFILE" - chgrp docker "$DOCKER_LOGFILE" - - ulimit -n 1048576 - if [ "$BASH" ]; then - ulimit -u 1048576 - else - ulimit -p 1048576 - fi - - log_begin_msg "Starting $DOCKER_DESC: $BASE" - start-stop-daemon --start --background \ - --no-close \ - --exec "$DOCKER" \ - --pidfile "$DOCKER_SSD_PIDFILE" \ - --make-pidfile \ - -- \ - -d -p "$DOCKER_PIDFILE" \ - $DOCKER_OPTS \ - >> "$DOCKER_LOGFILE" 2>&1 - log_end_msg $? - ;; - - stop) - check_init - fail_unless_root - log_begin_msg "Stopping $DOCKER_DESC: $BASE" - start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" - log_end_msg $? - ;; - - restart) - check_init - fail_unless_root - docker_pid=`cat "$DOCKER_SSD_PIDFILE" 2>/dev/null` - [ -n "$docker_pid" ] \ - && ps -p $docker_pid > /dev/null 2>&1 \ - && $0 stop - $0 start - ;; - - force-reload) - check_init - fail_unless_root - $0 restart - ;; - - status) - check_init - status_of_proc -p "$DOCKER_SSD_PIDFILE" "$DOCKER" "$DOCKER_DESC" - ;; - - *) - echo "Usage: service docker {start|stop|restart|status}" - exit 1 - ;; -esac diff --git a/script/docker.conf b/script/docker.conf deleted file mode 100644 index b2f7882a1..000000000 --- a/script/docker.conf +++ /dev/null @@ -1,61 +0,0 @@ -description "Docker daemon" - -start on (local-filesystems and net-device-up IFACE!=lo) -stop on runlevel [!2345] -limit nofile 524288 1048576 -limit nproc 524288 1048576 - -respawn - -kill timeout 20 - -pre-start script - # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount - if grep -v '^#' /etc/fstab | grep -q cgroup \ - || [ ! -e /proc/cgroups ] \ - || [ ! -d /sys/fs/cgroup ]; then - exit 0 - fi - if ! mountpoint -q /sys/fs/cgroup; then - mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup - fi - ( - cd /sys/fs/cgroup - for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do - mkdir -p $sys - if ! mountpoint -q $sys; then - if ! mount -n -t cgroup -o $sys cgroup $sys; then - rmdir $sys || true - fi - fi - done - ) -end script - -script - # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) - DOCKER=/usr/bin/$UPSTART_JOB - DOCKER_OPTS= - if [ -f /etc/default/$UPSTART_JOB ]; then - . /etc/default/$UPSTART_JOB - fi - exec "$DOCKER" -d $DOCKER_OPTS -end script - -# Don't emit "started" event until docker.sock is ready. -# See https://github.com/docker/docker/issues/6647 -post-start script - DOCKER_OPTS= - if [ -f /etc/default/$UPSTART_JOB ]; then - . /etc/default/$UPSTART_JOB - fi - if ! printf "%s" "$DOCKER_OPTS" | grep -qE -e '-H|--host'; then - while ! [ -e /var/run/docker.sock ]; do - initctl status $UPSTART_JOB | grep -qE "(stop|respawn)/" && exit 1 - echo "Waiting for /var/run/docker.sock" - sleep 0.1 - done - echo "/var/run/docker.sock is up" - fi -end script - diff --git a/spec/docker/container_spec.rb b/spec/docker/container_spec.rb index d032b46cc..3ee9b6451 100644 --- a/spec/docker/container_spec.rb +++ b/spec/docker/container_spec.rb @@ -429,8 +429,8 @@ end describe '#export' do - subject { described_class.create('Cmd' => %w[/true], - 'Image' => 'tianon/true') } + subject { described_class.create('Cmd' => %w[/hello], + 'Image' => 'hello-world') } before { subject.start } after { subject.tap(&:wait).remove } diff --git a/spec/docker/image_spec.rb b/spec/docker/image_spec.rb index 36b023f51..4f53950da 100644 --- a/spec/docker/image_spec.rb +++ b/spec/docker/image_spec.rb @@ -178,7 +178,7 @@ } let(:repo_tag) { "#{ENV['DOCKER_API_USER']}/true" } let(:image) { - described_class.build("FROM tianon/true\n", "t" => repo_tag).refresh! + described_class.build("FROM hello-world\n", "t" => repo_tag).refresh! } after { image.remove(:name => repo_tag, :noprune => true) } @@ -199,7 +199,7 @@ context 'when the image was retrived by get' do let(:image) { - described_class.build("FROM tianon/true\n", "t" => repo_tag).refresh! + described_class.build("FROM hello-world\n", "t" => repo_tag).refresh! described_class.get(repo_tag) } @@ -296,7 +296,7 @@ let(:cmd) { nil } context 'no command configured in image' do - subject { described_class.create('fromImage' => 'swipely/base') } + subject { described_class.create('fromImage' => 'hello-world') } xit 'should raise an error if no command is specified' do begin container @@ -398,7 +398,7 @@ subject { described_class } context 'when the Image does not yet exist and the body is a Hash' do - let(:image) { subject.create('fromImage' => 'swipely/base') } + let(:image) { subject.create('fromImage' => 'hello-world') } let(:creds) { { :username => ENV['DOCKER_API_USER'], @@ -409,9 +409,9 @@ before do skip_without_auth - Docker::Image.create('fromImage' => 'swipely/base').remove + Docker::Image.create('fromImage' => 'hello-world').remove end - after { Docker::Image.create('fromImage' => 'swipely/base') } + after { Docker::Image.create('fromImage' => 'hello-world') } it 'sets the id and sends Docker.creds' do allow(Docker).to receive(:creds).and_return(creds) @@ -520,7 +520,7 @@ after { FileUtils.remove(file) } it 'exports tarball of image to specified file' do - Docker::Image.save('swipely/base', file) + Docker::Image.save('hello-world', file) expect(File.exist?(file)).to eq true expect(File.read(file)).to_not be_nil end @@ -528,7 +528,7 @@ context 'when no filename is specified' do it 'returns raw binary data as string' do - raw = Docker::Image.save('swipely/base') + raw = Docker::Image.save('hello-world') expect(raw).to_not be_nil end end