Skip to content
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

allow updating at a commit, for testing #5843

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

jakecoffman
Copy link
Member

Context

We can use Dependabot CLI to test specific commits of a repository with an input file like this:

job:
   package-manager: go_modules
   allowed-updates:
     - dependency-type: direct
   source:
     provider: github
     repo: dependabot/smoke-tests
     directory: "/."
     commit: 147f31acdcaf088f1ecfefeb8ef33f603a944420

This is useful in smoke testing so there's no fear of breaking all of the tests when making a new commit to the repo, the tests are essentially pinned. This is also useful for testing customer issues since the customer may have made new commits that changed the situation since the job ran.

Problem

Ecosystems that use the clone method to fetch code are not honoring the commit since they only call clone with a branch, or use the default branch. That makes it impossible to test arbitrary commits in Go, Github Actions, Pub, Terraform, and Yarn Berry.

Solution

I've added additional calls to checkout the correct branch. This is low risk since it's guarded by a check to source.commit which should never be set in production. Production Dependabot is always interested in running against the latest commit in a branch.

@jakecoffman jakecoffman requested a review from a team as a code owner October 7, 2022 13:48
@jurre
Copy link
Member

jurre commented Oct 7, 2022

Thanks @jakecoffman, I'd run into this in the past 🎉

@jakecoffman jakecoffman merged commit 5f5f884 into main Oct 7, 2022
@jakecoffman jakecoffman deleted the jakecoffman/clone-with-commit branch October 7, 2022 15:02
@pavera pavera mentioned this pull request Oct 31, 2022
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.

None yet

3 participants