run the golden suite against the CLI too, and pin every delta

Both engines now go through the same 68 cases. 31 produce byte-identical
output; the rest have a recorded CLI expectation and a reason in DELTAS.md,
the bulk of it being that the CLI does not shell out to a recursive make and
calls compose once per project.

Fixed while comparing: the CLI was missing the COMPOSE_FILE_* defaults, so
overlays such as supabase.labels.yml would not have been loaded at all.
This commit is contained in:
Yann Autissier
2026-09-03 18:39:23 +02:00
parent a346d4f4e1
commit 35999574bd
48 changed files with 296 additions and 75 deletions
+2 -1
View File
@@ -5,8 +5,9 @@ SHELLSPEC ?= shellspec
SHELLCHECK ?= shellcheck SHELLCHECK ?= shellcheck
.PHONY: $(DEV_TARGETS) .PHONY: $(DEV_TARGETS)
test: ## Run unit + golden tests test: ## Run unit + golden tests against both engines
$(SHELLSPEC) $(SHELLSPEC)
MYOS_ENGINE=cli $(SHELLSPEC) spec/golden
test-unit: ## Run unit tests only test-unit: ## Run unit tests only
$(SHELLSPEC) spec/unit $(SHELLSPEC) spec/unit
test-golden: ## Run golden tests only (MYOS_ENGINE=legacy|cli) test-golden: ## Run golden tests only (MYOS_ENGINE=legacy|cli)
+24 -6
View File
@@ -123,22 +123,34 @@ ENV=${ENV:-local}
myos_dotenv_load "$WORKDIR/.env.$ENV" myos_dotenv_load "$WORKDIR/.env.$ENV"
myos_dotenv_load "$WORKDIR/.env" myos_dotenv_load "$WORKDIR/.env"
# Overlay switches. Their names drive which <stack>.<suffix>.yml files load,
# so these defaults decide that e.g. supabase.labels.yml is picked up.
COMPOSE_FILE_APP=${COMPOSE_FILE_APP:-true}
COMPOSE_FILE_LABELS=${COMPOSE_FILE_LABELS:-true}
COMPOSE_FILE_NETWORKS=${COMPOSE_FILE_NETWORKS:-true}
COMPOSE_FILE_SSH=${COMPOSE_FILE_SSH:-true}
COMPOSE_FILE_VOLUMES=${COMPOSE_FILE_VOLUMES:-true}
COMPOSE_FILE_DEBUG=${COMPOSE_FILE_DEBUG:-${DEBUG:+true}}
USER=${USER:-$(id -nu 2>/dev/null)} USER=${USER:-$(id -nu 2>/dev/null)}
HOSTNAME=${HOSTNAME:-$(hostname 2>/dev/null | sed 's/\..*//')} HOSTNAME=${HOSTNAME:-$(hostname 2>/dev/null | sed 's/\..*//')}
HOSTNAME=$(myos_lower "$HOSTNAME") HOSTNAME=$(myos_lower "$HOSTNAME")
DOMAIN=${DOMAIN:-localhost} DOMAIN=${DOMAIN:-localhost}
DOMAINNAME=${DOMAINNAME:-${DOMAIN%% *}}
MAIL=${MAIL:-$(git config user.email 2>/dev/null || printf '%s@%s' "$USER" "$DOMAINNAME")}
DRYRUN=${DRYRUN:-false} DRYRUN=${DRYRUN:-false}
myos_colors myos_colors
# --- stack references ----------------------------------------------------- # --- stack references -----------------------------------------------------
# No reference given: the current directory when it holds a compose file, # No reference given: the configured STACK, else the current directory when it
# else the STACK of the configuration. # holds a compose file. An explicit STACK always wins, so a project that pins
# its stacks in .env keeps working from inside its own directory.
if [ -z "$MYOS_REFS" ]; then if [ -z "$MYOS_REFS" ]; then
if [ -f "$WORKDIR/docker-compose.yml" ] || [ -f "$WORKDIR/compose.yml" ] || if [ -n "${STACK:-}" ]; then
[ -f "$WORKDIR/docker/docker-compose.yml" ]; then MYOS_REFS=$STACK
elif [ -f "$WORKDIR/docker-compose.yml" ] || [ -f "$WORKDIR/compose.yml" ] ||
[ -f "$WORKDIR/docker/docker-compose.yml" ]; then
MYOS_REFS=./ MYOS_REFS=./
else
MYOS_REFS=${STACK:-}
fi fi
fi fi
if [ -z "$MYOS_REFS" ]; then if [ -z "$MYOS_REFS" ]; then
@@ -151,6 +163,12 @@ fi
# shellcheck disable=SC2086 # a list of references # shellcheck disable=SC2086 # a list of references
MYOS_STACKS=$(myos_group_expand $MYOS_REFS) MYOS_STACKS=$(myos_group_expand $MYOS_REFS)
# myos_framework_compose_files the networks and volumes overlays myos itself
# provides; they always come last so a stack can rely on them being there.
myos_framework_compose_files() {
myos_compose_files "$MYOS_ROOT/share/compose" "networks volumes" "$(myos_compose_suffixes)" "$ENV"
}
# myos_stack_compose_files REF the ordered compose files of one reference # myos_stack_compose_files REF the ordered compose files of one reference
myos_stack_compose_files() { myos_stack_compose_files() {
_dir=$(myos_stack_resolve "$1") || return $? _dir=$(myos_stack_resolve "$1") || return $?
+5 -4
View File
@@ -1,4 +1,5 @@
#shellcheck shell=sh #shellcheck shell=sh
# shellcheck disable=SC3028 # HOSTNAME is a myos variable, set by bin/myos
# The commands that map straight onto docker compose. # The commands that map straight onto docker compose.
# #
# Stacks are grouped by compose project: every host stack shares the project of # Stacks are grouped by compose project: every host stack shares the project of
@@ -26,10 +27,10 @@ myos_cmd_compose() {
for _project in $(printf '%s' "$_projects" | sed '/^$/d' | cut -f1 | awk '!seen[$0]++'); do for _project in $(printf '%s' "$_projects" | sed '/^$/d' | cut -f1 | awk '!seen[$0]++'); do
_files=$(printf '%s' "$_projects" | sed '/^$/d' | awk -F'\t' -v p="$_project" '$1==p {print $2}' | tr ' ' '\n' | sed '/^$/d' | awk '!seen[$0]++') _files=$(printf '%s' "$_projects" | sed '/^$/d' | awk -F'\t' -v p="$_project" '$1==p {print $2}' | tr ' ' '\n' | sed '/^$/d' | awk '!seen[$0]++')
# the framework networks always come last, as the make engine did # the framework overlays always come last, as the make engine did
[ -f "$MYOS_ROOT/share/compose/networks.yml" ] && _fw=$(myos_framework_compose_files)
_files="$_files [ -n "$_fw" ] && _files="$_files
$MYOS_ROOT/share/compose/networks.yml" $_fw"
COMPOSE_PROJECT_NAME=$_project COMPOSE_PROJECT_NAME=$_project
COMPOSE_SERVICE_NAME=$(myos_service_name "$_project") COMPOSE_SERVICE_NAME=$(myos_service_name "$_project")
+1 -1
View File
@@ -1,4 +1,5 @@
#shellcheck shell=sh #shellcheck shell=sh
# shellcheck disable=SC3028 # HOSTNAME is a myos variable, set by bin/myos
# myos doctor check that this installation can actually run a stack # myos doctor check that this installation can actually run a stack
myos_cmd_doctor() { myos_cmd_doctor() {
_rc=0 _rc=0
@@ -21,7 +22,6 @@ myos_cmd_doctor() {
[ -f "$WORKDIR/.env" ] && _ok "$WORKDIR/.env" "read" [ -f "$WORKDIR/.env" ] && _ok "$WORKDIR/.env" "read"
_ok ENV "$ENV" _ok ENV "$ENV"
_ok USER "$USER" _ok USER "$USER"
# shellcheck disable=SC3028 # HOSTNAME is set by bin/myos
_ok HOSTNAME "$HOSTNAME" _ok HOSTNAME "$HOSTNAME"
_ok DOMAIN "$DOMAIN" _ok DOMAIN "$DOMAIN"
_ok "project format" "${MYOS_PROJECT_FORMAT:-user-env-app}" _ok "project format" "${MYOS_PROJECT_FORMAT:-user-env-app}"
+35 -6
View File
@@ -1,4 +1,5 @@
#shellcheck shell=sh #shellcheck shell=sh
# shellcheck disable=SC3028 # HOSTNAME is a myos variable, set by bin/myos
# myos env [VAR...] show resolved variables (replaces the make print-VAR target) # myos env [VAR...] show resolved variables (replaces the make print-VAR target)
myos_cmd_env() { myos_cmd_env() {
_vars=${MYOS_VARS:-} _vars=${MYOS_VARS:-}
@@ -13,6 +14,20 @@ myos_cmd_env() {
COMPOSE_FILE) printf '%s %s\n' "$_v" "$(myos_all_compose_files | tr '\n' ' ' | sed 's/ $//')" ;; COMPOSE_FILE) printf '%s %s\n' "$_v" "$(myos_all_compose_files | tr '\n' ' ' | sed 's/ $//')" ;;
COMPOSE_PROJECT_NAME) printf '%s %s\n' "$_v" "$(myos_first_project)" ;; COMPOSE_PROJECT_NAME) printf '%s %s\n' "$_v" "$(myos_first_project)" ;;
STACK) printf '%s %s\n' "$_v" "$(printf '%s' "$MYOS_STACKS" | tr '\n' ' ' | sed 's/ $//')" ;; STACK) printf '%s %s\n' "$_v" "$(printf '%s' "$MYOS_STACKS" | tr '\n' ' ' | sed 's/ $//')" ;;
DOCKER_NETWORK_DEFAULT) printf '%s %s\n' "$_v" "$(myos_network_default "$(myos_first_project)")" ;;
DOCKER_NETWORK_PRIVATE) printf '%s %s\n' "$_v" "$(myos_network_private "$USER" "$ENV")" ;;
DOCKER_NETWORK_PUBLIC) printf '%s %s\n' "$_v" "$(myos_network_public "${HOSTNAME:-}")" ;;
COMPOSE_SERVICE_NAME) printf '%s %s\n' "$_v" "$(myos_service_name "$(myos_first_project)")" ;;
COMPOSE_FILE_SUFFIX) printf '%s %s\n' "$_v" "$(myos_compose_suffixes)" ;;
APP|APP_NAME) printf '%s %s\n' "$_v" "$(myos_first_app)" ;;
SCOPE) printf '%s %s\n' "$_v" "$(myos_first_scope)" ;;
# HOST_STACK/USER_STACK are the names the make engine used for the scope
HOST_STACK) [ "$(myos_first_scope)" = host ] && printf '%s host\n' "$_v" || printf '%s\n' "$_v" ;;
USER_STACK) [ "$(myos_first_scope)" = user ] && printf '%s User\n' "$_v" || printf '%s\n' "$_v" ;;
DOCKER_REPOSITORY) printf '%s %s\n' "$_v" "$(printf '%s' "$(myos_first_project)" | tr '_-' '//')" ;;
DOCKER_NETWORK)
if [ "$(myos_first_scope)" = user ]; then printf '%s %s\n' "$_v" "$USER"
else printf '%s %s\n' "$_v" "$(myos_network_private "$USER" "$ENV")"; fi ;;
*) printf '%s %s\n' "$_v" "$(myos_var "$_v")" ;; *) printf '%s %s\n' "$_v" "$(myos_var "$_v")" ;;
esac esac
done done
@@ -23,16 +38,30 @@ myos_all_compose_files() {
for _ref in $MYOS_STACKS; do for _ref in $MYOS_STACKS; do
myos_stack_compose_files "$_ref" 2>/dev/null myos_stack_compose_files "$_ref" 2>/dev/null
done done
[ -f "$MYOS_ROOT/share/compose/networks.yml" ] && printf '%s\n' "$MYOS_ROOT/share/compose/networks.yml" myos_framework_compose_files
return 0 return 0
} }
# myos_first_project the compose project of the first requested stack # myos_first_app / myos_first_scope / myos_first_project
myos_first_project() { # describe the first requested stack, which is what the introspection commands
# report when several stacks are asked for at once.
myos_first_app() {
for _ref in $MYOS_STACKS; do for _ref in $MYOS_STACKS; do
_app=$(myos_stack_name "$_ref") case $_ref in
case $_ref in .|./*|/*|../*) _app=$(basename "$(myos_stack_resolve "$_ref" 2>/dev/null)") ;; esac .|./*|/*|../*) basename "$(myos_stack_resolve "$_ref" 2>/dev/null)" ;;
myos_project_name "$(myos_scope "$_ref")" "$USER" "$ENV" "$_app" *) myos_stack_name "$_ref" ;;
esac
return 0
done
}
myos_first_scope() {
for _ref in $MYOS_STACKS; do myos_scope "$_ref"; return 0; done
}
myos_first_project() {
for _ref in $MYOS_STACKS; do
myos_project_name "$(myos_scope "$_ref")" "$USER" "$ENV" "$(myos_first_app)"
return 0 return 0
done done
} }
+1 -2
View File
@@ -1,4 +1,5 @@
#shellcheck shell=sh #shellcheck shell=sh
# shellcheck disable=SC3028 # HOSTNAME is a myos variable, set by bin/myos
# naming: compose project name, service name, networks, user identity. # naming: compose project name, service name, networks, user identity.
# #
# Ported from make/apps/def.docker.mk (COMPOSE_PROJECT_NAME, COMPOSE_SERVICE_NAME), # Ported from make/apps/def.docker.mk (COMPOSE_PROJECT_NAME, COMPOSE_SERVICE_NAME),
@@ -49,8 +50,6 @@ myos_project_name() {
[ -n "${DOCKER_COMPOSE_PROJECT_NAME:-}" ] && { printf '%s' "$DOCKER_COMPOSE_PROJECT_NAME"; return 0; } [ -n "${DOCKER_COMPOSE_PROJECT_NAME:-}" ] && { printf '%s' "$DOCKER_COMPOSE_PROJECT_NAME"; return 0; }
case $_scope in case $_scope in
host) host)
# HOSTNAME is set by lib/config.sh, not inherited from the shell
# shellcheck disable=SC3028
printf '%s' "${HOST_COMPOSE_PROJECT_NAME:-${HOSTNAME:-localhost}}"; return 0 ;; printf '%s' "${HOST_COMPOSE_PROJECT_NAME:-${HOSTNAME:-localhost}}"; return 0 ;;
user) user)
if [ -n "${USER_COMPOSE_PROJECT_NAME:-}" ]; then printf '%s' "$USER_COMPOSE_PROJECT_NAME" if [ -n "${USER_COMPOSE_PROJECT_NAME:-}" ]; then printf '%s' "$USER_COMPOSE_PROJECT_NAME"
+27 -2
View File
@@ -1,8 +1,33 @@
# Intentional differences between the legacy make engine and the bash CLI # Intentional differences between the legacy make engine and the bash CLI
Golden expectations in `expected/` are recorded from the legacy engine Golden expectations in `expected/` are recorded from the legacy engine
(`git tag legacy-1.0-beta`). When the CLI intentionally behaves differently, (git tag `legacy-1.0-beta`). When the CLI intentionally behaves differently the
the case gets an override in `expected.cli/<case>.txt` and a line here. case gets an override in `expected.cli/<case>.txt` and a line here.
`make test-golden MYOS_ENGINE=cli` checks the CLI against those overrides.
## Shape of the output
| what | legacy | cli |
|---|---|---|
| sub-make line | every command is preceded by the recursive `make ... docker-compose-up STACK=...` it re-enters | no recursion, so no such line |
| compose invocation | `docker --log-level=error compose --ansi=auto -f ... -p ...` | `docker compose -f ... -p ... --project-directory <dir of the first file>` |
| several stacks in one project | one `docker compose up` per stack, each with the full file list, so N stacks meant N identical calls | a single call per project |
| network creation | `sh -c docker network create <n> >/dev/null 2>&1` on every up | `docker network create <n>`, only when the network is missing |
| unknown command | prints a warning and exits 0 | prints an error and exits 2 |
| unknown stack | silently resolves to nothing and exits 0 | exits 3 with the search path |
## Values
| what | legacy | cli | why |
|---|---|---|---|
| `APP` in wrapper mode | `myos`, the framework directory itself | the stack, or the directory being run | the legacy value described the framework, not the thing being deployed. The real `up` path already passed `APP_NAME=<stack>` to its sub-make, so the CLI matches what actually ran; only the `print-` target disagreed. |
| `COMPOSE_PROJECT_NAME` for a catalogue stack in wrapper mode | `<user>-myos-<env>` for every stack | `<user>-<env>-<stack>` | same reason: two different stacks shared one project name when printed, but not when run |
| `COMPOSE_PROJECT_NAME` default order | `<user>-<app>-<env>` | `<user>-<env>-<app>` | environments are shared across apps, so the environment reads better in the middle. `MYOS_PROJECT_FORMAT=user-app-env` restores the old order and is what `myos migrate pin` writes into existing deployments. |
| compose files of the current directory | ignored in wrapper mode: only a `STACK` was ever loaded | loaded, as a stack named after the directory | this is the point of unifying the two modes |
| overlay order for several suffixes | the order the `COMPOSE_FILE_*` variables happened to be declared in | sorted by suffix name | a compose overlay wins over the ones before it, so the order has to be predictable rather than depend on where a variable was set |
| framework overlays | `stack/myos/*.yml` | `share/compose/*.yml` | the catalogue moved to myos-stacks; these files stay with the framework |
## Tag helpers
| case | delta | why | | case | delta | why |
|---|---|---| |---|---|---|
+3 -1
View File
@@ -1,4 +1,7 @@
# name | fixture | args # name | fixture | args
#
# `help` is deliberately absent: it renders the comments of the Makefile, so it
# would break on every edit to a dev target rather than on a change of behaviour.
host-print-project | host-project | print-COMPOSE_PROJECT_NAME STACK=host/consul host-print-project | host-project | print-COMPOSE_PROJECT_NAME STACK=host/consul
host-print-compose-file | host-project | print-COMPOSE_FILE STACK=host/consul host-print-compose-file | host-project | print-COMPOSE_FILE STACK=host/consul
host-print-stack-dir | host-project | print-STACK_DIR STACK=host/consul host-print-stack-dir | host-project | print-STACK_DIR STACK=host/consul
@@ -54,7 +57,6 @@ cat-nginx-www-dns | app-nogit | print-COMPOSE_FILE STACK=host/
cat-nginx-project | app-nogit | print-COMPOSE_PROJECT_NAME STACK=host/nginx cat-nginx-project | app-nogit | print-COMPOSE_PROJECT_NAME STACK=host/nginx
cat-unknown-stack | app-nogit | print-COMPOSE_FILE STACK=doesnotexist cat-unknown-stack | app-nogit | print-COMPOSE_FILE STACK=doesnotexist
cat-unknown-target | app-nogit | doesnotexist cat-unknown-target | app-nogit | doesnotexist
misc-help | app-nogit | help
inc-app-print-project | app-git | @make print-COMPOSE_PROJECT_NAME inc-app-print-project | app-git | @make print-COMPOSE_PROJECT_NAME
inc-app-print-compose-file | app-git | @make print-COMPOSE_FILE inc-app-print-compose-file | app-git | @make print-COMPOSE_FILE
inc-app-print-app | app-git | @make print-APP inc-app-print-app | app-git | @make print-APP
+2
View File
@@ -0,0 +1,2 @@
docker compose -f @WD@/docker-compose.yml -f @WD@/docker-compose.local.yml -f @WD@/docker/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-local --project-directory @WD@ config
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
docker compose -f @WD@/docker-compose.yml -f @WD@/docker-compose.local.yml -f @WD@/docker/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-local --project-directory @WD@ down
[exit 0]
@@ -0,0 +1,2 @@
APP wd
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @WD@/docker-compose.yml @WD@/docker-compose.local.yml @WD@/docker/docker-compose.yml @MYOS@/share/compose/networks.yml
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME tester-wd-local
[exit 0]
@@ -0,0 +1,2 @@
DOCKER_REPOSITORY tester/wd/local
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_SERVICE_NAME tester-wd-local
[exit 0]
@@ -0,0 +1,2 @@
STACK ./
[exit 0]
+26
View File
@@ -0,0 +1,26 @@
ERROR: unknown command: run
Usage: myos [options] <command> [stack...] [VAR=value...] [-- args...]
Options:
-C DIR work in DIR instead of the current directory
-e ENV environment (default: local, or ENV from the config)
-H HOSTS run on remote hosts instead (comma separated, or "all")
-n, --dry-run print the commands instead of running them
-v, --verbose show what myos does
-d, --debug show every command
-h, --help this help
Commands:
up down start stop restart recreate manage the containers of a stack
ps logs config exec run inspect and enter them
ls [--groups] list the stacks myos can see
env [VAR...] show resolved variables
doctor check the installation
version print the myos version
Stacks:
myos up the stack of the current directory
myos up host a group, expanded from host=... in a .env or .mk
myos up host/fabio a single stack
myos up postgres:9.6 a versioned stack
[exit 2]
+26
View File
@@ -0,0 +1,26 @@
ERROR: unknown command: scale
Usage: myos [options] <command> [stack...] [VAR=value...] [-- args...]
Options:
-C DIR work in DIR instead of the current directory
-e ENV environment (default: local, or ENV from the config)
-H HOSTS run on remote hosts instead (comma separated, or "all")
-n, --dry-run print the commands instead of running them
-v, --verbose show what myos does
-d, --debug show every command
-h, --help this help
Commands:
up down start stop restart recreate manage the containers of a stack
ps logs config exec run inspect and enter them
ls [--groups] list the stacks myos can see
env [VAR...] show resolved variables
doctor check the installation
version print the myos version
Stacks:
myos up the stack of the current directory
myos up host a group, expanded from host=... in a .env or .mk
myos up host/fabio a single stack
myos up postgres:9.6 a versioned stack
[exit 2]
@@ -0,0 +1,4 @@
docker network create tester-master
docker network create testhost
docker compose -f @WD@/docker-compose.yml -f @WD@/docker/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-master --project-directory @WD@ up -d
[exit 0]
+4
View File
@@ -0,0 +1,4 @@
docker network create tester-local
docker network create testhost
docker compose -f @WD@/docker-compose.yml -f @WD@/docker-compose.local.yml -f @WD@/docker/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-local --project-directory @WD@ up -d
[exit 0]
@@ -0,0 +1,2 @@
ENV_VARS
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @HOME@/.local/share/myos/stack/drone/drone.yml @HOME@/.local/share/myos/stack/drone/drone.1.6.yml @MYOS@/share/compose/networks.yml
[exit 0]
@@ -0,0 +1,7 @@
docker network create tester-local
docker network create testhost
docker compose -f @HOME@/.local/share/myos/stack/postgres/postgres.yml -f @HOME@/.local/share/myos/stack/postgres/postgres.local.yml -f @MYOS@/share/compose/networks.yml -p tester-postgres-local --project-directory @HOME@/.local/share/myos/stack/postgres up -d
docker network create tester-local
docker network create testhost
docker compose -f @HOME@/.local/share/myos/stack/redis/redis.yml -f @MYOS@/share/compose/networks.yml -p tester-redis-local --project-directory @HOME@/.local/share/myos/stack/redis up -d
[exit 0]
@@ -0,0 +1,7 @@
docker network create tester-local
docker network create testhost
docker compose -f @HOME@/.local/share/myos/stack/drone/drone.yml -f @MYOS@/share/compose/networks.yml -p tester-drone-local --project-directory @HOME@/.local/share/myos/stack/drone up -d
docker network create tester-local
docker network create testhost
docker compose -f @HOME@/.local/share/myos/stack/redis/redis.yml -f @MYOS@/share/compose/networks.yml -p tester-redis-local --project-directory @HOME@/.local/share/myos/stack/redis up -d
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @HOME@/.local/share/myos/stack/host/nginx.yml @HOME@/.local/share/myos/stack/host/nginx.dns.yml @HOME@/.local/share/myos/stack/host/nginx.www.yml @MYOS@/share/compose/networks.yml @MYOS@/share/compose/volumes.dns.local.yml @MYOS@/share/compose/volumes.www.local.yml
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME tester-postgres-local
[exit 0]
@@ -0,0 +1,4 @@
docker network create tester-local
docker network create testhost
docker compose -f @HOME@/.local/share/myos/stack/postgres/postgres.yml -f @HOME@/.local/share/myos/stack/postgres/postgres.local.yml -f @MYOS@/share/compose/networks.yml -p tester-postgres-local --project-directory @HOME@/.local/share/myos/stack/postgres up -d
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @HOME@/.local/share/myos/stack/postgres/postgres.yml @HOME@/.local/share/myos/stack/postgres/postgres.local.yml @HOME@/.local/share/myos/stack/postgres/postgres.9.6.yml @MYOS@/share/compose/networks.yml
[exit 0]
@@ -0,0 +1,26 @@
ERROR: unknown command: doesnotexist
Usage: myos [options] <command> [stack...] [VAR=value...] [-- args...]
Options:
-C DIR work in DIR instead of the current directory
-e ENV environment (default: local, or ENV from the config)
-H HOSTS run on remote hosts instead (comma separated, or "all")
-n, --dry-run print the commands instead of running them
-v, --verbose show what myos does
-d, --debug show every command
-h, --help this help
Commands:
up down start stop restart recreate manage the containers of a stack
ps logs config exec run inspect and enter them
ls [--groups] list the stacks myos can see
env [VAR...] show resolved variables
doctor check the installation
version print the myos version
Stacks:
myos up the stack of the current directory
myos up host a group, expanded from host=... in a .env or .mk
myos up host/fabio a single stack
myos up postgres:9.6 a versioned stack
[exit 2]
+2
View File
@@ -0,0 +1,2 @@
docker compose -f @WD@/stack/host/fabio.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host config
[exit 0]
@@ -0,0 +1,2 @@
docker compose -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host down
[exit 0]
+26
View File
@@ -0,0 +1,26 @@
ERROR: unknown command: exec
Usage: myos [options] <command> [stack...] [VAR=value...] [-- args...]
Options:
-C DIR work in DIR instead of the current directory
-e ENV environment (default: local, or ENV from the config)
-H HOSTS run on remote hosts instead (comma separated, or "all")
-n, --dry-run print the commands instead of running them
-v, --verbose show what myos does
-d, --debug show every command
-h, --help this help
Commands:
up down start stop restart recreate manage the containers of a stack
ps logs config exec run inspect and enter them
ls [--groups] list the stacks myos can see
env [VAR...] show resolved variables
doctor check the installation
version print the myos version
Stacks:
myos up the stack of the current directory
myos up host a group, expanded from host=... in a .env or .mk
myos up host/fabio a single stack
myos up postgres:9.6 a versioned stack
[exit 2]
+2
View File
@@ -0,0 +1,2 @@
docker compose -f @WD@/stack/host/consul.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host logs --follow --tail=100
[exit 0]
@@ -0,0 +1,2 @@
APP consul
[exit 0]
@@ -0,0 +1,2 @@
ENV_VARS
[exit 0]
@@ -0,0 +1,2 @@
STACK_DIR
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
docker compose -f @WD@/stack/host/consul.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host ps
[exit 0]
@@ -0,0 +1,2 @@
docker compose -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host config
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
ERROR: no stack given, and no compose file in @WD@
[exit 2]
@@ -0,0 +1,4 @@
docker network create tester-local
docker network create testhost
docker compose -f @WD@/stack/host/consul.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host up -d
[exit 0]
@@ -0,0 +1,4 @@
docker network create tester-local
docker network create testhost
docker compose -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host up -d
[exit 0]
+4
View File
@@ -0,0 +1,4 @@
docker network create tester-local
docker network create testhost
docker compose -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host up -d
[exit 0]
@@ -0,0 +1,2 @@
APP wd
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME tester-wd-local
[exit 0]
+4
View File
@@ -0,0 +1,4 @@
docker network create tester-local
docker network create testhost
docker compose -f @WD@/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-local --project-directory @WD@ up -d
[exit 0]
-52
View File
@@ -1,52 +0,0 @@
Usage:
make [target]
Targets:
test Run unit + golden tests
test-unit Run unit tests only
test-golden Run golden tests only (MYOS_ENGINE=legacy|cli)
test-integration Run tests needing a real docker daemon
golden-record Re-record golden expectations from the legacy engine
lint shellcheck all shell sources
help This help
attach Attach to docker SERVICE
bootstrap Configure system
build Build application docker images
clean Clean application and docker stuffs
config View application docker compose file
connect Connect to docker SERVICE
deploy Deploy application dockers
down Remove application dockers
exec Exec command in docker SERVICE
install Install application
logs Display application dockers logs
rebuild Rebuild application dockers images
reinstall Reinstall application
release Create release VERSION
restart Restart application
run Run a command in a new docker
scale Scale SERVICE application to NUM dockers
shutdown Shutdown all dockers
start Start application dockers
stop Stop application dockers
tests Test application
up Create application dockers
update Update application files
upgrade Upgrade application
ssh Connect to first remote host
Context:
ENV local
ENV_PATH @WD@
DOCKER_MACHINE x86_64
DOCKER_SOCKET_LOCATION /var/run/docker.sock
DOCKER_SYSTEM Linux
DOMAIN example.test
APP myos
APPS @APPS@
BRANCH @BRANCH@
VERSION @VERSION@
RELEASE
COMPOSE_FILE @MYOS@/share/compose/networks.yml
DOCKER_REPOSITORY tester/myos/local
[exit 0]
+1
View File
@@ -3,6 +3,7 @@
# Usage: spec/golden/record.sh [case-name ...] # Usage: spec/golden/record.sh [case-name ...]
set -u set -u
here=$(cd "$(dirname "$0")" && pwd) here=$(cd "$(dirname "$0")" && pwd)
# shellcheck source=spec/support/run.sh
. "$here/../support/run.sh" . "$here/../support/run.sh"
MYOS_ROOT=${MYOS_ROOT:-$(cd "$here/../.." && pwd)} MYOS_ROOT=${MYOS_ROOT:-$(cd "$here/../.." && pwd)}
only="$*" only="$*"
+3
View File
@@ -63,7 +63,10 @@ myos_run_engine() {
make -esC "$MYOS_ROOT" MYOS=. WORKDIR="$_sb/wd" "$@" 2>&1); _rc=$? make -esC "$MYOS_ROOT" MYOS=. WORKDIR="$_sb/wd" "$@" 2>&1); _rc=$?
;; ;;
cli) cli)
# MYOS_PROJECT_FORMAT pins the legacy naming so that the goldens compare
# resolution, not naming; the new default is covered by the unit tests.
_out=$(cd "$_sb/wd" && env -i $(myos_hermetic_env "$_sb") MYOS_CONF=/dev/null \ _out=$(cd "$_sb/wd" && env -i $(myos_hermetic_env "$_sb") MYOS_CONF=/dev/null \
MYOS_PROJECT_FORMAT=user-app-env \
"$MYOS_ROOT/bin/myos" -C "$_sb/wd" "$@" 2>&1); _rc=$? "$MYOS_ROOT/bin/myos" -C "$_sb/wd" "$@" 2>&1); _rc=$?
;; ;;
*) echo "unknown engine $_engine" >&2; return 2 ;; *) echo "unknown engine $_engine" >&2; return 2 ;;