fix(dar): strip DPM_RESOLUTION_FILE from nested build env - #266
Merged
Conversation
Under `dpm localnet dar build-upload`, DPM injects DPM_RESOLUTION_FILE pointing at a temp resolution file it already wrote. build-upload and watch shell out to a nested `dpm build`, which inherited that var and aborted with "open <path>: file exists" because it tried to re-create the existing file. The standalone `canton-devkit ... --project` path worked only because that var is absent from its ambient env. Strip DPM_RESOLUTION_FILE from the child build environment so the nested build re-resolves from daml.yaml, matching the standalone behaviour. Apply to both runBuild (build-upload) and runBuildCtx (watch). Add a unit regression test (TestBuildEnv) plus a per-test e2e suite for `dpm localnet` (mirroring the Milestone 1 split): scripts/e2e/dpm-*.sh, a hermetic local-path component builder, a composite action, and a new self-hosted workflow. DPM-DAR-001 is the first case and runs --build-only, so no LocalNet is required. Fixes #230
All e2e jobs run on the same single, non-concurrent self-hosted runner, so passing the built binary between jobs via upload/download-artifact added GitHub storage/bandwidth cost for no benefit. Remove the separate setup job and build the binary inside the test job's composite action (make build) right before it assembles the local component.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dpm localnet dar build-uploadfails inside a Daml project withopen /var/folders/.../T/<n>.yaml: file exists.dpm localnet …, DPM injectsDPM_RESOLUTION_FILEpointing at a temp resolution file it already wrote. DevKit shells out to a nesteddpm build, which inherits the var and aborts trying to re-create the existing file. The standalonecanton-devkit … --projectpath works only because that var is absent from its ambient env.DPM_RESOLUTION_FILEfrom the child build's environment so it re-resolves fresh fromdaml.yaml, matching the working standalone behaviour.Changes
internal/cli/localnet/dar/buildupload.go: addbuildEnv()helper (drops onlyDPM_RESOLUTION_FILE);runBuildsetsc.Env = buildEnv().internal/cli/localnet/dar/watch.go:runBuildCtx(same latent bug) setsc.Env = buildEnv().internal/cli/localnet/dar/buildupload_test.go:TestBuildEnvunit regression test (purego test, no DPM/Docker)..gitignore: add.tmp/for local scratch (per AGENTS.md).Notes
make build,make lint(0 issues), andmake test(all packages) pass.dpm localnete2e suite is intentionally not in this PR; it lands in a dedicated follow-up PR reimplemented on bats-core, to keep this change focused on the fix.