The environment the image of the last stage carries: the ENV keys of that * stage and of the earlier stages it is built FROM (a key's nearest * definition wins) -- image-scoped EnvVars the Dockerfile sets. */
| 1194 | * stage and of the earlier stages it is built FROM (a key's nearest |
| 1195 | * definition wins) -- image-scoped EnvVars the Dockerfile sets. */ |
| 1196 | static void dk_envs(dk_t *d) { |
| 1197 | const cbm_gbuf_node_t *mod = cbm_gbuf_find_by_id(d->ctx->gbuf, d->module); |
| 1198 | if (!mod || d->stage < 0 || d->stage >= DK_MAX_STAGES) { |
| 1199 | return; |
| 1200 | } |
| 1201 | CBMHashTable *seen = cbm_ht_create(0); |
| 1202 | int s = d->stage; |
| 1203 | for (int depth = 0; seen && s >= 0 && depth < DK_MAX_STAGES; depth++) { |
| 1204 | for (const dk_envkey_t *k = d->st[s].envs; k; k = k->next) { |
| 1205 | if (!cbm_ht_get(seen, k->name)) { |
| 1206 | cbm_ht_set(seen, k->name, (void *)k); |
| 1207 | if (cbm_pipeline_env_setter(d->ctx, mod, NULL, k->name, "dockerfile", k->line) > |
| 1208 | 0) { |
| 1209 | d->edges++; |
| 1210 | } |
| 1211 | } |
| 1212 | } |
| 1213 | int p = d->st[s].parent; |
| 1214 | s = p >= 0 && p < s ? p : -1; |
| 1215 | } |
| 1216 | cbm_ht_free(seen); |
| 1217 | } |
| 1218 | |
| 1219 | /* ── The image's files (F1: the env join) ───────────────────────────── */ |
| 1220 |
no test coverage detected