docker-dev rig image stamps a bare 1.0.0 informational version (no git SHA): .dockerignore excludes .git #893
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while fixing ScadaBridge#134 (2026-11-12). Same gap here.
Symptom: the docker-dev rig image stamps
AssemblyInformationalVersionas a bare1.0.0, with no+<git sha>. Checked on the current local image:docker run --rm --entrypoint sh otopcua-host:dev -c "grep -ao '1\.0\.0[+0-9a-f-]*' OtOpcUa.Host.dll"prints1.0.0. Soservice.version(Telemetry 0.3.0 defaults it from the informational version) and anything else that identifies the build on the rig can't tell which commit is running. Builds for the wonder boxes are published from a checkout, so they keep the SHA and aren't affected.Cause:
docker-dev/Dockerfilerunsdotnet publishinside the image afterCOPY . ., but the repo-root.dockerignoreexcludes.git/. SourceLink has no repository to read, soSourceRevisionIdstays empty.Fix (the one ScadaBridge took,
7e34d7c2): keep.git/excluded. AddARG SOURCE_REVISION=to the build stage, and pass${SOURCE_REVISION:+-p:SourceRevisionId=${SOURCE_REVISION}}on the publish. Then havedocker-dev/deploy.shsupplygit rev-parse HEAD, with-dirtyadded ifgit status --porcelain --untracked-files=nois non-empty. Here the images are built by composebuild:(hostandmigrator), so wire it in asbuild.args: SOURCE_REVISION: ${SOURCE_REVISION:-}indocker-compose.yml, with deploy.sh exporting the value. If the arg is empty, the build still succeeds as1.0.0. One note: the build stage hasCOPY . .before restore, so the ARG position doesn't affect restore caching.Fixed in
6147e8dconmaster(mirrors ScadaBridge7e34d7c2).docker-dev/Dockerfile:ARG SOURCE_REVISION=after restore; publish adds${SOURCE_REVISION:+-p:SourceRevisionId=${SOURCE_REVISION}}..git/stays in.dockerignore.docker-dev/docker-compose.yml:build.args: SOURCE_REVISION: ${SOURCE_REVISION:-}onmigratorand the host anchor (runtime).docker-dev/compose.sh: exportsgit rev-parse HEAD(-dirtyifgit status --porcelain --untracked-files=nois non-empty; an explicitSOURCE_REVISIONwins) and runsdocker compose -f docker-dev/docker-compose.yml "$@".docker-dev/deploy.shhere is the deploy-POST script, not a build script, so the wrapper is new. README bring-up now usesdocker-dev/compose.sh up -d --build.Evidence (worktree builds, isolated tags so
otopcua-host:devwas not touched):(The bare
1.0.0in the positive output is the AssemblyVersion/FileVersion strings; the informational version carries the+sha.)Wrapper → compose:
docker-dev/compose.sh configprintedSource revision: 00a5be26...-dirtyand resolvedSOURCE_REVISIONinto all 7 build sections (migrator + 6 host nodes); a plaindocker compose ... configresolves it to"".