Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix artifact upload permissions in musl aarch64 CI job#616

Open
r1viollet wants to merge 4 commits into
mainDataDog/java-profiler:mainfrom
r1viollet/fix-musl-aarch64-artifact-permissionsDataDog/java-profiler:r1viollet/fix-musl-aarch64-artifact-permissionsCopy head branch name to clipboard
Open

Fix artifact upload permissions in musl aarch64 CI job#616
r1viollet wants to merge 4 commits into
mainDataDog/java-profiler:mainfrom
r1viollet/fix-musl-aarch64-artifact-permissionsDataDog/java-profiler:r1viollet/fix-musl-aarch64-artifact-permissionsCopy head branch name to clipboard

Conversation

@r1viollet

@r1viollet r1viollet commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?:
Fixes permission denied errors when uploading build artifacts in the test-linux-musl-aarch64 CI job.

Motivation:
The Alpine Docker container creates files as root, causing GitHub Actions to fail when trying to read them during artifact zip creation:

Error: EACCES: permission denied, open '/home/runner/work/java-profiler/java-profiler/build/reports/problems/problems-report.html'

Additional Notes:

  • Uses sudo chmod -R a+rX after Docker execution to ensure files are readable (umask-independent)
  • Capital X adds execute only to directories, consolidating the previous two-command approach
  • Covers all build directories: build/, ddprof-test/build/, ddprof-lib/build/
  • Applied after both Test and Generate Unwinding Report steps
  • Errors are visible in logs (|| true only handles missing paths gracefully)

How to test the change?:
Run the test-linux-musl-aarch64 job and verify artifacts upload successfully without permission errors.

For Datadog employees:

  • This PR doesn't touch any of that.

Docker containers create files as root, causing permission denied errors
when GitHub Actions tries to read them during artifact zip creation.
Add explicit chmod steps after container execution to ensure files are
readable by the runner user.
@datadog-official

datadog-official Bot commented Jun 26, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 15 Pipeline jobs failed

DataDog/java-profiler | benchmarks-candidate-aarch64: [alloc]   View in Datadog   GitLab

DataDog/java-profiler | benchmarks-candidate-aarch64: [cpu,wall,alloc,memleak]   View in Datadog   GitLab

DataDog/java-profiler | benchmarks-candidate-aarch64: [cpu,wall]   View in Datadog   GitLab

View all 15 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 8a678da | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #28379855368 | Commit: cd65f72 | Duration: 16m 36s (longest job)

All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - - -
8-ibm - - -
8-j9 - -
8-librca - -
8-orcl - - -
11 - - -
11-j9 - -
11-librca - -
17 - -
17-graal - -
17-j9 - -
17-librca - -
21 - -
21-graal - -
21-librca - -
25 - -
25-graal - -
25-librca - -

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-06-29 14:54:15 UTC

The unwinding report generation creates files in both top-level build/
and subproject build directories. Ensure all are readable by the runner.
@dd-octo-sts

dd-octo-sts Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Reliability & Chaos Results

All reliability & chaos checks passed Pipeline: https://gitlab.ddbuild.io/DataDog/java-profiler/-/pipelines/121631747

echo "musl-${{ matrix.java_version }}-${{ matrix.config }}-aarch64" >> failures_musl-${{ matrix.java_version }}-${{ matrix.config }}-aarch64.txt
exit 1
fi
- name: Fix permissions for artifact upload

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Sphinx Review — LOW] This fixes the symptom (root-owned files left by the container) rather than the cause. The Docker invocations run as root by default (no --user flag) and bind-mount the workspace, so every file the container writes is owned by root and unreadable/undeletable by the runner user. The chmod-after-the-fact approach must be replicated at every container step (already two copies, with diverging scope) and re-applied for any future container step.

Suggestion: Consider running the containers with --user $(id -u):$(id -g) so emitted files are owned by the runner user, removing the need for repeated post-hoc sudo chmod. If the in-container toolchain requires root, keep the chmod but extract it to a single reused step.

