Skip to content

fix(e2e-sandbox): use curl -fsSL when downloading mc - #2690

Merged
myasnikovdaniil merged 1 commit into
mainfrom
fix/e2e-sandbox-mc-download
May 20, 2026
Merged

myasnikovdaniil merged 1 commit into
mainfrom
fix/e2e-sandbox-mc-download

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • RUN curl … mc in packages/core/testing/images/e2e-sandbox/Dockerfile ran without -L, so when dl.min.io returned a 302, the HTML redirect body (<a href=...>Found</a>) was written to /usr/local/bin/mc and chmod'd executable.
  • When the bucket E2E test then ran mc alias set …, the shell tried to interpret the HTML as a script and errored with /usr/local/bin/mc: 1: cannot open a: No such file (dash reading <a as an input redirect).
  • Switching to curl -fsSL follows the redirect and fails fast on HTTP errors. The textual change to the RUN instruction also busts the cached layer so the next build pulls a real ELF binary.

Test plan

  • CI Build job rebuilds e2e-sandbox image with the new layer
  • E2E bucket bats test runs mc alias set without the cannot open a error
  • file /usr/local/bin/mc inside the rebuilt image reports an ELF binary, not ASCII text

Release note

fix(e2e-sandbox): download `mc` with `curl -fsSL` so the image ships a real binary

Summary by CodeRabbit

  • Chores
    • Improved Docker sandbox test environment build reliability by enhancing MinIO client installation with robust error handling and corrected configuration paths to ensure consistent container image creation.

Review Change Stack

The minio client was downloaded without -L, so when dl.min.io served
a 302 redirect, curl wrote the HTML body ("<a href=...>Found</a>") to
/usr/local/bin/mc, chmod +x'd it, and shipped that as the binary. When
the bucket E2E test ran "mc alias set ...", the shell tried to interpret
the HTML as a script and errored with:

    /usr/local/bin/mc: 1: cannot open a: No such file

(dash reading "<a" as an input redirect from a file named "a").

The image is rebuilt per CI run from cached layers; the broken mc layer
was cached and reused. Adding -fsSL fixes the download and the textual
change busts the cache so the next build pulls a real ELF binary.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Signed-off-by: Myasnikov Daniil <[email protected]>
@github-actions github-actions Bot added area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/bug Categorizes issue or PR as related to a bug size/XS This PR changes 0-9 lines, ignoring generated files labels May 20, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a failure in the e2e-sandbox image build process caused by an improperly configured curl command. By adding flags to follow redirects and fail on server errors, the change ensures that the correct ELF binary is downloaded instead of an HTML redirect response, thereby preventing runtime errors during E2E testing.

Highlights

  • Corrected mc binary download: Updated the curl command in the Dockerfile to use the -fsSL flags, ensuring that HTTP redirects are followed and the build fails immediately if the download encounters an error.
  • Resolved binary corruption: Fixed an issue where the build process was incorrectly saving an HTML redirect page as the mc binary, preventing execution errors in E2E tests.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The e2e-sandbox Dockerfile's MinIO client installation is updated from a basic curl invocation to use fail-fast flags (-fsSL) with corrected output path to /usr/local/bin/mc, improving robustness while preserving directory creation and permission setup.

Changes

MinIO Client Installation

Layer / File(s) Summary
MinIO client curl installation fix
packages/core/testing/images/e2e-sandbox/Dockerfile
The curl command downloading the MinIO mc binary is updated to use -fsSL flags (fail-fast, silent, show-errors, location-follow), with corrected output path to /usr/local/bin/mc. Directory creation and executable permissions remain intact.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit's whisker for safer downloads so fine,
Fail-fast curl flags make the e2e-sandbox align,
/usr/local/bin/mc now stands proud and true,
MinIO tools working, through and through! 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main fix: updating the curl command for mc download to use -fsSL flags in the e2e-sandbox Dockerfile.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/e2e-sandbox-mc-download

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added area/build Issues or PRs related to image build infrastructure, multi-arch support area/testing Issues or PRs related to testing (e2e, bats, unit tests) labels May 20, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the e2e-sandbox Dockerfile to improve the reliability of the MinIO client download by adding standard curl flags and fixing minor formatting. Feedback indicates that the PR does not comply with repository standards: the PR body is missing the required release-note block, and the PR title uses an invalid scope that does not match the project's defined scopes.

RUN curl -sSL "https://github.com/cozystack/cozyhr/raw/refs/heads/main/hack/install.sh" | sh -s -- -v "${COZYHR_VERSION}"
RUN curl https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc --create-dirs -o /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc
RUN curl -fsSL "https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc" --create-dirs -o /usr/local/bin/mc \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

The PR body is missing the required release-note block. According to the repository style guide, every pull request must include a release note in the following format:

