Skip to content

fix(ci): add non-root user to test Containerfile - #291

Merged
marcusburghardt merged 2 commits into
complytime:mainfrom
marcusburghardt:fix/test-containerfile-nonroot-user
May 28, 2026
Merged

fix(ci): add non-root user to test Containerfile#291
marcusburghardt merged 2 commits into
complytime:mainfrom
marcusburghardt:fix/test-containerfile-nonroot-user

Conversation

@marcusburghardt

@marcusburghardt marcusburghardt commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

Trivy source scan flags DS-0002 (Image user should not be root) on the test
Containerfile used by ci_test_publish_ghcr. This was introduced in #285.

Adds USER nobody to satisfy the misconfig check.

Related Issues

Review Hints

  • Single-line addition (USER nobody) to a test-only Containerfile. The image only runs cat /test-marker which does not require root.

Trivy source scan flags DS-0002 (Image user should not be root) on
the test Containerfile used by ci_test_publish_ghcr. Add USER nobody
to satisfy the misconfig check.

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
@marcusburghardt

Copy link
Copy Markdown
Member Author

CI note: The Test Attestations Override and Test Unprotected Ref failures are unrelated to this Containerfile change. They fail on fork PRs because the GITHUB_TOKEN has read-only packages permission, so the test cannot push images to GHCR. The org membership check also fails for members with private visibility (see the -L redirect to /public_members in reusable_publish_ghcr.yml:133-138). These checks can be waived for this PR.

@trevor-vaughan -- to avoid these recurring failures on fork PRs while preserving the intent of these test workflows, would it make sense to gate them with a fork detection condition? For example:

if: >-
  needs.check-changes.outputs.ghcr_files_changed == 'true' &&
  github.event.pull_request.head.repo.full_name == github.repository

This would cleanly skip the publish tests on fork PRs (where they can never succeed due to token restrictions) while keeping them running for internal PRs.

@trevor-vaughan

Copy link
Copy Markdown
Member

@marcusburghardt Good call on the fork check. Do you want to add that to this PR?

trevor-vaughan
trevor-vaughan previously approved these changes May 28, 2026
@marcusburghardt

Copy link
Copy Markdown
Member Author

@marcusburghardt Good call on the fork check. Do you want to add that to this PR?

Sure. It should be a couple of lines, but would like to get your thoughts before. :) Let me do that in a minute.

Fork PRs receive a GITHUB_TOKEN with read-only packages permission,
making it impossible to push images to GHCR. Gate the publish test
jobs so they only run on internal PRs where the token has the
required write access.

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
@trevor-vaughan

Copy link
Copy Markdown
Member

Change makes sense. Sorry for not thinking about that earlier!

@marcusburghardt

Copy link
Copy Markdown
Member Author

Change makes sense. Sorry for not thinking about that earlier!

No worries. I also didn't "see" this during review. : )

@marcusburghardt
marcusburghardt merged commit 9c3ba18 into complytime:main May 28, 2026
12 checks passed
@marcusburghardt
marcusburghardt deleted the fix/test-containerfile-nonroot-user branch May 28, 2026 14:16
marcusburghardt added a commit that referenced this pull request May 29, 2026
dependabot[bot] is not an org member, so the org membership check
in reusable_publish_ghcr.yml always fails for dependabot PRs that
touch GHCR-related files. The fork detection guard from #291 does
not help because dependabot branches live in the same repository.

Add an actor exclusion so the GHCR integration test jobs skip
cleanly for dependabot PRs instead of producing false failures.

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
@beatrizmcouto beatrizmcouto moved this to Backlog in ComplyTime planning Jun 8, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done ✔️ in ComplyTime planning Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

3 participants