mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 03:57:43 +01:00
run tests against native dokku
This commit is contained in:
committed by
Jose Diaz-Gonzalez
parent
ded056d003
commit
1437b77c6c
@@ -10,6 +10,8 @@ jobs:
|
||||
make ci-dependencies
|
||||
- run: |
|
||||
./tests/ci/setup.sh
|
||||
- run: |
|
||||
echo 'export DOKKU_SKIP_CLEANUP=true' | sudo tee /home/dokku/.dokkurc/dokku_skip_cleanup
|
||||
- run: |
|
||||
if [[ "$(lsb_release -rs)" == "14.04" ]]; then
|
||||
# dokku.me now resolves to 10.0.0.2. add 10.0.0.2/24 to eth0
|
||||
|
||||
30
tests.mk
30
tests.mk
@@ -1,4 +1,5 @@
|
||||
SYSTEM := $(shell sh -c 'uname -s 2>/dev/null')
|
||||
DOKKU_SSH_PORT ?= 22
|
||||
|
||||
bats:
|
||||
ifeq ($(SYSTEM),Darwin)
|
||||
@@ -47,7 +48,7 @@ ci-dependencies: bats shellcheck xmlstarlet
|
||||
setup-deploy-tests:
|
||||
ifdef ENABLE_DOKKU_TRACE
|
||||
echo "-----> Enabling tracing"
|
||||
docker exec -ti dokku bash -c 'echo "export DOKKU_TRACE=1" >> /home/dokku/dokkurc'
|
||||
dokku trace:on
|
||||
endif
|
||||
@echo "Setting dokku.me in /etc/hosts"
|
||||
sudo /bin/bash -c "[[ `ping -c1 dokku.me >/dev/null 2>&1; echo $$?` -eq 0 ]] || echo \"127.0.0.1 dokku.me *.dokku.me www.test.app.dokku.me\" >> /etc/hosts"
|
||||
@@ -60,20 +61,35 @@ endif
|
||||
|
||||
@echo "-----> Setting up ssh config..."
|
||||
ifneq ($(shell ls /root/.ssh/config >/dev/null 2>&1 ; echo $$?),0)
|
||||
echo "Host dokku.me \\r\\n Port 3022 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
echo "Host dokku.me \\r\\n Port $(DOKKU_SSH_PORT) \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
else ifeq ($(shell grep dokku.me /root/.ssh/config),)
|
||||
echo "Host dokku.me \\r\\n Port 3022 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
echo "Host dokku.me \\r\\n Port $(DOKKU_SSH_PORT) \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard /etc/ssh/sshd_config),)
|
||||
sed --in-place "s/^#Port 22$\/Port 22/g" /etc/ssh/sshd_config
|
||||
ifeq ($(shell grep 22333 /etc/ssh/sshd_config),)
|
||||
sed --in-place "s:^Port 22:Port 22 \\nPort 22333:g" /etc/ssh/sshd_config
|
||||
endif
|
||||
service ssh restart
|
||||
endif
|
||||
|
||||
@echo "-----> Installing SSH public key..."
|
||||
docker exec -ti dokku bash -c "sshcommand acl-remove dokku test"
|
||||
docker exec -ti dokku bash -c "echo `cat /root/.ssh/dokku_test_rsa.pub` | sshcommand acl-add dokku test"
|
||||
sudo sshcommand acl-remove dokku test
|
||||
cat /root/.ssh/dokku_test_rsa.pub | sudo sshcommand acl-add dokku test
|
||||
# docker exec -ti dokku bash -c "sshcommand acl-remove dokku test"
|
||||
# docker exec -ti dokku bash -c "echo `cat /root/.ssh/dokku_test_rsa.pub` | sshcommand acl-add dokku test"
|
||||
|
||||
@echo "-----> Intitial SSH connection to populate known_hosts..."
|
||||
sudo ssh -o StrictHostKeyChecking=no dokku@dokku.me help >/dev/null
|
||||
sudo ssh -o StrictHostKeyChecking=no dokku@127.0.0.1 help >/dev/null
|
||||
ssh -o StrictHostKeyChecking=no dokku@dokku.me help >/dev/null
|
||||
ssh -o StrictHostKeyChecking=no dokku@127.0.0.1 help >/dev/null
|
||||
|
||||
ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),)
|
||||
@echo "-----> Setting default VHOST to dokku.me..."
|
||||
echo "dokku.me" > /home/dokku/VHOST
|
||||
endif
|
||||
|
||||
lint-setup:
|
||||
@mkdir -p test-results/shellcheck tmp/shellcheck
|
||||
|
||||
@@ -27,6 +27,11 @@ install_dependencies() {
|
||||
PROCFILE_UTIL_PACKAGE_NAME="procfile-util_${PROCFILE_VERSION}_amd64.deb"
|
||||
curl -L "https://packagecloud.io/dokku/dokku/packages/ubuntu/trusty/procfile-util_${PROCFILE_VERSION}_amd64.deb/download.deb" -o "$ROOT_DIR/build/${PROCFILE_UTIL_PACKAGE_NAME}"
|
||||
|
||||
sudo add-apt-repository -y ppa:nginx/stable
|
||||
sudo apt-get update
|
||||
sudo apt-get -qq -y install nginx
|
||||
sudo cp "${ROOT_DIR}/tests/dhparam.pem" /etc/nginx/dhparam.pem
|
||||
|
||||
sudo dpkg -i "${ROOT_DIR}/build/$HEROKUISH_PACKAGE_NAME" \
|
||||
"${ROOT_DIR}/build/$PLUGN_PACKAGE_NAME" \
|
||||
"${ROOT_DIR}/build/$SSHCOMMAND_PACKAGE_NAME" \
|
||||
@@ -37,6 +42,29 @@ install_dependencies() {
|
||||
build_dokku() {
|
||||
echo "=====> build_dokku on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
"${ROOT_DIR}/contrib/release-dokku" build
|
||||
}
|
||||
|
||||
install_dokku() {
|
||||
echo "=====> install_dokku on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
|
||||
if [[ "$FROM_SOURCE" == "true" ]]; then
|
||||
sudo -E CI=true make -e install
|
||||
return
|
||||
fi
|
||||
|
||||
build_dokku
|
||||
|
||||
echo "dokku dokku/hostname string dokku.me" | sudo debconf-set-selections
|
||||
echo "dokku dokku/key_file string /root/.ssh/id_rsa.pub" | sudo debconf-set-selections
|
||||
echo "dokku dokku/nginx_enable boolean true" | sudo debconf-set-selections
|
||||
echo "dokku dokku/skip_key_file boolean true" | sudo debconf-set-selections
|
||||
echo "dokku dokku/vhost_enable boolean true" | sudo debconf-set-selections
|
||||
echo "dokku dokku/web_config boolean false" | sudo debconf-set-selections
|
||||
sudo dpkg -i "$(cat "${ROOT_DIR}/build/deb-filename")"
|
||||
}
|
||||
|
||||
build_dokku_docker_image() {
|
||||
echo "=====> build_dokku_docker_image on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
docker build -t dokku/dokku:test .
|
||||
}
|
||||
|
||||
@@ -75,30 +103,23 @@ check_container() {
|
||||
done
|
||||
}
|
||||
|
||||
install_dokku() {
|
||||
echo "=====> install_dokku on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
|
||||
if [[ "$FROM_SOURCE" == "true" ]]; then
|
||||
sudo -E CI=true make -e install
|
||||
return
|
||||
fi
|
||||
|
||||
build_dokku
|
||||
run_dokku_container
|
||||
|
||||
sudo mkdir -p /usr/local/bin
|
||||
sudo cp -fv contrib/dokku-docker-bin.sh /usr/local/bin/dokku
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2120
|
||||
setup_circle() {
|
||||
echo "=====> setup_circle on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
sudo -E CI=true make -e sshcommand
|
||||
# need to add the dokku user to the docker group
|
||||
sudo usermod -G docker dokku
|
||||
[[ "$1" == "buildstack" ]] && BUILD_STACK=true make -e stack
|
||||
|
||||
install_dependencies
|
||||
install_dokku
|
||||
|
||||
sudo -E make -e setup-deploy-tests
|
||||
lsb_release -a
|
||||
# setup .dokkurc
|
||||
sudo -E mkdir -p /home/dokku/.dokkurc
|
||||
sudo -E chown dokku:ubuntu /home/dokku/.dokkurc
|
||||
sudo -E chmod 775 /home/dokku/.dokkurc
|
||||
# pull node:4 image for testing
|
||||
sudo docker pull node:4
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user