mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
- Repo names: ziti-* → zt-* - Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt - Docker images: hanzozt/ziti-* → hanzozt/zt-* - C/Java/JS symbols: ziti_* → zt_* - File and directory names updated
78 lines
3.0 KiB
YAML
78 lines
3.0 KiB
YAML
services:
|
|
quickstart:
|
|
build:
|
|
# the build context is the root of the zt repo so that BuildKit can access the built zt executable in /build
|
|
# and the Dockerfile
|
|
context: ../../../
|
|
dockerfile: ./dist/docker-images/zt-cli/Dockerfile
|
|
args:
|
|
# path of the directory containing the locally-built zt executable; relative to the build context
|
|
ARTIFACTS_DIR: ${ARTIFACTS_DIR:-./build}
|
|
DOCKER_BUILD_DIR: ${DOCKER_BUILD_DIR:-./dist/docker-images/zt-cli}
|
|
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 zt 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: ${ZITI_CTRL_ADVERTISED_ADDRESS:-quickstart}
|
|
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS: ${ZITI_CTRL_ADVERTISED_ADDRESS:-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: ${ZITI_CTRL_ADVERTISED_ADDRESS:-quickstart}
|
|
ZITI_ROUTER_PORT: ${ZITI_ROUTER_PORT:-3022}
|
|
ZITI_ROUTER_NAME: ${ZITI_ROUTER_NAME:-quickstart-router}
|
|
command: go test -v ./zt/cmd/edge/...
|
|
|
|
wait-for-login:
|
|
profiles:
|
|
- test
|
|
image: ${ZITI_CLI_IMAGE:-docker.io/hanzozt/zt-controller}:${ZITI_CLI_TAG:-latest}
|
|
networks:
|
|
- quickstart
|
|
# run as the same user as the host, so we can write in ~/.config/zt
|
|
user: ${ZIGGY_UID:-1000}
|
|
environment:
|
|
HOME: /home/ziggy
|
|
volumes:
|
|
- ${ZITI_HOME:-zt_home}:/home/ziggy
|
|
entrypoint:
|
|
- bash
|
|
- -euxc
|
|
- |
|
|
set -o pipefail
|
|
ATTEMPTS=10
|
|
DELAY=3
|
|
until ! (( --ATTEMPTS )) || zt $${@}
|
|
do
|
|
echo "Waiting for controller to start"
|
|
sleep $${DELAY}
|
|
done
|
|
zt $${@}
|
|
command: >
|
|
-- edge login
|
|
${ZITI_CTRL_ADVERTISED_ADDRESS:-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
|