Merge branch 'deal_with_unset_docker_login' into 'master'
Deal with unset docker login See merge request pub/make-deploy!7
This commit is contained in:
commit
c5ed8be31b
2
apt.mk
2
apt.mk
|
@ -1,4 +1,4 @@
|
||||||
MANDATORY-apt = APT_PACKAGES
|
MANDATORY-apt = DEPLOY_HOSTS SSH_USER APT_PACKAGES DEPLOY_NAME
|
||||||
|
|
||||||
pull-apt:
|
pull-apt:
|
||||||
# nop
|
# nop
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
MANDATORY-compose-file = DEPLOY_HOSTS DEPLOY_TYPE TAG DEPLOY_COMPOSE_FILE DEPLOY_COMPOSE_PROJECT
|
MANDATORY-compose-file = DEPLOY_HOSTS DEPLOY_TYPE SSH_USER DEPLOY_COMPOSE_FILE DEPLOY_COMPOSE_PROJECT
|
||||||
|
|
||||||
|
ifndef DOCKER_LOGIN
|
||||||
|
DOCKER_LOGIN = 0
|
||||||
|
endif
|
||||||
|
|
||||||
pull-compose-file:
|
pull-compose-file:
|
||||||
@- echo "\n### pulling image(s)"
|
@- echo "\n### pulling image(s)"
|
||||||
|
@ -9,7 +13,10 @@ pull-compose-file:
|
||||||
echo "\n#### perfom docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \
|
echo "\n#### perfom docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \
|
||||||
ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \
|
ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \
|
||||||
fi; \
|
fi; \
|
||||||
ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \
|
if test -n "$(DOCKER_IMAGE)" ; \
|
||||||
|
then \
|
||||||
|
ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \
|
||||||
|
fi; \
|
||||||
)
|
)
|
||||||
|
|
||||||
start-compose-file:
|
start-compose-file:
|
||||||
|
|
11
compose.mk
11
compose.mk
|
@ -1,4 +1,8 @@
|
||||||
MANDATORY-compose = DEPLOY_HOSTS DEPLOY_TYPE TAG
|
MANDATORY-compose = DEPLOY_HOSTS DEPLOY_TYPE SSH_USER DEPLOY_NAME
|
||||||
|
|
||||||
|
ifndef DOCKER_LOGIN
|
||||||
|
DOCKER_LOGIN = 0
|
||||||
|
endif
|
||||||
|
|
||||||
pull-compose:
|
pull-compose:
|
||||||
@- echo "\n### pulling image(s)"
|
@- echo "\n### pulling image(s)"
|
||||||
|
@ -9,7 +13,10 @@ pull-compose:
|
||||||
echo "\n#### perfom docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \
|
echo "\n#### perfom docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \
|
||||||
ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \
|
ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \
|
||||||
fi; \
|
fi; \
|
||||||
ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \
|
if test -n "$(DOCKER_IMAGE)" ; \
|
||||||
|
then \
|
||||||
|
ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \
|
||||||
|
fi; \
|
||||||
)
|
)
|
||||||
|
|
||||||
start-compose:
|
start-compose:
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR=$(mktemp -d)
|
||||||
|
TESTS=$DIR/make-deploy/testing
|
||||||
|
|
||||||
|
function prepdir() {
|
||||||
|
mkdir $DIR/make-deploy
|
||||||
|
cp -r * $DIR/make-deploy
|
||||||
|
cd $DIR
|
||||||
|
ln -s make-deploy/Makefile
|
||||||
|
touch secrets.mk
|
||||||
|
echo "::::::::: testing directory root: $DIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleandir(){
|
||||||
|
rm -fr $DIR
|
||||||
|
echo "::::::::: cleanup done"
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_with_minimal_vars_apt(){
|
||||||
|
echo "::::::::: $FUNCNAME ::::::::::::"
|
||||||
|
cp $TESTS/apt_config.mk config.mk
|
||||||
|
make deploy
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_with_minimal_vars_compose(){
|
||||||
|
echo "::::::::: $FUNCNAME ::::::::::::"
|
||||||
|
cp $TESTS/compose_config.mk config.mk
|
||||||
|
cp $TESTS/docker-compose.yml .
|
||||||
|
make deploy
|
||||||
|
rm -f docker-compose.yml
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_with_minimal_vars_compose_file(){
|
||||||
|
echo "::::::::: $FUNCNAME ::::::::::::"
|
||||||
|
cp $TESTS/compose_file_config.mk config.mk
|
||||||
|
cp $TESTS/docker-compose.yml .
|
||||||
|
make deploy
|
||||||
|
rm -f docker-compose.yml
|
||||||
|
}
|
||||||
|
|
||||||
|
prepdir
|
||||||
|
|
||||||
|
test_with_minimal_vars_apt
|
||||||
|
test_with_minimal_vars_compose
|
||||||
|
test_with_minimal_vars_compose_file
|
||||||
|
|
||||||
|
cleandir
|
|
@ -0,0 +1,6 @@
|
||||||
|
DEPLOY_NAME = make-deploy-test-apt
|
||||||
|
DEPLOY_PATH = /tmp
|
||||||
|
DEPLOY_HOSTS = localhost
|
||||||
|
DEPLOY_TYPE = apt
|
||||||
|
SSH_USER = $(USER)
|
||||||
|
APT_PACKAGES = curl
|
|
@ -0,0 +1,5 @@
|
||||||
|
DEPLOY_NAME = make-deploy-test-compose
|
||||||
|
DEPLOY_PATH = /tmp
|
||||||
|
DEPLOY_HOSTS = localhost
|
||||||
|
DEPLOY_TYPE = compose
|
||||||
|
SSH_USER = $(USER)
|
|
@ -0,0 +1,7 @@
|
||||||
|
DEPLOY_NAME = make-deploy-test-compose-file
|
||||||
|
DEPLOY_PATH = /tmp
|
||||||
|
DEPLOY_HOSTS = localhost
|
||||||
|
DEPLOY_TYPE = compose-file
|
||||||
|
SSH_USER = $(USER)
|
||||||
|
DEPLOY_COMPOSE_PROJECT = make-deploy-test-compose-file
|
||||||
|
DEPLOY_COMPOSE_FILE = docker-compose.yml
|
|
@ -0,0 +1,4 @@
|
||||||
|
services:
|
||||||
|
curl:
|
||||||
|
image: "alpine/curl"
|
||||||
|
command: -s -o /dev/null https://www.test.de
|
Loading…
Reference in New Issue