Skip to content

Commit

Permalink
Build namespace can now be changed so that the entire image suite can be
Browse files Browse the repository at this point in the history
stored under a different user or organisation, primarily to keep test
images separate from production images.
  • Loading branch information
Gary Wisniewski committed Nov 9, 2015
1 parent 7e64238 commit d0b02e6
Show file tree
Hide file tree
Showing 26 changed files with 42 additions and 32 deletions.
6 changes: 4 additions & 2 deletions Makefile
@@ -1,3 +1,5 @@
include include/version.inc

TARGETS=baseimage apache lamp lemp alpinebase alpinejava alpine-nginx-php centosbase
SHELL=/bin/bash

Expand All @@ -11,7 +13,7 @@ clean:
rm -rf `find . -name '*~'` `find . -name '_temp_' -type d` test_logs

push: test
for sf in $(TARGETS); do docker push chapdev/chaperone-$$sf; done
for sf in $(TARGETS); do docker push $(IMAGE_NAMESPACE)/chaperone-$$sf; done

push-only:
for sf in $(TARGETS); do docker push chapdev/chaperone-$$sf; done
for sf in $(TARGETS); do docker push $(IMAGE_NAMESPACE)/chaperone-$$sf; done
File renamed without changes.
2 changes: 1 addition & 1 deletion alpine-nginx-php/tests/tasks-np.elt
@@ -1,7 +1,7 @@
#!/usr/bin/env expect-test-command

>TASK get-help
<for Image: chapdev/alpine-nginx-php
<for Image: $EL_TEST_NAMESPACE/alpine-nginx-php
<there will be a default sample site
>TASK get-launcher | sh
<The run-alpine-nginx-php.sh script is a quick-start for launching
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions alpinebase/tests/tasks-alpinebase.elt
Expand Up @@ -5,7 +5,7 @@
# Test get-help command

>TASK get-help
<for Image: chapdev/chaperone-alpinebase
<for Image: $EL_TEST_NAMESPACE/chaperone-alpinebase
<Take a look at the configuration files

# And get-launcher. See if we can run using the launcher.
Expand All @@ -23,7 +23,7 @@

>TASK get-chaplocal | sh
<is ready to use
<the image 'chapdev/chaperone-alpinebase' will be used
<the image '$EL_TEST_NAMESPACE/chaperone-alpinebase' will be used
>./chaplocal cltest
<Extracting /apps default directory
</alpinebase/tests/_temp_/cltest to tailor it for your application
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions alpinejava/tests/tasks-alpinejava.elt
Expand Up @@ -5,7 +5,7 @@
# Test get-help command

>TASK get-help
<for Image: chapdev/chaperone-alpinejava
<for Image: $EL_TEST_NAMESPACE/chaperone-alpinejava
<Take a look at the configuration files

# And get-launcher. See if we can run using the launcher.
Expand All @@ -23,7 +23,7 @@

>TASK get-chaplocal | sh
<is ready to use
<the image 'chapdev/chaperone-alpinejava' will be used
<the image '$EL_TEST_NAMESPACE/chaperone-alpinejava' will be used
>./chaplocal cltest
<Extracting /apps default directory
</alpinejava/tests/_temp_/cltest to tailor it for your application
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apache/tests/tasks-apache.elt
@@ -1,7 +1,7 @@
#!/usr/bin/env expect-test-command

>TASK get-help
<for Image: chapdev/chaperone-apache
<for Image: $EL_TEST_NAMESPACE/chaperone-apache
<there will be a default sample site
>TASK get-launcher | sh
<The run-apache.sh script is a quick-start for launching
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion baseimage/setup/apps/bin/chaplocal
Expand Up @@ -3,7 +3,7 @@
# for development or other purposes.

DEFAULT_IMAGE="chapdev/chaperone-baseimage"
VERSTR="chaplocal version 1.31"
VERSTR="chaplocal version 1.40"

if [ "$CHAP_SERVICE_NAME" != "" ]; then
echo "The 'chaplocal' script is not intended to be run inside a container,"
Expand Down
2 changes: 1 addition & 1 deletion baseimage/setup/apps/bin/get-launcher
Expand Up @@ -5,7 +5,7 @@ if [ "$CHAP_SERVICE_NAME" != "" ]; then
fi

