Skip to content

fix(istio): read action identity/parameters from ACTION_* env vars - #5

Draft
serialito74 wants to merge 2 commits into
nullplatform:mainfrom
serialito74:fix/create-context-parameters-precedence
Draft

fix(istio): read action identity/parameters from ACTION_* env vars#5
serialito74 wants to merge 2 commits into
nullplatform:mainfrom
serialito74:fix/create-context-parameters-precedence

Conversation

@serialito74

@serialito74 serialito74 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Updated: the initial version of this PR merged .service.attributes/.parameters with parameters winning, based on the assumption that $CONTEXT carried the action's own submitted values but a jq // footgun was masking them. That assumption was wrong — verified live against a real cluster that it did not fix the issue.

Root cause, confirmed live: $CONTEXT (from np service workflow exec --build-context) never carries the action's own id/slug/parameters/service data on the currently-shipping np CLI — that JSON only carries related entities (scope/application/namespace/account, per the CLI's own --include option list, which doesn't even have "service" as a valid value).

A full environment-variable-name dump on a live failed create action showed the action's own identity and submitted create-form values arrive as flat ACTION_* environment variables instead, set directly by np service workflow exec:

  • ACTION_ID, ACTION_SLUG, ACTION_ENTITY_NRN
  • ACTION_SERVICE_ID, ACTION_SERVICE_SLUG, ACTION_SERVICE_DIMENSIONS_ENVIRONMENT
  • ACTION_PARAMETERS_<FIELD> (the submitted create-form values, e.g. ACTION_PARAMETERS_BASE_DOMAIN)
  • ACTION_TAGS_<TAG> (ACTION_TAGS_APPLICATION_ID, etc.)

Confirmed base_domain/path_prefix/scope were present and correct in these env vars while $CONTEXT had none of .service, .parameters, .id, or .slug.

Fix

  • build_context: reads SERVICE_ID/SERVICE_SLUG/ACTION_ID/ACTION_NAME/APPLICATION_ID/BASE_DOMAIN/STRIP_PREFIX/PATH_PREFIX/SCOPE_SLUG directly from the corresponding ACTION_* env vars, dropping the $CONTEXT-based extraction entirely.
  • fetch_provider_data: the same root cause was behind a jq: null has no keys error on every single run (.service.dimensions/.entity_nrn don't exist in $CONTEXT either) — reads ACTION_ENTITY_NRN/ACTION_SERVICE_DIMENSIONS_ENVIRONMENT instead.

Test plan

  • Verified end-to-end on a real cluster: a create action that previously failed with ERROR: base_domain is required now completes with exit status 0, and the HTTPRoute is actually applied to the cluster.
  • Maintainers: worth checking whether this same $CONTEXT vs ACTION_* mismatch affects other --build-context-consuming scripts/services in this org, since it isn't specific to path-router.

…utes

build_context checked .service.attributes.X // .parameters.X, but on a
create action .service.attributes already exists with empty-string
values (not null) for every schema property, so jq's // never falls
through to .parameters - the just-submitted form values (base_domain,
path_prefix, scope) are silently discarded and the action fails with
"base_domain is required" even when the field is explicitly filled in
the UI.

Switched to a merge where parameters win, which still resolves
correctly on update actions (unset parameters fall back to the already-
persisted service attributes).
@serialito74
serialito74 marked this pull request as draft August 25, 2026 15:52
Verified live against a real cluster that the previous commit's merge
fix (parameters win over stale attributes) was not actually the root
cause: $CONTEXT (from `--build-context`) never carries the action's own
id/slug/parameters/service data at all on the currently-shipping np
CLI - that JSON only carries related entities (scope/application/
namespace/account; "service" isn't even a valid --include resource).

Confirmed via a full env-var-name dump on a live failed action that the
action's own identity and submitted create-form values arrive as flat
ACTION_* environment variables instead, set directly by
`np service workflow exec` (ACTION_PARAMETERS_BASE_DOMAIN,
ACTION_SERVICE_ID, ACTION_ENTITY_NRN, ACTION_SERVICE_DIMENSIONS_ENVIRONMENT,
etc.) - not through $CONTEXT at all.

- build_context: read SERVICE_ID/SERVICE_SLUG/ACTION_ID/ACTION_NAME/
  APPLICATION_ID/BASE_DOMAIN/STRIP_PREFIX/PATH_PREFIX/SCOPE_SLUG
  directly from the corresponding ACTION_* env vars.
- fetch_provider_data: same root cause was behind a `jq: null has no
  keys` error on every single run (.service.dimensions/.entity_nrn
  don't exist in $CONTEXT either). Reads ACTION_ENTITY_NRN and
  ACTION_SERVICE_DIMENSIONS_ENVIRONMENT instead.

End-to-end verified: a real create action now completes successfully
and the HTTPRoute gets applied to the cluster.
@serialito74 serialito74 changed the title fix(istio): read create-time values from parameters, not stale attributes fix(istio): read action identity/parameters from ACTION_* env vars Aug 25, 2026

@sebastiancorrea81 sebastiancorrea81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants