Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions cmd/dependabot/internal/cmd/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ import (
"io"
"log"
"os"
"slices"

"github.com/MakeNowJust/heredoc"
"github.com/dependabot/cli/internal/infra"
"github.com/spf13/cobra"
)

var graphSupportedEcosystems = []string{
"bundler",
"go_modules",
}

Comment on lines -17 to -21
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍🏻 - this no longer makes sense to restrict as you say, I'm in queue to merge the new version of the experiment which means most ecosystems will now have a base-line capability vs the previous approach where we had to do enabling work.

var graphCmd = NewGraphCommand()

func init() {
Expand Down Expand Up @@ -59,13 +53,12 @@ func NewGraphCommand() *cobra.Command {

processInput(input, &flags)

if !slices.Contains(graphSupportedEcosystems, input.Job.PackageManager) {
return fmt.Errorf(
"package manager '%s' is not supported for graphing. Supported ecosystems: %v",
input.Job.PackageManager,
graphSupportedEcosystems,
)
// It doesn't make sense to suppress the graph output when running the graph command,
// so forcing the experiment to true.
if input.Job.Experiments == nil {
input.Job.Experiments = make(map[string]any)
}
input.Job.Experiments["enable_dependency_submission_poc"] = true

var writer io.Writer
if !flags.debugging {
Expand Down
31 changes: 31 additions & 0 deletions testdata/scripts/graph.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Build the dummy Dockerfile
exec docker build -qt graph-updater .

# Run the dependabot command
dependabot graph go_modules dependabot/cli --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'

exec docker rmi -f graph-updater

-- Dockerfile --
FROM ubuntu:22.04

RUN useradd dependabot

COPY --chown=dependabot --chmod=755 update-ca-certificates /usr/bin/update-ca-certificates
COPY --chown=dependabot --chmod=755 run bin/run

-- update-ca-certificates --
#!/usr/bin/env bash

echo "Updated those certificates for ya"

-- run --
#!/usr/bin/env bash

echo "bin/run arguments: $@"
cat /home/dependabot/dependabot-updater/job.json; echo
Loading