adding immutable image tags for docker images #2262
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2262
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2262/head"
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?
Imported from GitHub pull request.
Original GitHub pull request: #1686
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1686
Original created: 2025-10-03T04:43:30Z
Original updated: 2025-10-03T04:45:05Z
Original head: carverauto/serviceradar:1685-chorebazel-immutable-image-tags
Original base: main
Original merged: 2025-10-03T04:44:45Z by @mfreeman451
PR Type
Enhancement
Description
Add immutable image tagging system for Docker containers
Create helper rule to generate digest-based tags
Refactor GHCR push targets to use new tagging system
Replace hardcoded tags with dynamic tag generation
Diagram Walkthrough
File Walkthrough
container_tags.bzl
Add immutable container tagging ruledocker/images/container_tags.bzl
immutable_push_tagsfor generating containertags
tags
push_targets.bzl
Integrate immutable tagging into push targetsdocker/images/push_targets.bzl
immutable_push_tagsrule from container_tags.bzlImported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1686#issuecomment-3364237330
Original created: 2025-10-03T04:44:05Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
Shell command execution
Description: The rule executes an inline shell script using inputs that may be derived from the
repository (digest/commit tag files); if any of these can be influenced by untrusted
content, this could enable command injection or unintended execution in the build
environment.
container_tags.bzl [19-66]
Referred Code
🎫 #1685
tags.
tags.
Codebase context is not defined
Follow the guide to enable codebase context checks.
No custom compliance provided
Follow the guide to enable custom compliance check.
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1686#issuecomment-3364239289
Original created: 2025-10-03T04:45:05Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Extract embedded shell script into a separate file
The inline shell script within the
immutable_push_tagsrule should be extractedinto a dedicated
.shfile. This change will improve maintainability andtestability.
Examples:
docker/images/container_tags.bzl [19-66]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 7
__
Why: This is a valid and significant suggestion that improves the design of the new
immutable_push_tagsrule by promoting better maintainability, testability, and separation of concerns.Filter out whitespace-only tag lines
To prevent whitespace-only tags from the
commit_file, replace the[[ -n "$line"]]check with a regex[[ "$line" =~ [^[:space:]] ]]to ensure the line containsnon-whitespace characters.
docker/images/container_tags.bzl [39-41]
Suggestion importance[1-10]: 6
__
Why: This is a valid suggestion that improves the robustness of the script by preventing tags containing only whitespace from being generated from the
commit_file, which could lead to invalid tags.Filter out whitespace-only static tags
To prevent whitespace-only static tags, replace the
[[ -n "$tag" ]]check with aregex
[[ "$tag" =~ [^[:space:]] ]]to ensure the tag contains non-whitespacecharacters.
docker/images/container_tags.bzl [46-48]
Suggestion importance[1-10]: 6
__
Why: This is a valid suggestion that improves the robustness of the script by preventing
static_tagscontaining only whitespace from being processed, which could lead to invalid tags.Use shell parameter expansion for substring
Replace the
cutcommand with the more efficient and reliable shell parameterexpansion (
${variable:offset:length}) for substring extraction.docker/images/container_tags.bzl [34]
Suggestion importance[1-10]: 4
__
Why: The suggestion correctly points out that using shell parameter expansion is more efficient and a better practice than forking a
cutprocess, which is a valid code quality improvement.