```release-note
type(scope): human-readable changelog entry

<details>
<summary>References</summary>

1. PR body must contain a release note block. <sup>([link](https://github.com/cozystack/cozystack/blob/main/.gemini/styleguide.md))</sup>
</details>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a release-note block to the PR description.

RUN curl -sSL "https://github.com/cozystack/cozyhr/raw/refs/heads/main/hack/install.sh" | sh -s -- -v "${COZYHR_VERSION}"
RUN curl https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc --create-dirs -o /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc
RUN curl -fsSL "https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc" --create-dirs -o /usr/local/bin/mc \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

The PR title uses an invalid scope e2e-sandbox. According to the style guide, the scope should match a package directory under packages/ (e.g., testing) or be one of the predefined meta scopes (e.g., tests).

References
  1. Valid scopes must follow the Conventional Commits format and match the project's defined scopes. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

e2e-sandbox matches the package directory packages/core/testing/images/e2e-sandbox/ and is the scope the earlier commit on this branch (cc37fec) used. docs/agents/contributing.md lists scopes as examples that can be extended for a specific area, so keeping it as is.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the Dockerfile for the e2e-sandbox image, specifically updating the curl command for the MinIO client to include the -fsSL flags and proper quoting. The review feedback identifies a missing release-note block in the pull request description, which is a requirement of the repository style guide, and recommends pinning the MinIO client to a specific version to improve build reproducibility.

RUN curl -sSL "https://github.com/cozystack/cozyhr/raw/refs/heads/main/hack/install.sh" | sh -s -- -v "${COZYHR_VERSION}"
RUN curl https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc --create-dirs -o /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc
RUN curl -fsSL "https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc" --create-dirs -o /usr/local/bin/mc \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The pull request body is missing the required release-note block. According to the repository style guide, every PR must include a block in the following format:

```release-note
type(scope): human-readable changelog entry

Please add this block to the PR description to satisfy the project requirements.

<details>
<summary>References</summary>

1. PR body must contain a release note block in a specific format. Flag any PR whose body has no release-note block. <sup>([link](https://github.com/cozystack/cozystack/blob/main/.gemini/styleguide.md))</sup>
</details>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the release-note block to the PR description.

RUN curl -sSL "https://github.com/cozystack/cozyhr/raw/refs/heads/main/hack/install.sh" | sh -s -- -v "${COZYHR_VERSION}"
RUN curl https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc --create-dirs -o /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc
RUN curl -fsSL "https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc" --create-dirs -o /usr/local/bin/mc \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

To ensure build reproducibility and avoid non-deterministic behavior, consider pinning the mc binary to a specific version rather than downloading the latest release from the release/ path. Other tools in this Dockerfile (such as kubectl, talosctl, and helm) already follow this pattern using versioned ARGs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving the version pin out of scope for this redirect fix. The Dockerfile already mixes pinning styles — kubectl/talosctl/helm use ARGs, yq is hardcoded in the URL, and the fluxcd.io and cozyhr install scripts pull whatever those installers resolve. Adding a single ARG for mc doesn't meaningfully improve reproducibility on its own; happy to do a follow-up that pins everything consistently if there's appetite.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the curl command used to download the MinIO client in the e2e-sandbox Dockerfile, adding standard flags and improving formatting. Feedback was provided regarding compliance with the repository's style guide, specifically the requirement for a release-note block in the PR description and the use of the correct commit scope. Additionally, it was suggested to use a specific version for the mc binary to ensure build reproducibility.

RUN curl -sSL "https://github.com/cozystack/cozyhr/raw/refs/heads/main/hack/install.sh" | sh -s -- -v "${COZYHR_VERSION}"
RUN curl https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc --create-dirs -o /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc
RUN curl -fsSL "https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc" --create-dirs -o /usr/local/bin/mc \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

The pull request body is missing the required release-note block. Please add it to the description as per the repository style guide. Additionally, the commit scope e2e-sandbox should ideally be testing to match the package directory name under packages/core/, as specified in rule 45.

References
  1. PR body must contain a release note block and commit scopes should match package names. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the release-note block to the PR description. On the scope: e2e-sandbox matches the package directory packages/core/testing/images/e2e-sandbox/ and docs/agents/contributing.md lists scopes as examples that can be extended for a specific area, so keeping it as e2e-sandbox.

RUN curl -sSL "https://github.com/cozystack/cozyhr/raw/refs/heads/main/hack/install.sh" | sh -s -- -v "${COZYHR_VERSION}"
RUN curl https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc --create-dirs -o /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc
RUN curl -fsSL "https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc" --create-dirs -o /usr/local/bin/mc \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

While updating this line, consider using a specific version for the mc binary (e.g., via an ARG) instead of always pulling the latest release. This would improve build reproducibility and maintain consistency with other tools in this Dockerfile (like kubectl or talosctl) which are explicitly versioned.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See the reply on the parallel thread — leaving the version pin out of scope for this redirect fix. The Dockerfile already mixes pinned and unpinned downloads, so adding a single ARG for mc doesn't move the reproducibility needle on its own.

@myasnikovdaniil
myasnikovdaniil enabled auto-merge May 20, 2026 10:21
@myasnikovdaniil
myasnikovdaniil merged commit 4bf1cdc into main May 20, 2026
18 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the fix/e2e-sandbox-mc-download branch May 20, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Issues or PRs related to image build infrastructure, multi-arch support area/testing Issues or PRs related to testing (e2e, bats, unit tests) area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/bug Categorizes issue or PR as related to a bug size/XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants