diff --git a/.travis.yml b/.travis.yml index 4f9cf73..448718f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,18 @@ sudo: required services: - docker - + script: - make build + +deploy: + - provider: script + script: make test_release + on: + branch: master + tags: true + condition: '$TRAVIS_TAG =~ ^[0-9]+(\.[0-9]+)*$' + - provider: script + script: make test_master + on: + branch: master diff --git a/Makefile b/Makefile index 75196aa..ce7031e 100644 --- a/Makefile +++ b/Makefile @@ -26,3 +26,11 @@ ssh: IP=$$(docker inspect $$ID | grep IPAddr | sed 's/.*: "//; s/".*//') && \ echo "SSHing into $$IP" && \ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i image/services/sshd/keys/insecure_key root@$$IP + +test_release: + echo test_release + env + +test_master: + echo test_master + env diff --git a/image/Dockerfile b/image/Dockerfile index fdfaae1..f72dde3 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -6,7 +6,6 @@ COPY . /bd_build RUN /bd_build/prepare.sh && \ /bd_build/system_services.sh && \ /bd_build/utilities.sh && \ - /bd_build/fix_pam_bug.sh && \ /bd_build/cleanup.sh ENV DEBIAN_FRONTEND="teletype" \ diff --git a/image/bin/my_init b/image/bin/my_init index a6ded83..7e95ed2 100755 --- a/image/bin/my_init +++ b/image/bin/my_init @@ -12,6 +12,8 @@ import stat import sys import time +ENV_INIT_DIRECTORY = os.environ.get('ENV_INIT_DIRECTORY', '/etc/my_init.d') + KILL_PROCESS_TIMEOUT = int(os.environ.get('KILL_PROCESS_TIMEOUT', 5)) KILL_ALL_PROCESSES_TIMEOUT = int(os.environ.get('KILL_ALL_PROCESSES_TIMEOUT', 5)) @@ -20,7 +22,7 @@ LOG_LEVEL_WARN = 1 LOG_LEVEL_INFO = 2 LOG_LEVEL_DEBUG = 3 -SHENV_NAME_WHITELIST_REGEX = re.compile('[^\w\-_\.]') +SHENV_NAME_WHITELIST_REGEX = re.compile('\W') log_level = None @@ -130,6 +132,7 @@ def shquote(s): def sanitize_shenvname(s): + """Return string with [0-9a-zA-Z_] characters""" return re.sub(SHENV_NAME_WHITELIST_REGEX, "_", s) @@ -249,9 +252,9 @@ def kill_all_processes(time_limit): def run_startup_files(): - # Run /etc/my_init.d/* - for name in listdir("/etc/my_init.d"): - filename = "/etc/my_init.d/" + name + # Run ENV_INIT_DIRECTORY/* + for name in listdir(ENV_INIT_DIRECTORY): + filename = os.path.join(ENV_INIT_DIRECTORY, name) if is_exe(filename): info("Running %s..." % filename) run_command_killable_and_import_envvars(filename) diff --git a/image/fix_pam_bug.sh b/image/fix_pam_bug.sh deleted file mode 100755 index ca4be4e..0000000 --- a/image/fix_pam_bug.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -set -e -source /bd_build/buildconfig -set -x - -# Fixes https://github.com/docker/docker/issues/6345 -# The Github is closed, but some apps such as pbuilder still triggers it. - -export CONFIGURE_OPTS=--disable-audit -cd /tmp - -$minimal_apt_get_install gdebi-core -apt-get build-dep -y --no-install-recommends pam -apt-get source -y -b pam -gdebi -n libpam-doc*.deb libpam-modules*.deb libpam-runtime*.deb libpam0g*.deb -rm -rf *.deb *.gz *.dsc *.changes pam-* - -# Unfortunately there is no way to automatically remove build deps, so we do this manually. -apt-get remove -y gdebi-core autoconf automake autopoint autotools-dev binutils bsdmainutils \ - build-essential bzip2 cpp cpp-5 debhelper dh-autoreconf dh-strip-nondeterminism \ - diffstat docbook-xml docbook-xsl dpkg-dev flex g++ g++-5 gcc gcc-5 gettext gettext-base \ - groff-base intltool-debian libarchive-zip-perl libasan2 libasprintf0v5 libatomic1 \ - libaudit-dev libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libcrack2 libcrack2-dev libcroco3 \ - libdb-dev libdb5.3-dev libdpkg-perl libfile-stripnondeterminism-perl libfl-dev libgc1c2 \ - libgcc-5-dev libgdbm3 libgomp1 libgpm2 libicu55 libisl15 libitm1 liblsan0 libmpc3 \ - libmpfr4 libmpx0 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libperl5.22 \ - libpipeline1 libquadmath0 libselinux1-dev libsepol1-dev libsigsegv2 libstdc++-5-dev \ - libtimedate-perl libtool libtsan0 libubsan0 libunistring0 libxml2 libxml2-utils \ - libxslt1.1 linux-libc-dev m4 make man-db patch perl perl-modules-5.22 pkg-config \ - po-debconf quilt sgml-base sgml-data w3m xml-core xsltproc xz-utils - -apt-get remove -y gdebi-core -apt-get autoremove -y