gowalk-cicd 1.0.222 → 1.0.224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -574,6 +574,10 @@ The backend message is `gowalk-cicd/backend-deploy-failed.v1 phase=<phase> exit_
574
574
  fixed fields without JSON braces, which GitHub can mask when a multiline secret has brace-only lines.
575
575
  Consumers validate the complete envelope, the known phase and exit code 1–255; older JSON messages
576
576
  remain readable by the panel. Masked fields are never reconstructed and credential masking stays enabled.
577
+ During sync, `backend_sync_failed` adds `gowalk-cicd/backend-sync-failed.v1 operation=<operation>
578
+ exit_code=<code>`. Operations are `mkdir_project`, `mkdir_nested`, `rsync_source`, `rsync_nested`,
579
+ `rsync_compose`, `rsync_helpers`, or `unclassified`. This identifies the failed client operation,
580
+ not the host gate's policy or ownership cause; it contains no command, path, host, output or secret.
577
581
  Protected vhost failures add `backend_vhost_failed` (`gowalk-cicd/backend-vhost-failed.v1`) with fixed
578
582
  brace-free `operation`, `stage`, `reason`, `child_exit` and `signals`; see `docs/BACKEND_EDGE.md`.
579
583
  It preserves the existing refusal and records only bounded observed facts, never private child output.
@@ -207,25 +207,31 @@ runs:
207
207
  BACKEND_DEPLOY_PHASE=sync_backend
208
208
  SSH="ssh -p ${DEPLOY_SSH_PORT:-22} -i ~/.ssh/backend_deploy -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes"
209
209
  DEST="/opt/gowalk-backends/${{ inputs.app-name }}"
210
+ BACKEND_SYNC_OPERATION=mkdir_project
210
211
  $SSH "${{ inputs.ssh-user }}@${{ inputs.host }}" "mkdir -p '$DEST'"
211
212
  # --delete keeps the mirror true; preserve the private server-side env files
212
213
  # until their replacement validates so failed credential updates retain the old file.
213
214
  if [ "${COMPOSE_FILE%/*}" = "$BACKEND_DIR" ]; then
215
+ BACKEND_SYNC_OPERATION=rsync_source
214
216
  rsync -az --delete --exclude '.env' --exclude '.runtime.env' --exclude '.git' \
215
217
  --exclude '.backend-edge.json' --exclude '.backend-ingress.conf' --exclude '.backend-public.env' \
216
218
  -e "$SSH" "$BACKEND_DIR/" \
217
219
  "${{ inputs.ssh-user }}@${{ inputs.host }}:$DEST/"
218
220
  else
221
+ BACKEND_SYNC_OPERATION=mkdir_nested
219
222
  $SSH "${{ inputs.ssh-user }}@${{ inputs.host }}" \
220
223
  "mkdir -p '$DEST/$BACKEND_DIR'"
224
+ BACKEND_SYNC_OPERATION=rsync_nested
221
225
  rsync -az --delete --exclude '.env' --exclude '.runtime.env' --exclude '.git' \
222
226
  -e "$SSH" "$BACKEND_DIR/" \
223
227
  "${{ inputs.ssh-user }}@${{ inputs.host }}:$DEST/$BACKEND_DIR/"
228
+ BACKEND_SYNC_OPERATION=rsync_compose
224
229
  rsync -az -e "$SSH" "$COMPOSE_FILE" \
225
230
  "${{ inputs.ssh-user }}@${{ inputs.host }}:$DEST/${COMPOSE_FILE##*/}"
226
231
  fi
227
232
  # Ship remote helpers after the application mirror. They are package
228
233
  # owned and kept out of the consumer's source tree.
234
+ BACKEND_SYNC_OPERATION=rsync_helpers
229
235
  rsync -az -e "$SSH" \
230
236
  "${{ github.action_path }}/remote_deploy.sh" \
231
237
  "${{ github.action_path }}/select_certbot_account.sh" \
@@ -11,6 +11,15 @@ backend_report_failure() {
11
11
  # Multiline JSON secrets can make GitHub mask standalone braces. Keep fixed evidence readable.
12
12
  printf '::error title=backend_deploy_failed::gowalk-cicd/backend-deploy-failed.v1 phase=%s exit_code=%s\n' \
13
13
  "$phase" "$status"
14
+ if [ "$phase" = sync_backend ]; then
15
+ local operation="${BACKEND_SYNC_OPERATION:-unclassified}"
16
+ case "$operation" in
17
+ mkdir_project|mkdir_nested|rsync_source|rsync_nested|rsync_compose|rsync_helpers) ;;
18
+ *) operation=unclassified ;;
19
+ esac
20
+ printf '::error title=backend_sync_failed::gowalk-cicd/backend-sync-failed.v1 operation=%s exit_code=%s\n' \
21
+ "$operation" "$status"
22
+ fi
14
23
  return "$status"
15
24
  }
16
25
 
@@ -24,7 +24,7 @@ REQUIRED = (
24
24
  'health_rollout_timing.py',
25
25
  'memory_agent.py', 'memory_accounting.py',
26
26
  'runtime_env.py', 'runtime_env_parse.py', 'edge_inputs.py', 'edge_vhost.py', 'edge_health.py',
27
- 'configure_vhost.py', 'vhost_diagnostics.py', 'remote_deploy.sh', 'deploy_evidence.sh',
27
+ 'configure_vhost.py', 'vhost_diagnostics.py', 'publish_ingress.py', 'remote_deploy.sh', 'deploy_evidence.sh',
28
28
  'ensure_certificate.sh', 'select_certbot_account.sh',
29
29
  'network_projection.py', 'network_inventory.py', 'network_host.py', 'network_metadata.py', 'network_readback.py',
30
30
  )
@@ -0,0 +1,46 @@
1
+ """Publish a configured shared-host route before certificate validation starts."""
2
+ from pathlib import Path
3
+ import re
4
+ import stat
5
+ import subprocess
6
+ import sys
7
+
8
+ HOOK = Path('/usr/local/sbin/gowalk-backend-publish-ingress')
9
+ ROOT_UID = 0
10
+
11
+
12
+ def publish(app, domain):
13
+ try:
14
+ info = HOOK.lstat()
15
+ except FileNotFoundError:
16
+ return
17
+ if not re.fullmatch(r'[a-z0-9-]{1,255}', app):
18
+ raise ValueError('project_invalid')
19
+ if len(domain) > 253 or not re.fullmatch(r'[a-z0-9-]+(?:\.[a-z0-9-]+)+', domain):
20
+ raise ValueError('domain_invalid')
21
+ if not stat.S_ISREG(info.st_mode) or info.st_uid != ROOT_UID or info.st_mode & 0o022:
22
+ raise ValueError('hook_untrusted')
23
+ if not info.st_mode & stat.S_IXUSR:
24
+ raise ValueError('hook_not_executable')
25
+ for parent in HOOK.parents:
26
+ info = parent.lstat()
27
+ if not stat.S_ISDIR(info.st_mode) or info.st_uid != ROOT_UID or info.st_mode & 0o022:
28
+ raise ValueError('hook_parent_untrusted')
29
+ subprocess.run([str(HOOK), app, domain], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
30
+ stderr=subprocess.DEVNULL, timeout=30, check=True,
31
+ env={'PATH': '/usr/sbin:/usr/bin:/sbin:/bin', 'LC_ALL': 'C'})
32
+
33
+
34
+ def main():
35
+ try:
36
+ if len(sys.argv) != 3:
37
+ raise ValueError('arguments_invalid')
38
+ publish(*sys.argv[1:])
39
+ except (ValueError, OSError, subprocess.SubprocessError):
40
+ print('backend_ingress_publication_refused', file=sys.stderr)
41
+ return 1
42
+ return 0
43
+
44
+
45
+ if __name__ == '__main__':
46
+ sys.exit(main())
@@ -141,6 +141,7 @@ write_vhost() {
141
141
  state="$(nginx_locked python3 "$HELPERS/configure_vhost.py" "$VHOST" "$DOMAIN" "$PORT" "$1")"
142
142
  fi
143
143
  [ "$state" != changed ] || log "nginx vhost for $DOMAIN ($1) → 127.0.0.1:$PORT"
144
+ python3 "$HELPERS/publish_ingress.py" "$APP" "$DOMAIN"
144
145
  }
145
146
  BACKEND_DEPLOY_PHASE=configure_vhost
146
147
  if certificate_current "$DOMAIN" "$CERT_VHOST"; then
@@ -218,3 +218,24 @@ The established `/usr/bin/python3 -B` spelling is accepted and preserves `-B`; o
218
218
  It changes no app source, runtime profile, container, database, service timer or deployment freeze. Preserve the
219
219
  previous release directory; this is ordinary released-helper installation, not app-state recovery.
220
220
  Verify a fresh scoped readback through each owner and keep that receipt with the exact npm integrity and release.
221
+
222
+ ## Shared public IP route publication
223
+
224
+ A VM behind a hostname-routing ingress needs its public route before ACME can
225
+ validate a new domain. After every successful vhost write, outside the nginx lock,
226
+ the released deployment helper invokes `/usr/local/sbin/gowalk-backend-publish-ingress`
227
+ if installed. This optional operator-owned executable receives two arguments:
228
+ the project slug and infrastructure domain. It must synchronously publish and
229
+ verify that domain's ingress route; it must refuse another VM's existing ownership.
230
+ The executable and all parent directories must be root-owned and not writable by
231
+ group or others. Symlinks are refused. Its environment is fixed, stdin is closed,
232
+ and its output is not included in deployment logs. Failure or the30-second timeout
233
+ stops deployment before certificate validation. An absent hook preserves direct-host
234
+ deployment behavior. Do not remove a shared host's hook to bypass an ingress failure.
235
+
236
+ Install the hook and its private transport using the host's infrastructure tooling;
237
+ application repositories cannot configure it. It does not replace the existing
238
+ certificate, protected-origin or public-health checks. Unchanged vhosts also invoke
239
+ it so an interrupted publication can be retried safely. Normal direct-host delivery
240
+ adds only one small Python invocation; a shared host also performs one bounded
241
+ route publication per vhost stage, with no polling delay.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gowalk-cicd",
3
- "version": "1.0.222",
3
+ "version": "1.0.224",
4
4
  "description": "Zero-config GitHub Actions delivery for iOS TestFlight and Android Google Play.",
5
5
  "type": "module",
6
6
  "bin": {