-
Notifications
You must be signed in to change notification settings - Fork 0
CI fix for ubuntu runner #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||||||||||||||||||||||||||||||||||||||
| FROM ubuntu:24.04 | ||||||||||||||||||||||||||||||||||||||||||
| RUN apt-get update && apt-get install -y curl xz-utils | ||||||||||||||||||||||||||||||||||||||||||
| RUN curl -O https://ziglang.org/download/0.15.2/zig-aarch64-linux-0.15.2.tar.xz && \ | ||||||||||||||||||||||||||||||||||||||||||
| tar xf zig-aarch64-linux-0.15.2.tar.xz && \ | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: git ls-files | grep -i dockerfile | head -20Repository: dragosv/testcontainers-zig Length of output: 80 🌐 Web query:
💡 Result: Zig 0.15.2 for Linux aarch64 is published as:
Zig’s official download pages emphasize verifying the Verify on Linux: minisign -Vm zig-aarch64-linux-0.15.2.tar.xz \
-P RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U( Sources: [1] Zig download page, [2] Zig community mirrors security notice, [3] minisign README/usage. 🏁 Script executed: cat -n DockerfileRepository: dragosv/testcontainers-zig Length of output: 509 Verify Zig tarball integrity before extraction. The downloaded archive is extracted without signature verification, creating a supply-chain risk. Zig provides minisig signatures alongside releases; use the official verification method instead of SHA256. Suggested fix-RUN apt-get update && apt-get install -y curl xz-utils
+RUN apt-get update && apt-get install -y curl xz-utils minisign
-RUN curl -O https://ziglang.org/download/0.15.2/zig-aarch64-linux-0.15.2.tar.xz && \
+RUN curl -fsSLO "https://ziglang.org/download/0.15.2/zig-aarch64-linux-0.15.2.tar.xz" && \
+ curl -fsSLO "https://ziglang.org/download/0.15.2/zig-aarch64-linux-0.15.2.tar.xz.minisig" && \
+ minisign -Vm zig-aarch64-linux-0.15.2.tar.xz -P RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U && \
tar xf zig-aarch64-linux-0.15.2.tar.xz && \🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| mv zig-aarch64-linux-0.15.2 /opt/zig && \ | ||||||||||||||||||||||||||||||||||||||||||
| ln -s /opt/zig/zig /usr/local/bin/zig | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat DockerfileRepository: dragosv/testcontainers-zig Length of output: 446 🏁 Script executed: # Verify if Zig download integrity checks exist elsewhere in the repo
find . -name "*.sha256" -o -name "*.sig" 2>/dev/null | head -20
git ls-files | grep -i "checksum\|hash\|integrity" | head -20Repository: dragosv/testcontainers-zig Length of output: 52 Use architecture-aware Zig artifact selection. The Dockerfile hardcodes the Suggested fix FROM ubuntu:24.04
+ARG ZIG_VERSION=0.15.2
+ARG TARGETARCH=amd64
RUN apt-get update && apt-get install -y curl xz-utils
-RUN curl -O https://ziglang.org/download/0.15.2/zig-aarch64-linux-0.15.2.tar.xz && \
- tar xf zig-aarch64-linux-0.15.2.tar.xz && \
- mv zig-aarch64-linux-0.15.2 /opt/zig && \
+RUN case "${TARGETARCH}" in \
+ amd64) ZIG_ARCH=x86_64 ;; \
+ arm64) ZIG_ARCH=aarch64 ;; \
+ *) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
+ esac && \
+ curl -fsSLO "https://ziglang.org/download/${ZIG_VERSION}/zig-${ZIG_ARCH}-linux-${ZIG_VERSION}.tar.xz" && \
+ tar xf "zig-${ZIG_ARCH}-linux-${ZIG_VERSION}.tar.xz" && \
+ mv "zig-${ZIG_ARCH}-linux-${ZIG_VERSION}" /opt/zig && \
ln -s /opt/zig/zig /usr/local/bin/zig🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| WORKDIR /app | ||||||||||||||||||||||||||||||||||||||||||
| COPY . . | ||||||||||||||||||||||||||||||||||||||||||
| CMD ["zig", "build", "integration-test", "--summary", "all"] | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run the container as a non-root user. No Suggested fix WORKDIR /app
COPY . .
+RUN useradd --create-home --uid 10001 appuser && chown -R appuser:appuser /app
+USER appuser
CMD ["zig", "build", "integration-test", "--summary", "all"]📝 Committable suggestion
Suggested change
🧰 Tools🪛 Trivy (0.69.1)[error] 1-1: Image user should not be 'root' Specify at least 1 USER command in Dockerfile with non-root user as argument Rule: DS-0002 (IaC/Dockerfile) [error] 2-2: 'apt-get' missing '--no-install-recommends' '--no-install-recommends' flag is missed: 'apt-get update && apt-get install -y curl xz-utils' Rule: DS-0029 (IaC/Dockerfile) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid fail-open kernel setup in CI.
Line 25 and Line 26 swallow failures with
|| true, so CI can proceed in a misconfigured state and fail later in harder-to-diagnose ways.Suggested fix
- name: Enable io_uring (Linux) if: runner.os == 'Linux' run: | - sudo sysctl -w kernel.io_uring_disabled=0 || true - sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 || true + set -euo pipefail + sudo sysctl -w kernel.io_uring_disabled=0 + if [ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + fi📝 Committable suggestion
🤖 Prompt for AI Agents