Sanitize branch-derived Docker tag in Makefile targets#80
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30eb48b686
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| open htmlcov/index.html || echo "Open htmlcov/index.html in your browser to view the coverage report." | ||
|
|
||
| .PHONY: container-local | ||
| DOCKER_TAG := $(shell git branch --show-current | tr -c '[:alnum:]._-' '-') |
There was a problem hiding this comment.
Trim branch newline before sanitizing Docker tag
git branch --show-current emits a trailing newline, and at this line tr -c '[:alnum:]._-' '-' converts that newline into -, so every computed tag becomes <branch>- (for example, work-), not the intended sanitized branch name. This changes the image tag unexpectedly for all container-local/container-run invocations and can break scripts or expectations that rely on branch-aligned tags; trim the newline first (or strip trailing dashes after transliteration).
Useful? React with 👍 / 👎.
Motivation
Description
DOCKER_TAGvariable that derives the branch name viagit branch --show-currentand normalizes it withtr -c '[:alnum:]._-' '-'to a Docker-tag-safe character set.$(shell git branch --show-current)in thecontainer-localandcontainer-runtargets with$(DOCKER_TAG).Testing
make -n container-localandmake -n container-runand confirmed both commands emit the sanitized$(DOCKER_TAG)image tag.Codex Task