CodeNOW Context Variables
Every time an application component is deployed to a target environment, CodeNOW automatically
injects a fixed set of CN_-prefixed environment variables into the running container. They
expose the component's CodeNOW context — which account, application, component, version, environment,
cluster and deployment it belongs to — so the running code can introspect where and as what it is
deployed, without calling back to the platform.
These variables are platform-managed: you do not define them in the Deployment Configuration, and they are added on top of your own environment variables and any variables injected from connected services.
CodeNOW context variables are injected into application components only. They are not added to containers or managed services.
Available variables
The following variables make up the current (v1) set. Values shown are illustrative examples.
| Variable | Meaning | Example |
|---|---|---|
CN_ACCOUNT_ID | Identifier of the account the component belongs to | acc-1 |
CN_ACCOUNT_NAME | Account name — currently equal to the account id (see note below) | acc-1 |
CN_APPLICATION_ID | Identifier of the application | app-1 |
CN_APPLICATION_NAME | Human-readable application name | My Application |
CN_COMPONENT_ID | Identifier of the application component | comp-1 |
CN_COMPONENT_NAME | Human-readable component name | My Component |
CN_COMPONENT_VERSION | Deployed version of the component | 1.2.3 |
CN_PACKAGE_ID | Identifier of the resolved build/package deployed | build-uuid |
CN_PACKAGE_VERSION | Version of the resolved package | 2.0.0 |
CN_IMAGE_TAG | Container image tag deployed | 1.2.3 |
CN_ENVIRONMENT_ID | Identifier of the target environment | prod-env |
CN_ENVIRONMENT_NAME | Human-readable environment name | Production |
CN_ENVIRONMENT_TYPE | Environment classification — prod or nonprod only | prod |
CN_CLUSTER_ID | Identifier of the cluster the component runs on | cluster-1 |
CN_CLUSTER_NAME | Human-readable cluster name | EU Cluster |
CN_NAMESPACE | Kubernetes namespace — equal to the environment id | prod-env |
CN_DEPLOYMENT_ID | Identifier of this deployment | dep-uuid |
CN_DEPLOYED_AT | Deployment timestamp, ISO-8601 in UTC | 2026-07-19T10:15:30Z |
As-built behavior
A few values behave differently from what their name might suggest:
CN_ENVIRONMENT_TYPEisprodornonprodonly. It is derived from whether the target environment is the application's designated production environment. There is nostage/dev/testdistinction in this version.CN_PACKAGE_IDandCN_PACKAGE_VERSIONare always present. Every deployment resolves a build/package, so these are emitted for every component.CN_ACCOUNT_NAMEcurrently equals the account id. No separate account display name exists yet, so the id is used as a fallback.CN_NAMESPACEequals the environment id.
Overriding and naming collisions
The CN_ block is applied after your own environment variables. As a result:
If you define your own environment variable using the CN_ prefix, the platform-injected value takes
precedence and overwrites yours. In this version the CN_ prefix is not reserved or blocked — but
to avoid surprises, do not use the CN_ prefix for your own variables. Reserving and enforcing the
prefix is planned for a future iteration.
Not included in this version
The following are intentionally out of scope for the current version and are not emitted:
CN_DEPLOYED_BY— no manual-vs-automated deployment actor signal exists yet.CN_IMAGE_DIGEST— only the image tag is available at deploy time.
Provenance metadata, platform URLs, pod-level details and OpenTelemetry-oriented variables are tracked as future work.