Git Product home page Git Product logo

dependency_checker's Introduction

dependency-checker

The dependency-checker tool validates dependencies in Puppet modules against the latest published versions on the Puppet Forge. This means that it will ensure that a module supports the latest version of all the dependencies it declares.

Installation

Install via RubyGems:

$ gem install dependency_checker

Or add it to your Gemfile:

gem 'dependency_checker'

Usage

Run against a single Puppet module metadata.json file to ensure that the module supports the current versions of all the dependencies it declares:

$ dependency-checker /path/to/metadata.json

Run against a whole list of modules to ensure that each module supports the current version of the dependencies it declares. You can use a YAML or JSON file containing an array of modules (namespace-module). The file can be local or remote:

$ dependency-checker managed_modules.yaml
$ dependency-checker https://my.webserver.com/path/to/managed_modules.json

Run against many modules on your filesystem with a path wildcard:

$ dependency-checker modules/*/metadata.json

Run against all modules in an author's Forge namespace, optionally filtering to only supported/approved/partner endorsements:

$ dependency-checker --namespace puppetlabs
$ dependency-checker --namespace puppetlabs --supported
$ dependency-checker --namespace puppet --approved

Run it inside a module or group of modules during a pre-release to determine the effect of version bumps in the metadata.json file(s):

$ dependency-checker -c
$ dependency-checker -c ../*/metadata.json

Or you can supply an override value directly:

$ dependency-checker ../*/metadata.json -o puppetlabs/stdlib,10.0.0

The tool defaults to validating all modules supported by the Puppet CAT team if no module specification arguments are provided.

The following optional parameters are available:

Usage: dependency-checker [options]
    -o, --override module,version    Forge name of module and semantic version to override
    -c, --current                    Extract override version from metadata.json inside current working directory
    -n, --namespace namespace        Check all modules in a given namespace (filter with endorsements).
        --endorsement endorsement    Filter a namespace search by endorsement (supported/approved/partner).
        --es, --supported            Shorthand for `--endorsement supported`
        --ea, --approved             Shorthand for `--endorsement approved`
        --ep, --partner              Shorthand for `--endorsement partner`
    -v, --[no-]verbose               Run verbosely
    -h, --help                       Display help

The -o and -c arguments are exclusive, as are the endorsement filtering options.

Testing with dependency-checker as a Rake task

You can also integrate dependency-checker checks into your tests using a Rake task:

require 'dependency_checker'

desc 'Run dependency-checker'
task :metadata_deps do
  files = FileList['modules/*/metadata.json']
  runner = DependencyChecker::Runner.new
  runner.resolve_from_files(files)
  runner.run
end

License

This codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT.

dependency_checker's People

Contributors

binford2k avatar chelnak avatar da-ar avatar david22swan avatar davids avatar dependabot-preview[bot] avatar dependabot[bot] avatar eimlav avatar ekohl avatar gavindidrichsen avatar gspatton avatar jordanbreen28 avatar lionce avatar lukasaud avatar malikparvez avatar michaeltlombardi avatar pmcmaw avatar ramesh7 avatar sheenaajay avatar smortex avatar tphoney avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dependency_checker's Issues

undefined >= method caused by having module dependency using private forge and/or Authorization

Describe the bug
Running dependency checks fails.

To Reproduce
โฏ /usr/local/lib/ruby/gems/2.7.0/bin/dependency-checker metadata.json -v
Traceback (most recent call last):
26: from /usr/local/lib/ruby/gems/2.7.0/bin/dependency-checker:23:in <main>' 25: from /usr/local/lib/ruby/gems/2.7.0/bin/dependency-checker:23:in load'
24: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/bin/dependency-checker:53:in <top (required)>' 23: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/lib/dependency_checker/runner.rb:191:in run_with_args'
22: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/lib/dependency_checker/runner.rb:41:in run' 21: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/lib/dependency_checker/runner.rb:63:in run_dependency_checks'
20: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:289:in map' 19: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:386:in work_in_processes'
18: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:446:in create_workers' 17: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:446:in each_with_index'
16: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:446:in each' 15: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:447:in block in create_workers'
14: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:456:in worker' 13: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:456:in fork'
12: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:465:in block in worker' 11: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:485:in process_incoming_jobs'
10: from /usr/local/lib/ruby/gems/2.7.0/gems/parallel-1.21.0/lib/parallel.rb:515:in call_with_index' 9: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/lib/dependency_checker/runner.rb:80:in block in run_dependency_checks'
8: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/lib/dependency_checker/runner.rb:146:in get_dependencies_from_metadata' 7: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/lib/dependency_checker/metadata_checker.rb:16:in check_dependencies'
6: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/lib/dependency_checker/metadata_checker.rb:16:in map' 5: from /usr/local/lib/ruby/gems/2.7.0/gems/dependency_checker-0.2.0/lib/dependency_checker/metadata_checker.rb:19:in block in check_dependencies'
4: from /usr/local/lib/ruby/gems/2.7.0/gems/semantic_puppet-1.0.4/lib/semantic_puppet/version_range.rb:322:in include?' 3: from /usr/local/lib/ruby/gems/2.7.0/gems/semantic_puppet-1.0.4/lib/semantic_puppet/version_range.rb:322:in any?'
2: from /usr/local/lib/ruby/gems/2.7.0/gems/semantic_puppet-1.0.4/lib/semantic_puppet/version_range.rb:322:in block in include?' 1: from /usr/local/lib/ruby/gems/2.7.0/gems/semantic_puppet-1.0.4/lib/semantic_puppet/version_range.rb:573:in include?'
/usr/local/lib/ruby/gems/2.7.0/gems/semantic_puppet-1.0.4/lib/semantic_puppet/version_range.rb:642:in include?': undefined method >=' for nil:NilClass (NoMethodError)

Expected behaviour
Should pass as metadata.json is valid.

Environmental context
Version:
Ruby Version:
Module (+ Version):

Additional context
I'm curious if this is due to some sort of fact that I'm using an internal forge and one of the dependencies is private? I have confirmed that puppet bundle exec rake puppet config print module_repository and forge_authorization are properly configured but curious if dependency_checker is using something else to set the forge baseurl and authorization_token?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.