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:
+5
-4
@@ -1,4 +1,5 @@
|
||||
#shellcheck shell=sh
|
||||
# shellcheck disable=SC3028 # HOSTNAME is a myos variable, set by bin/myos
|
||||
# The commands that map straight onto docker compose.
|
||||
#
|
||||
# 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
|
||||
_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
|
||||
[ -f "$MYOS_ROOT/share/compose/networks.yml" ] &&
|
||||
_files="$_files
|
||||
$MYOS_ROOT/share/compose/networks.yml"
|
||||
# the framework overlays always come last, as the make engine did
|
||||
_fw=$(myos_framework_compose_files)
|
||||
[ -n "$_fw" ] && _files="$_files
|
||||
$_fw"
|
||||
|
||||
COMPOSE_PROJECT_NAME=$_project
|
||||
COMPOSE_SERVICE_NAME=$(myos_service_name "$_project")
|
||||
|
||||
+1
-1
@@ -1,4 +1,5 @@
|
||||
#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_cmd_doctor() {
|
||||
_rc=0
|
||||
@@ -21,7 +22,6 @@ myos_cmd_doctor() {
|
||||
[ -f "$WORKDIR/.env" ] && _ok "$WORKDIR/.env" "read"
|
||||
_ok ENV "$ENV"
|
||||
_ok USER "$USER"
|
||||
# shellcheck disable=SC3028 # HOSTNAME is set by bin/myos
|
||||
_ok HOSTNAME "$HOSTNAME"
|
||||
_ok DOMAIN "$DOMAIN"
|
||||
_ok "project format" "${MYOS_PROJECT_FORMAT:-user-env-app}"
|
||||
|
||||
+35
-6
@@ -1,4 +1,5 @@
|
||||
#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_cmd_env() {
|
||||
_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_PROJECT_NAME) printf '%s %s\n' "$_v" "$(myos_first_project)" ;;
|
||||
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")" ;;
|
||||
esac
|
||||
done
|
||||
@@ -23,16 +38,30 @@ myos_all_compose_files() {
|
||||
for _ref in $MYOS_STACKS; do
|
||||
myos_stack_compose_files "$_ref" 2>/dev/null
|
||||
done
|
||||
[ -f "$MYOS_ROOT/share/compose/networks.yml" ] && printf '%s\n' "$MYOS_ROOT/share/compose/networks.yml"
|
||||
myos_framework_compose_files
|
||||
return 0
|
||||
}
|
||||
|
||||
# myos_first_project the compose project of the first requested stack
|
||||
myos_first_project() {
|
||||
# myos_first_app / myos_first_scope / 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
|
||||
_app=$(myos_stack_name "$_ref")
|
||||
case $_ref in .|./*|/*|../*) _app=$(basename "$(myos_stack_resolve "$_ref" 2>/dev/null)") ;; esac
|
||||
myos_project_name "$(myos_scope "$_ref")" "$USER" "$ENV" "$_app"
|
||||
case $_ref in
|
||||
.|./*|/*|../*) basename "$(myos_stack_resolve "$_ref" 2>/dev/null)" ;;
|
||||
*) 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
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user