Skip to content

Checks the update of a library's version and executes some actions if so.

License

Notifications You must be signed in to change notification settings

codeyourinfra/libchecker

Repository files navigation

libchecker

License: MIT Known Vulnerabilities Docker Build status Docker Pulls

Checks the update of a library's version and executes some actions if so.

How it works

How it works

libchecker gets the current library data from the Libraries.io API every minute. Then, compares the current version with the latest one, previously stored in a MongoDB instance. If a new version of the library have just released, libchecker automaticaly execute one or more configured actions.

Supported actions

It's a work in progress. Please contribute with the project adding more actions. At this moment the supported actions are:

Each action is implemented by a Python class of the actions module.

Configuration

libchecker requires a configuration file. Take a look at the content of config.yaml:

---
- librariesio_api_key: env.LIBRARIESIO_API_KEY
  libraries_platform: pypi
  library_name: ansible
  mongodb:
    uri: env.MONGO_URI
    username: env.MONGO_USERNAME
    password: env.MONGO_PASSWORD
  actions:
    - classname: SlackWebhookPost
      parameters:
        slack_webhook_url: env.SLACK_WEBHOOK_URL
    - classname: TravisCIBuildTrigger
      parameters:
        travis_api_token: env.TRAVIS_API_TOKEN
        repo_api_endpoint: https://api.travis-ci.org/repo/codeyourinfra%2Fdocker/requests
    - classname: TravisCIBuildTrigger
      parameters:
        travis_api_token: env.TRAVIS_API_TOKEN
        repo_api_endpoint: https://api.travis-ci.org/repo/codeyourinfra%2Fjava8/requests

- librariesio_api_key: env.LIBRARIESIO_API_KEY
  libraries_platform: maven
  library_name: com.fasterxml.jackson.core:jackson-core
  mongodb:
    uri: env.MONGO_URI
    username: env.MONGO_USERNAME
    password: env.MONGO_PASSWORD
  actions:
    - classname: EmailSend
      parameters:
        smtp_host: env.SMTP_HOST
        smtp_port: 587
        smtp_username: env.SMTP_USERNAME
        smtp_password: env.SMTP_PASSWORD
        sender: [email protected]
        receivers:
          - [email protected]
    - classname: GithubIssueCreate
      parameters:
        github_api_token: env.GITHUB_API_TOKEN
        username: esign-consulting
        reponame: google-geocode

In this example, libchecker is configured to check new releases of Ansible in PyPI. The Libraries.io API requires a key, which is defined in the environment variable LIBRARIESIO_API_KEY.

For sensitive data, you may prefer environment variables. If it's the case, start the value of the parameter with env., and libchecker will get the configuration from the environment variable specified right after.

Based on this configuration, libchecker will execute 3 actions, if a new version of Ansible is released in PyPI:

  1. A message will be sent to a Slack channel, through a POST request to a Slack incoming webhook;
  2. A build will be triggered in Travis CI, through a POST request to the Travis CI API v3;
  3. Another build will be triggered in Travis CI, the same way.

Slack workspace

Join the libchecker workspace on Slack by clicking here. There we can talk more about the project.

If you would like to be notified about your favorite library releases, feel free to request a channel with that purpose. The goal is keep everyone up to date when any library is released :)