From cfff4337444793415df6452e3d637434b659c0f2 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Mon, 28 Nov 2016 18:02:27 -0800 Subject: [PATCH 1/4] Update login helpers to handle email removal Signed-off-by: Derek McGowan (github: dmcgowan) --- contrib/docker-integration/helpers.bash | 37 +++++++++++++++---------- contrib/docker-integration/tls.bats | 1 - contrib/docker-integration/token.bats | 16 ++++------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/contrib/docker-integration/helpers.bash b/contrib/docker-integration/helpers.bash index 279ad7d6..8760f9cf 100644 --- a/contrib/docker-integration/helpers.bash +++ b/contrib/docker-integration/helpers.bash @@ -32,35 +32,44 @@ function basic_auth_version_check() { fi } +email="a@nowhere.com" + +# docker_t_login calls login with email depending on version +function docker_t_login() { + # Only pass email field pre 1.11, no deprecation warning + parse_version "$GOLEM_DIND_VERSION" + v=$version + parse_version "1.11.0" + if [ "$v" -lt "$version" ]; then + run docker_t login -e $email $@ + else + run docker_t login $@ + fi +} + # login issues a login to docker to the provided server # uses user, password, and email variables set outside of function # requies bats function login() { rm -f /root/.docker/config.json - # Only pass email field pre 1.11, no deprecation warning + docker_t_login -u $user -p $password $1 + if [ "$status" -ne 0 ]; then + echo $output + fi + [ "$status" -eq 0 ] + + # Handle different deprecation warnings parse_version "$GOLEM_DIND_VERSION" v=$version parse_version "1.11.0" if [ "$v" -lt "$version" ]; then - run docker_t login -u $user -p $password -e $email $1 - if [ "$status" -ne 0 ]; then - echo $output - fi - [ "$status" -eq 0 ] # First line is WARNING about credential save or email deprecation (maybe both) [ "${lines[2]}" = "Login Succeeded" -o "${lines[1]}" = "Login Succeeded" ] else - run docker_t login -u $user -p $password $1 - if [ "$status" -ne 0 ]; then - echo $output - fi - echo $output - [ "$status" -eq 0 ] [ "${lines[0]}" = "Login Succeeded" ] fi - } function login_oauth() { @@ -109,7 +118,7 @@ function docker_t() { docker exec dockerdaemon docker $@ } -# build reates a new docker image id from another image +# build creates a new docker image id from another image function build() { docker exec -i dockerdaemon docker build --no-cache -t $1 - < Date: Mon, 28 Nov 2016 18:26:19 -0800 Subject: [PATCH 2/4] Add plugin push/pull tests Signed-off-by: Derek McGowan (github: dmcgowan) --- contrib/docker-integration/docker-compose.yml | 2 +- contrib/docker-integration/golem.conf | 2 +- contrib/docker-integration/plugins.bats | 101 ++++++++++++++++++ .../tokenserver-oauth/Dockerfile | 2 +- .../docker-integration/tokenserver/Dockerfile | 2 +- 5 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 contrib/docker-integration/plugins.bats diff --git a/contrib/docker-integration/docker-compose.yml b/contrib/docker-integration/docker-compose.yml index 4d4f3856..374197ac 100644 --- a/contrib/docker-integration/docker-compose.yml +++ b/contrib/docker-integration/docker-compose.yml @@ -64,7 +64,7 @@ registryv2tokenoauthnotls: - ./tokenserver-oauth/certs/signing.cert:/etc/docker/registry/tokenbundle.pem tokenserveroauth: build: "tokenserver-oauth" - command: "--debug -addr 0.0.0.0:5559 -issuer registry-test -passwd .htpasswd -tlscert tls.cert -tlskey tls.key -key sign.key -realm http://auth.localregistry:5559" + command: "--debug -addr 0.0.0.0:5559 -issuer registry-test -passwd .htpasswd -tlscert tls.cert -tlskey tls.key -key sign.key -realm http://auth.localregistry:5559 -enforce-class" ports: - "5559" malevolent: diff --git a/contrib/docker-integration/golem.conf b/contrib/docker-integration/golem.conf index 99c8d600..eb175707 100644 --- a/contrib/docker-integration/golem.conf +++ b/contrib/docker-integration/golem.conf @@ -1,6 +1,6 @@ [[suite]] dind=true - images=[ "nginx:1.9", "dmcgowan/token-server:simple", "dmcgowan/token-server:oauth", "dmcgowan/malevolent:0.1.0" ] + images=[ "nginx:1.9", "dmcgowan/token-server:simple", "dmcgowan/token-server:oauth", "dmcgowan/malevolent:0.1.0", "dmcgowan/ncat:latest" ] [[suite.pretest]] command="sh ./install_certs.sh /etc/generated_certs.d" diff --git a/contrib/docker-integration/plugins.bats b/contrib/docker-integration/plugins.bats new file mode 100644 index 00000000..3b1d9aa4 --- /dev/null +++ b/contrib/docker-integration/plugins.bats @@ -0,0 +1,101 @@ +#!/usr/bin/env bats + +# This tests pushing and pulling plugins + +load helpers + +user="testuser" +password="testpassword" +base="hello-world" + +#TODO: Create plugin image +function create_plugin() { + plugindir=$(mktemp -d) + + cat - > $plugindir/config.json < Date: Tue, 20 Dec 2016 17:30:22 -0800 Subject: [PATCH 3/4] Add test for 1.13 Use rc4 for support with plugins change Signed-off-by: Derek McGowan (github: dmcgowan) --- contrib/docker-integration/run_multiversion.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/docker-integration/run_multiversion.sh b/contrib/docker-integration/run_multiversion.sh index 118be31e..8a42e75c 100755 --- a/contrib/docker-integration/run_multiversion.sh +++ b/contrib/docker-integration/run_multiversion.sh @@ -54,12 +54,14 @@ time docker pull docker:1.9.1-dind time docker pull docker:1.10.3-dind time docker pull docker:1.11.1-dind time docker pull docker:1.12.3-dind +time docker pull docker:1.13.0-rc5-dind golem -cache $cachedir \ -i "golem-distribution:latest,$distimage,$distversion" \ -i "golem-dind:latest,docker:1.9.1-dind,1.9.1" \ -i "golem-dind:latest,docker:1.10.3-dind,1.10.3" \ -i "golem-dind:latest,docker:1.11.1-dind,1.11.1" \ - -i "golem-dind:latest,docker:1.12.3-dind,1.12.0" \ + -i "golem-dind:latest,docker:1.12.3-dind,1.12.3" \ + -i "golem-dind:latest,docker:1.13.0-rc5-dind,1.13.0" \ $DIR From fd13a2e0a6e8a8f30a11c8b4249fb52826f4f93e Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Thu, 5 Jan 2017 13:41:25 -0800 Subject: [PATCH 4/4] Remove container after export Signed-off-by: Derek McGowan (github: dmcgowan) --- contrib/docker-integration/plugins.bats | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/docker-integration/plugins.bats b/contrib/docker-integration/plugins.bats index 3b1d9aa4..faeae0a7 100644 --- a/contrib/docker-integration/plugins.bats +++ b/contrib/docker-integration/plugins.bats @@ -30,6 +30,8 @@ CONFIGJSON docker export $cid | tar -x -C $plugindir/rootfs + docker rm $cid + daemontmp=$(docker exec dockerdaemon mktemp -d) tar -c -C $plugindir . | docker exec -i dockerdaemon tar -x -C $daemontmp