mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
68 lines
2.5 KiB
YAML
68 lines
2.5 KiB
YAML
services:
|
|
quickstart-test:
|
|
profiles:
|
|
- test
|
|
depends_on:
|
|
wait-for-login:
|
|
condition: service_completed_successfully
|
|
image: golang:${ZITI_GO_VERSION:-noop}-alpine
|
|
networks:
|
|
- quickstart
|
|
# run as the same user as the host, so we can use the host's GOCACHE
|
|
user: ${ZIGGY_UID:-1000}
|
|
volumes:
|
|
# mount the parent dir of the quickstart, which is the top-level of the ziti repo working copy, as /mnt, so we can
|
|
# run the tests in the "edge" Go package
|
|
- ../../../:/mnt
|
|
# re-run tests if significant changes from last result in GOCACHE
|
|
- ${GOCACHE:-${HOME}/.cache/go-build}:/.cache/go-build
|
|
# re-download dep packages if significant changes from last download in GOPATH
|
|
- ${GOPATH:-${HOME}/go}:/go
|
|
working_dir: /mnt
|
|
environment:
|
|
# verbose, tests tagged 'quickstart && manual', manual means test an existing network, don't run a network inside
|
|
# the test process
|
|
GOFLAGS: "-tags=quickstart,manual"
|
|
GOCACHE: /.cache/go-build
|
|
GOPATH: /go
|
|
ZITI_PWD: # default "admin"
|
|
ZITI_CTRL_ADVERTISED_ADDRESS: ${EXTERNAL_DNS:-quickstart}
|
|
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS: ${EXTERNAL_DNS:-quickstart} # deprecated by ZITI_CTRL_ADVERTISED_ADDRESS
|
|
ZITI_CTRL_ADVERTISED_PORT: ${ZITI_CTRL_ADVERTISED_PORT:-1280}
|
|
ZITI_CTRL_EDGE_ADVERTISED_PORT: ${ZITI_CTRL_ADVERTISED_PORT:-1280} # deprecated by ZITI_CTRL_ADVERTISED_PORT
|
|
ZITI_ROUTER_ADVERTISED_ADDRESS: ${EXTERNAL_DNS:-quickstart}
|
|
ZITI_ROUTER_PORT: ${ZITI_ROUTER_PORT:-3022}
|
|
ZITI_ROUTER_NAME: ${ZITI_ROUTER_NAME:-quickstart-router}
|
|
command: go test -v ./ziti/cmd/edge/...
|
|
|
|
wait-for-login:
|
|
profiles:
|
|
- test
|
|
image: ${ZITI_QUICK_IMAGE:-docker.io/openziti/ziti-cli}:${ZITI_QUICK_TAG:-latest}
|
|
networks:
|
|
- quickstart
|
|
# run as the same user as the host, so we can write in ~/.config/ziti
|
|
user: ${ZIGGY_UID:-1000}
|
|
environment:
|
|
HOME: /home/ziggy
|
|
volumes:
|
|
- ${ZITI_HOME:-ziti_home}:/home/ziggy
|
|
entrypoint:
|
|
- bash
|
|
- -euxc
|
|
- |
|
|
set -o pipefail
|
|
ATTEMPTS=10
|
|
DELAY=3
|
|
until !((ATTEMPTS)) || ziti $${@}; do
|
|
(( ATTEMPTS-- ))
|
|
echo "Waiting for controller to start"
|
|
sleep $${DELAY}
|
|
done
|
|
ziti $${@}
|
|
command: >
|
|
-- edge login
|
|
${EXTERNAL_DNS:-quickstart}:${ZITI_CTRL_ADVERTISED_PORT:-1280}
|
|
-u ${ZITI_USER:-admin} -p ${ZITI_PWD:-admin}
|
|
--ca /home/ziggy/quickstart/pki/root-ca/certs/root-ca.cert
|