Some checks are pending
Go Benchmark / Performance Regression Check (push) Waiting to run
Cerberus Integration / Cerberus Security Stack Integration (push) Waiting to run
Upload Coverage to Codecov / Backend Codecov Upload (push) Waiting to run
Upload Coverage to Codecov / Frontend Codecov Upload (push) Waiting to run
CodeQL - Analyze / CodeQL analysis (go) (push) Waiting to run
CodeQL - Analyze / CodeQL analysis (javascript-typescript) (push) Waiting to run
CrowdSec Integration / CrowdSec Bouncer Integration (push) Waiting to run
Docker Build, Publish & Test / build-and-push (push) Waiting to run
Docker Build, Publish & Test / Security Scan PR Image (push) Blocked by required conditions
Quality Checks / Auth Route Protection Contract (push) Waiting to run
Quality Checks / Codecov Trigger/Comment Parity Guard (push) Waiting to run
Quality Checks / Backend (Go) (push) Waiting to run
Quality Checks / Frontend (React) (push) Waiting to run
Rate Limit integration / Rate Limiting Integration (push) Waiting to run
Security Scan (PR) / Trivy Binary Scan (push) Waiting to run
Supply Chain Verification (PR) / Verify Supply Chain (push) Waiting to run
WAF integration / Coraza WAF Integration (push) Waiting to run
5.9 KiB
Executable File
5.9 KiB
Executable File
title, status, scope
| title | status | scope |
|---|---|---|
| CI Image Ref Debug and Validation Fix | draft | ci/build-image, ci/integration |
1. Introduction
This plan addresses integration failures reporting invalid reference format by making image output values observable, trimming/normalizing digests and image references, and validating Docker Hub image refs before downstream jobs consume them. The focus is the Emit image outputs step and related tag logging in the CI pipeline.
Objectives:
- Remove masking that hides computed image refs in logs.
- Normalize and trim digest and image refs to prevent whitespace/newline errors.
- Validate Docker Hub image references in the build job to surface failures early.
- Use safe
printfin the tag echo step to avoid formatting artifacts.
2. Research Findings
2.1 Current CI Flow
- The build job defines image tags in
Compute image tags, then builds/pushes images and emits outputs inEmit image outputsin [ .github/workflows/ci-pipeline.yml ]. - Integration jobs pull
needs.build-image.outputs.image_ref_dockerhuband rundocker pullwith that value. IS_FORKis defined at workflow env level, whilePUSH_IMAGEis computed inDetermine image push policyand exported via outputs.
2.2 Current Risk Points
Emit image outputsuses raw${{ steps.push.outputs.digest }}without trimming. Any whitespace or newline indigestcan produce an invalid reference.IMAGE_REF_DOCKERHUBis assembled fromDIGESTor fromTAGS_RAW(a multi-line string). It is not explicitly trimmed before being written to outputs.Echo generated tagscurrently usesecho, which can interpret escape sequences or alter formatting.Emit image outputsmasks the computed refs, reducing the ability to troubleshoot malformed references.
3. Technical Specifications
3.1 Remove Masking in Emit Outputs
- Remove
::add-mask::${IMAGE_REF_DOCKERHUB}and::add-mask::${IMAGE_REF_GHCR}fromEmit image outputs. - Log the final
IMAGE_REF_DOCKERHUBandIMAGE_REF_GHCRvalues in plain text for debugging.
3.2 Trim Digest
- Before use, trim
DIGESTusingxargsor bash trimming. - Ensure
DIGESTis empty or strictly formatted assha256:...before assembling an immutable ref.
3.3 Sanitize Image Ref Outputs
- Normalize
IMAGE_REF_DOCKERHUBandIMAGE_REF_GHCRby trimming whitespace and removing CR characters. - Ensure outputs are written as a single line with no trailing spaces or newlines.
3.4 Local Validation in Build Job
- Add a validation command in or immediately after
Emit image outputs:- Preferred:
docker manifest inspect "${IMAGE_REF_DOCKERHUB}"if manifest is expected in the registry. - Fallback:
docker pull "${IMAGE_REF_DOCKERHUB}".
- Preferred:
- Gate the validation on
PUSH_IMAGE=trueandPUSH_OUTCOME=successto avoid failing on non-push builds. - On failure, emit a clear error that includes the actual
IMAGE_REF_DOCKERHUBvalue.
3.5 Safe Tag Logging
- Replace
echoinEcho generated tagswithprintf '%s\n'to avoid formatting surprises and preserve newlines.
3.6 Data Flow Summary (Image Ref)
- Build tags -> Build/Push -> Emit normalized refs -> Validate ref -> Downstream
docker pull.
4. Implementation Plan
Phase 1: Playwright Tests (Behavior Baseline)
- No UI changes are expected; note that Playwright coverage is unchanged.
Phase 2: CI Build Job Debugging Enhancements
- Update
Echo generated tagsto useprintf. - In
Emit image outputs, remove masking and add explicit logging of computed refs. - Add trim logic for
DIGEST. - Trim
IMAGE_REF_DOCKERHUBandIMAGE_REF_GHCRbefore writing outputs.
Phase 3: Build Job Validation Gate
- Add Docker manifest/pull validation in
Emit image outputs(or immediately after). - Ensure validation only runs for successful push runs.
Phase 4: Integration Safety
- Ensure downstream integration jobs continue to consume the sanitized
image_ref_dockerhuboutput. - Confirm no behavior change for forked PRs where
PUSH_IMAGE=false.
Complexity Estimates
| Component | Complexity | Notes |
|---|---|---|
| Emit image outputs normalization | Low | String trimming and output formatting |
| Tag echo change | Low | Replace echo with printf |
| Local validation | Medium | Adds network dependency on registry and failure handling |
5. Acceptance Criteria (EARS)
- WHEN the build job emits image outputs, THE SYSTEM SHALL log
IMAGE_REF_DOCKERHUBandIMAGE_REF_GHCRwithout masking. - WHEN the build job receives a digest, THE SYSTEM SHALL trim whitespace before assembling immutable image references.
- WHEN the build job writes image refs to outputs, THE SYSTEM SHALL ensure they are single-line, whitespace-free strings.
- WHEN the build job completes a successful image push, THE SYSTEM SHALL validate
IMAGE_REF_DOCKERHUBviadocker manifest inspectordocker pullbefore downstream jobs run. - WHEN tags are echoed in the build job, THE SYSTEM SHALL use
printffor safe, predictable output.
6. Risks and Mitigations
- Risk: Registry hiccups cause false negatives during validation.
Mitigation: Use
docker manifest inspectfirst; on failure, retry once or emit a clear message with ref value and context. - Risk: Removing masking exposes sensitive data. Mitigation: Image refs are not secrets; confirm no credentials or tokens are logged.
- Risk: Additional validation adds runtime. Mitigation: Only validate on push-enabled runs and keep validation in build job (single check).
7. Open Questions
- Should validation use
docker manifest inspectonly, or fallback todocker pullfor improved diagnostics? - Should we log both raw and normalized digest values for deeper troubleshooting?
8. Confidence Score
Confidence: 86 percent
Rationale: The failure mode is consistent with whitespace or formatting issues in image refs, and the proposed changes are localized to the build job. Validation behavior depends on registry availability but should be manageable with careful gating.