Skip to content

Add a fetch_files entrypoint so the clone can happen in its own container - #15862

Open
v-robaiken wants to merge 10 commits into
mainfrom
robaiken/fetch-files-command
Open

Add a fetch_files entrypoint so the clone can happen in its own container#15862
v-robaiken wants to merge 10 commits into
mainfrom
robaiken/fetch-files-command

Conversation

@v-robaiken

@v-robaiken v-robaiken commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What are you trying to accomplish?

First step towards running fetch and update in separate containers This only moves the clone — no file stripping, no serialization, no credential changes.

bin/run fetch_files was a stub that exited 0. It now runs FileFetcherCommand, which clones into DEPENDABOT_REPO_CONTENTS_PATH. When that's a shared volume, a second container running update_files reuses the clone instead of making its own.

bin/run now execs so exit codes propagate — the stub always exited 0, so callers couldn't tell a fetch failure from a success.

Anything you want to highlight for special attention from reviewers?

Only two files are needed because existing code already handles the rest: _clone_repo_contents returns early when .git exists, and file fetchers read from the clone instead of the API when repo_contents_path is set.

Not a security boundary yet: the update container still calls the target repo twice (branch validation, PR name prefixing), so its credential can't be dropped.

How will you know you've accomplished your goal?

Ran against the real gomod image and dependabot-fixtures/go-modules-lib, both topologies:

  • git clone happens once in both
  • zero contents API calls from the update container
  • identical create_pull_request payloads

script/dependabot doesn't work for this (gemspec/lockfile mismatch). Mount only updater/bin:

dependabot update -f job.yml \
  --updater-image ghcr.io/dependabot/dependabot-updater-gomod:latest \
  -v $(pwd)/updater/bin:/home/dependabot/dependabot-updater/bin

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

Sorbet and RuboCop clean; specs need Docker, so I diffed the failing-example set against a baseline — identical. No new spec: the bin/*.rb entrypoints have none, and the behaviour is cross-container. Covered by a script test in dependabot/cli#647.

…iner

`bin/run fetch_files` was a stub that printed a message and exited 0. Dispatch it
to a real entrypoint that runs FileFetcherCommand, which clones into
DEPENDABOT_REPO_CONTENTS_PATH.

When that path is a shared volume, a second container running `bin/run
update_files` reuses the clone rather than making its own: `_clone_repo_contents`
returns early when `.git` is already present, and with `repo_contents_path` set
the file fetchers read from the clone instead of the API.

`bin/run` now execs, so the Ruby process' exit code becomes the container's.
Callers chaining `run fetch_files && run update_files` previously could not tell
a fetch failure from a success, because the stub always exited 0.

No behaviour change for the combined topology: `update_files` still fetches for
itself when it runs alone.
Copilot AI balanced review requested due to automatic review settings August 11, 2026 18:24

Copilot AI 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.

Copilot wasn't able to review any files in this pull request.

Copilot AI review requested due to automatic review settings August 13, 2026 18:37

Copilot AI 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.

Copilot wasn't able to review any files in this pull request.

Copilot AI review requested due to automatic review settings August 14, 2026 18:34

Copilot AI 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.

Copilot wasn't able to review any files in this pull request.

Copilot AI review requested due to automatic review settings August 18, 2026 18:00

Copilot AI 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.

Review details

  • Files reviewed: 2/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@v-robaiken v-robaiken self-assigned this Aug 19, 2026
@v-robaiken
v-robaiken marked this pull request as ready for review August 19, 2026 15:31
@v-robaiken
v-robaiken requested a review from a team as a code owner August 19, 2026 15:31
Copilot AI review requested due to automatic review settings August 19, 2026 15:32

Copilot AI 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.

Review details

  • Files reviewed: 2/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread updater/lib/dependabot/file_fetcher_command.rb Outdated
Comment thread updater/lib/dependabot/file_fetcher_command.rb Outdated
Copilot stopped reviewing on behalf of v-robaiken due to an error August 19, 2026 15:52
Copilot AI review requested due to automatic review settings August 19, 2026 16:17

Copilot AI 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.

Review details

  • Files reviewed: 2/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread updater/lib/dependabot/file_fetcher_command.rb Outdated
Copilot stopped reviewing on behalf of v-robaiken due to an error August 19, 2026 16:38
Copilot AI review requested due to automatic review settings August 19, 2026 17:26

Copilot AI 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.

Review details

  • Files reviewed: 3/5 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings August 19, 2026 17:41

Copilot AI 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.

Review details

  • Files reviewed: 3/5 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings August 19, 2026 19:04

Copilot AI 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.

Review details

  • Files reviewed: 3/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings August 20, 2026 09:31

Copilot AI 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.

Review details

  • Files reviewed: 3/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

2 participants