Comment thread .github/workflows/test_workflow.yml Outdated
run: |
# Files created by Docker container may have restrictive permissions
# that prevent GitHub Actions from reading them during artifact creation
sudo chmod -R +r build/ ddprof-test/build/ ddprof-lib/build/ 2>/dev/null || true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Sphinx Review — MEDIUM] The permission-fix commands swallow every failure via 2>/dev/null || true, and the step runs if: always(). If sudo is unavailable, the path is missing, or the chmod is denied, the failure is silently discarded and the step reports success. The downstream consumer prepare_reports.sh also copies from the same root-owned trees with || true on every cp/find. If the chmod silently fails, prepare_reports.sh silently skips the unreadable sources and the resulting test-reports artifact is quietly incomplete — and when the subsequent Upload build artifacts step then fails for the exact permission reason this code was meant to fix, the root cause is invisible.

Suggestion: Drop 2>/dev/null so chmod failures appear in the step log, enabling diagnosis when artifacts are still incomplete or the upload still fails. Keep || true only if a clean exit is genuinely desired, or echo a warning when chmod returns non-zero.

Comment thread .github/workflows/test_workflow.yml Outdated
run: |
# Files created by Docker container may have restrictive permissions
# that prevent GitHub Actions from reading them during artifact creation
sudo chmod -R +r build/ ddprof-test/build/ ddprof-lib/build/ 2>/dev/null || true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Sphinx Review — LOW] sudo chmod -R +r build/ ddprof-test/build/ ddprof-lib/build/ makes every file under the build trees world-readable. This job runs on a self-hosted shared runner group (group: ARM LINUX SHARED), not an ephemeral single-tenant GitHub-hosted runner. On a shared runner the filesystem can be visible to other jobs/tenants, so blanket world-readable build output (which may contain build-injected tokens or signing material) is a non-trivial exposure surface.

Suggestion: Restrict the recursive chmod to the exact report/artifact subtrees that are uploaded (e.g. build/reports, ddprof-test/build/reports) rather than the entire build/ trees, or narrow to o+r only where required.

Comment thread .github/workflows/test_workflow.yml Outdated
\"${{ matrix.config }}\" \"${{ env.JAVA_HOME }}\" \"${{ env.JAVA_TEST_HOME }}\"
"
# Fix permissions after Docker container execution (both top-level and subproject builds)
sudo chmod -R +r build/ ddprof-test/build/ 2>/dev/null || true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Sphinx Review — LOW] The second permission-fix block (appended to Generate Unwinding Report) covers only build/ and ddprof-test/build/, dropping ddprof-lib/build/ which the first block covers. The unwinding-report container runs the build as root in the same way as the test container and can leave root-owned files under ddprof-lib/build/. On the success path prepare_reports.sh reads ddprof-lib/build (find ddprof-lib/build -name 'libjavaProfiler.*' and cp -r ddprof-lib/build/tmp), so files newly created as root there by the unwinding container are not re-chmod'd and may be silently skipped.

Suggestion: Align the second chmod block to cover ddprof-lib/build/ as well, matching the first block, or consolidate both into a single reused step to keep the scope in sync.

- Remove 2>/dev/null to make chmod failures visible in logs
- Add ddprof-lib/build/ to second chmod block for consistency
- Keep || true for graceful handling of missing paths
@r1viollet

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review! Fixed the actionable issues:

Silent failures (MEDIUM): Removed 2>/dev/null so chmod errors now appear in step logs.

Inconsistent coverage (LOW): Added ddprof-lib/build/ to the second chmod block to match the first.

Re: --user flag - Can't use it here because the Alpine containers run apk add which requires root. The chmod-after approach is the cleanest solution given the constraint.

Re: world-readable on shared runners - These are test builds without secrets, so the exposure is minimal. If this becomes a concern we can narrow to specific report directories.

@r1viollet r1viollet marked this pull request as ready for review June 29, 2026 12:09
@r1viollet r1viollet requested a review from a team as a code owner June 29, 2026 12:09
Comment thread .github/workflows/test_workflow.yml Outdated
- Use 'a+rX' instead of '+r' (umask-independent)
- Capital X adds execute only to directories
- Consolidates two chmod commands into one
- Update comments to explain the approach
@r1viollet

Copy link
Copy Markdown
Contributor Author

Great catch on the umask issue! Switched to a+rX which is umask-independent and consolidates both chmod commands (capital X adds execute only to directories). Comments updated to explain the approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.