if [ "$CHAP_TASK_MODE" != "1" ]; then
echo "get-chaplocal' should only be run in chaperone --task mode from the docker host"
echo "get-launcher' should only be run in chaperone --task mode from the docker host"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion baseimage/setup/apps/etc/skel/clone/build.sh.tpl
Expand Up @@ -15,7 +15,7 @@ if [ "$CHAP_SERVICE_NAME" != "" ]; then
fi

# Uncomment to default to your new derivative image name...
#prodimage="%(PARENT_IMAGE:|chapdev/*|%(PARENT_IMAGE:/^chapdev/mylocal/)|%(PARENT_IMAGE))"
#prodimage="%(PARENT_IMAGE:|%(IMAGE_NAMESPACE)/*|%(PARENT_IMAGE:/^%(IMAGE_NAMESPACE)/mylocal/)|%(PARENT_IMAGE))"

[ "$1" != "" ] && prodimage="$1"

Expand Down
10 changes: 5 additions & 5 deletions baseimage/setup/apps/etc/skel/shell_vars.inc
Expand Up @@ -2,14 +2,14 @@
# available in templates. See bin/get-help and bin/get-launcher.

source $APPS_DIR/etc/version.inc
export IMAGE_VERSION IMAGE_ARCH
export IMAGE_VERSION IMAGE_ARCH IMAGE_NAMESPACE
export PARENT_IMAGE=$IMAGE_NAME

