From 69280b24f4c2bb647669fb850a914c0f2cd266ae Mon Sep 17 00:00:00 2001 From: Jake Coffman Date: Fri, 10 Oct 2025 14:44:39 -0500 Subject: [PATCH 1/2] remove fetch_files command --- docs/debugging.md | 11 +++-------- internal/infra/run.go | 4 ++-- testdata/scripts/basic.txt | 1 - testdata/scripts/graph.txt | 2 -- testdata/scripts/smb-mount.txt | 7 ++----- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/docs/debugging.md b/docs/debugging.md index ded9f801..7bac8b95 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -10,15 +10,10 @@ Next, clone https://github.com/dependabot/dependabot-core. This project contains Try opening a terminal and run `script/dependabot update go_modules dependabot/cli --debug` in the `dependabot-core` project directory. This will drop you in an interactive session with the update ready to proceed. -To perform the update, you need to run two commands: +To perform the update, you need to run: -- `bin/run fetch_files` - `bin/run update_files` -If the problem you are debugging is during the fetch step, the fetch_files command will be all you need to run. - -If the problem is after the fetch step, you can repeatedly run update_files while you're debugging. - In the example `script/dependabot` command above, try running an update in the container. Next, let's try adding a `debugger` statement. Open the `dependabot-core` project in your favorite editor. For example, we can open the file `go_modules/lib/dependabot/go_modules/update_checker.rb`. Then in `latest_resolvable_version` we can add a `debugger` statement like this: @@ -32,7 +27,7 @@ Next, let's try adding a `debugger` statement. Open the `dependabot-core` projec > **Note** You don't have to restart your CLI session, the changes are automatically synced to the container! -In the interactive debugging session, run `bin/run fetch_files` and `bin/run update_files`. During the update_files command, the Ruby debugger will open. It should look something like this: +In the interactive debugging session, run `bin/run update_files`. During the update_files command, the Ruby debugger will open. It should look something like this: ```ruby [11, 20] in ~/go_modules/lib/dependabot/go_modules/update_checker.rb @@ -60,7 +55,7 @@ At this prompt, you can run [debugger commands](https://github.com/ruby/debug) t If your Dependabot job is hanging and would like to figure out why, the CLI is the perfect tool for the job. -Start by running the update that recreates the hang with `dependabot update `. Once the hang is reproducible, run with the `--debug` flag and the run the `fetch_files` and `update_files` commands and wait until the job hangs. +Start by running the update that recreates the hang with `dependabot update `. Once the hang is reproducible, run with the `--debug` flag and the run the `update_files` command and wait until the job hangs. Once it does hang, hit CTL-C, and you'll get a stack trace leading you to the problematic code. diff --git a/internal/infra/run.go b/internal/infra/run.go index 0847f6ef..f5049fa5 100644 --- a/internal/infra/run.go +++ b/internal/infra/run.go @@ -31,8 +31,8 @@ import ( ) var runCmds = map[model.RunCommand]string{ - model.UpdateFilesCommand: "bin/run fetch_files && bin/run update_files", - model.UpdateGraphCommand: "bin/run fetch_files && bin/run update_graph", + model.UpdateFilesCommand: "bin/run update_files", + model.UpdateGraphCommand: "bin/run update_graph", } type RunParams struct { diff --git a/testdata/scripts/basic.txt b/testdata/scripts/basic.txt index 5bf82ce2..703ee925 100644 --- a/testdata/scripts/basic.txt +++ b/testdata/scripts/basic.txt @@ -5,7 +5,6 @@ exec docker build -qt dummy-updater . dependabot update go_modules dependabot/cli --updater-image dummy-updater # assert the dummy is working -stderr 'bin/run arguments: fetch_files' stderr 'bin/run arguments: update_files' exec docker rmi -f dummy-updater diff --git a/testdata/scripts/graph.txt b/testdata/scripts/graph.txt index d0553ed0..547b933f 100644 --- a/testdata/scripts/graph.txt +++ b/testdata/scripts/graph.txt @@ -5,14 +5,12 @@ exec docker build -qt graph-updater . dependabot graph go_modules dependabot/cli -o out.yml --updater-image graph-updater # assert the dummy is working -stderr 'bin/run arguments: fetch_files' stderr 'bin/run arguments: update_graph' stderr '"enable_dependency_submission_poc":true' # Verify the smoke test can run the graph command dependabot test -f out.yml --updater-image graph-updater -stderr 'bin/run arguments: fetch_files' stderr 'bin/run arguments: update_graph' exec docker rmi -f graph-updater diff --git a/testdata/scripts/smb-mount.txt b/testdata/scripts/smb-mount.txt index afdf1f7a..853bd90b 100644 --- a/testdata/scripts/smb-mount.txt +++ b/testdata/scripts/smb-mount.txt @@ -25,11 +25,8 @@ echo "Updated those certificates for ya" -- run -- #!/usr/bin/env bash -if [ "$1" = "fetch_files" ]; then - # git clone would have created this directory - mkdir -p "$DEPENDABOT_REPO_CONTENTS_PATH" - exit 0 -fi +# git clone would have created this directory +mkdir -p "$DEPENDABOT_REPO_CONTENTS_PATH" echo "test file" > "$DEPENDABOT_REPO_CONTENTS_PATH/test.txt" if [ -e "$DEPENDABOT_CASE_INSENSITIVE_REPO_CONTENTS_PATH/TEST.TXT" ]; then From 7dc28512b9f7423e9ddf6d597d773821b5730103 Mon Sep 17 00:00:00 2001 From: Jake Coffman Date: Fri, 10 Oct 2025 14:50:17 -0500 Subject: [PATCH 2/2] no longer needed --- internal/infra/updater.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/internal/infra/updater.go b/internal/infra/updater.go index dd3a4955..8cbf9cc9 100644 --- a/internal/infra/updater.go +++ b/internal/infra/updater.go @@ -34,7 +34,6 @@ const ( const ( guestInputDir = "/home/dependabot/dependabot-updater/job.json" - guestOutput = "/home/dependabot/dependabot-updater/output.json" guestRepoDir = "/home/dependabot/dependabot-updater/repo" caseSensitiveContainerRoot = "/dpdbot" @@ -315,10 +314,8 @@ func userEnv(proxyURL string, apiUrl string, job *model.Job, additionalEnvVars [ fmt.Sprintf("DEPENDABOT_JOB_ID=%v", firstNonEmpty(os.Getenv("DEPENDABOT_JOB_ID"), jobID)), fmt.Sprintf("DEPENDABOT_JOB_TOKEN=%v", ""), fmt.Sprintf("DEPENDABOT_JOB_PATH=%v", guestInputDir), - fmt.Sprintf("DEPENDABOT_OUTPUT_PATH=%v", guestOutput), fmt.Sprintf("DEPENDABOT_API_URL=%s", apiUrl), fmt.Sprintf("SSL_CERT_FILE=%v/ca-certificates.crt", certsPath), - "UPDATER_ONE_CONTAINER=true", "UPDATER_DETERMINISTIC=true", }