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

Go modules ignore conditions #3631

Merged
merged 11 commits into from May 5, 2021
Merged

Conversation

mctofu
Copy link
Contributor

@mctofu mctofu commented May 4, 2021

This brings in support for ignored versions for the go modules ecosystem in dependabot-core. It also extracts a LatestVersionFinder class which is common in the other ecosystems.

This was an alternate approach to #3630. Instead of migrating to use go list -m -versions we stuck to using our existing updatechecker helper but modified it to work more like go list with these changes:

  • Returns all allowed versions instead of only the latest version
  • Filters by major version and go mod excluded versions (retracted versions need extra work to support)
  • Removed pre-release/psuedo version filtering which is moved to the ruby side

With those changes in place applying the ignored version filter was fairly simple: 2bdbabc

mctofu added 3 commits May 3, 2021 17:22
…nt major

This also signals a move to performing all of our Dependabot-specific
logic in Ruby (which is the norm for most ecosystems), as opposed to
splitting it between Ruby and Go.
jasonrudolph and others added 4 commits May 4, 2021 14:16
Co-authored-by: David McIntosh <mctofu@github.com>
Co-authored-by: David McIntosh <mctofu@github.com>
@mctofu mctofu changed the title Draft: Go modules ignore conditions Go modules ignore conditions May 4, 2021
@mctofu mctofu marked this pull request as ready for review May 4, 2021 22:34
Copy link
Contributor

@thepwagner thepwagner left a comment

Choose a reason for hiding this comment

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

LGTM - I'm excited to ignore some versions.
Most of my time on this review was spent contemplating the path not taken - thanks for the clear and documented reasoning there!

go_modules/helpers/updatechecker/main.go Show resolved Hide resolved
attr_reader :dependency, :dependency_files, :credentials, :ignored_versions

def fetch_latest_version
pseudo_version_regex = /\b\d{14}-[0-9a-f]{12}$/
Copy link
Contributor

Choose a reason for hiding this comment

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

Idea: maybe extract+freeze as a constant?

During a version updates run we'll build several of these, we can squeak a few nanos by only compiling it once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 9e402ae

def filter_ignored_versions(versions_array)
filtered = versions_array.
reject { |v| ignore_requirements.any? { |r| r.satisfied_by?(v) } }
raise AllVersionsIgnored if @raise_on_ignored && filtered.empty? && versions_array.any?
Copy link
Contributor

Choose a reason for hiding this comment

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

Xref the conflict with #3644 , ezpz to resolve though!

GOMOD
end

pending "doesn't update to the retracted version" do
Copy link
Contributor

Choose a reason for hiding this comment

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

Noice: this spec!

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

4 participants