# The image name, without the prefix.
if [[ "$PARENT_IMAGE" == chapdev/* ]]; then
# Standard chapdev naming. Remove chapdev/chaperone- or just chapdev/
IMAGE_BASENAME=${PARENT_IMAGE/*chapdev\/chaperone-/}
export IMAGE_BASENAME=${IMAGE_BASENAME/*chapdev\//}
if [[ "$PARENT_IMAGE" == $IMAGE_NAMESPACE/* ]]; then
# Standard namespace naming. Remove namespace/chaperone- or just namespace/
IMAGE_BASENAME=${PARENT_IMAGE/*$IMAGE_NAMESPACE\/chaperone-/}
export IMAGE_BASENAME=${IMAGE_BASENAME/*$IMAGE_NAMESPACE\//}
else
export IMAGE_BASENAME=${PARENT_IMAGE#*/} # others just strip off username
fi
Expand Down
2 changes: 1 addition & 1 deletion baseimage/tests/inetd-baseimage.elt
Expand Up @@ -6,7 +6,7 @@

>TASK get-chaplocal | sh
<is ready to use
<the image 'chapdev/chaperone-baseimage' will be used
<the image '$EL_TEST_NAMESPACE/chaperone-baseimage' will be used
>./chaplocal inetd
<Extracting /apps default directory
</baseimage/tests/_temp_/inetd to tailor it for your application
Expand Down
4 changes: 2 additions & 2 deletions baseimage/tests/tasks-baseimage.elt
Expand Up @@ -5,7 +5,7 @@
# Test get-help command

>TASK get-help
<for Image: chapdev/chaperone-baseimage
<for Image: $EL_TEST_NAMESPACE/chaperone-baseimage
<Take a look at the configuration files

# And get-launcher. See if we can run using the launcher.
Expand All @@ -22,7 +22,7 @@

>TASK get-chaplocal | sh
<is ready to use
<the image 'chapdev/chaperone-baseimage' will be used
<the image '$EL_TEST_NAMESPACE/chaperone-baseimage' will be used
>./chaplocal cltest
<Extracting /apps default directory
</baseimage/tests/_temp_/cltest to tailor it for your application
Expand Down
9 changes: 6 additions & 3 deletions bin/test-driver
Expand Up @@ -5,10 +5,13 @@ function relpath() { python -c "import os; print(os.path.relpath('$1', '$2' or o

TESTDIR=$(readlink -f $1)
TMPDIR=$TESTDIR/_temp_
IMAGE_NAME=$2
LOGDIR=$3
IMAGE_NAMESPACE=$2
IMAGE_NAME=$3
LOGDIR=$4
LOGFILE=$LOGDIR/$IMAGE_NAME.log
export EL_TEST_IMAGE=chapdev/$IMAGE_NAME

export EL_TEST_IMAGE=$IMAGE_NAMESPACE/$IMAGE_NAME
export EL_TEST_NAMESPACE=$IMAGE_NAMESPACE

if [ ! -d $TESTDIR ]; then
exit
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion centosbase/tests/inetd-centosbase.elt
Expand Up @@ -6,7 +6,7 @@

>TASK get-chaplocal | sh
<is ready to use
<the image 'chapdev/chaperone-centosbase' will be used
<the image '$EL_TEST_NAMESPACE/chaperone-centosbase' will be used
>./chaplocal inetd
<Extracting /apps default directory
</centosbase/tests/_temp_/inetd to tailor it for your application
Expand Down
4 changes: 2 additions & 2 deletions centosbase/tests/tasks-centosbase.elt
Expand Up @@ -5,7 +5,7 @@
# Test get-help command

>TASK get-help
<for Image: chapdev/chaperone-centosbase
<for Image: $EL_TEST_NAMESPACE/chaperone-centosbase
<Take a look at the configuration files

# And get-launcher. See if we can run using the launcher.
Expand All @@ -22,7 +22,7 @@

>TASK get-chaplocal | sh
<is ready to use
<the image 'chapdev/chaperone-centosbase' will be used
<the image '$EL_TEST_NAMESPACE/chaperone-centosbase' will be used
>./chaplocal cltest
<Extracting /apps default directory
</centosbase/tests/_temp_/cltest to tailor it for your application
Expand Down
12 changes: 8 additions & 4 deletions include/make.inc
Expand Up @@ -5,22 +5,26 @@ export TOPLEV_DIR := $(subst /include/make.inc,,$(this_file))
# so it contains nothing fancy.
include $(TOPLEV_DIR)/include/version.inc

FULLNAME = chapdev/$(BASENAME)
FULLNAME = $(IMAGE_NAMESPACE)/$(BASENAME)
VERSION = $(IMAGE_VERSION)-$(IMAGE_ARCH)

this_file := $(abspath $(lastword $(MAKEFILE_LIST)))
PATH := $(TOPLEV_DIR)/bin:$(PATH)

DOCKER_BUILD=\
echo "IMAGE_NAME=$(FULLNAME)" | cat $(TOPLEV_DIR)/include/version.inc - >setup/this_version.inc; \
[ -f Dockerfile.tpl ] && sed "s|FROM chapdev/|FROM $(IMAGE_NAMESPACE)/|" <Dockerfile.tpl >Dockerfile; \
tar czh . | docker build -t $(FULLNAME):$(VERSION) --rm -; docker tag -f $(FULLNAME):$(VERSION) $(FULLNAME):latest; \
rm setup/this_version.inc
rm setup/this_version.inc; \
[ -f Dockerfile.tpl ] && rm Dockerfile
DOCKER_REBUILD=\
echo "IMAGE_NAME=$(FULLNAME)" | cat $(TOPLEV_DIR)/include/version.inc - >setup/this_version.inc; \
[ -f Dockerfile.tpl ] && sed "s|FROM chapdev/|FROM $(IMAGE_NAMESPACE)/|" <Dockerfile.tpl >Dockerfile; \
tar czh . | docker build -t $(FULLNAME):$(VERSION) --no-cache=true --rm -; docker tag -f $(FULLNAME):$(VERSION) $(FULLNAME):latest; \
rm setup/this_version.inc
rm setup/this_version.inc; \
[ -f Dockerfile.tpl ] && rm Dockerfile

RUN_TESTS=test-driver tests $(BASENAME) $(TOPLEV_DIR)/test_logs
RUN_TESTS=test-driver tests $(IMAGE_NAMESPACE) $(BASENAME) $(TOPLEV_DIR)/test_logs

.PHONY: all build test

Expand Down
3 changes: 2 additions & 1 deletion include/version.inc
@@ -1,2 +1,3 @@
IMAGE_NAMESPACE=chapdev
IMAGE_ARCH=U14
IMAGE_VERSION=1.0.12
IMAGE_VERSION=1.0.13
File renamed without changes.
2 changes: 1 addition & 1 deletion lamp/tests/tasks-lamp.elt
@@ -1,7 +1,7 @@
#!/usr/bin/env expect-test-command

>TASK get-help
<for Image: chapdev/chaperone-lamp
<for Image: $EL_TEST_NAMESPACE/chaperone-lamp
<there will be a default sample site
>TASK get-launcher | sh
<The run-lamp.sh script is a quick-start for launching
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lemp/tests/tasks-lemp.elt
@@ -1,7 +1,7 @@
#!/usr/bin/env expect-test-command

>TASK get-help
<for Image: chapdev/chaperone-lemp
<for Image: $EL_TEST_NAMESPACE/chaperone-lemp
<there will be a default sample site
>TASK get-launcher | sh
<The run-lemp.sh script is a quick-start for launching
Expand Down

0 comments on commit d0b02e6

Please sign in to comment.