GithubHelp home page GithubHelp logo

grapl-security / codecov-buildkite-plugin Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 118 KB

A Buildkite plugin for uploading coverage data to https://codecov.io

License: Apache License 2.0

Shell 86.70% Makefile 6.55% Starlark 0.44% Dockerfile 3.33% HCL 2.98%

codecov-buildkite-plugin's Introduction

Codecov Buildkite Plugin

⚠️ Sunsetting This Repository ⚠️

Work has stopped on this plugin. The repository will still be available in an archived state, but users are encouraged to either fork a copy or find alternatives. The codecov container image we provided will no longer be available, but you can use an alternative or build your own from this repository (the ENTRYPOINT must be codecov). If you continue using the code from this repository, you will need to specify an image in your plugin configuration (see below).

Uploads test coverage files to https://coverage.io using the Codecov Uploader. Because it uses a container image, you do not need to have the codecov binary installed on your build agents to use this plugin.

Examples

By default, all files matching the glob dist/coverage/**/*xml will be uploaded to https://coverage.io.

steps:
  - command: make test
    plugins:
      - grapl-security/codecov#v0.1.5:
          image: docker.mycompany.com/codecov

To override this glob, add a file property:

steps:
  - command: make test
    plugins:
      - grapl-security/codecov#v0.1.5:
          image: docker.mycompany.com/codecov
          file: output/cobertura.xml

This can also be set this globally using the BUILDKITE_PLUGIN_CODECOV_FILE environment variable.

The plugin runs the codecov uploader using a Docker container, which must be set with the image configuration value.

steps:
  - command: make test
    plugins:
      - grapl-security/codecov#v0.1.5:
          image: foobar/codecov

If you want to override this globally, set the BUILDKITE_PLUGIN_CODECOV_IMAGE environment variable.

By default, the latest tag of this image is used. You would like to override this, as well:

steps:
  - command: make test
    plugins:
      - grapl-security/codecov#v0.1.5:
          image: foobar/codecov
          tag: v1.2.3

This can also be set this globally using the BUILDKITE_PLUGIN_CODECOV_TAG environment variable.

If using the latest tag of the image, it can be useful to explicitly pull the image before running. Since the latest tag will change over time, this ensures that you always get the actual latest image. While this is generally not a problem if you are using short-lived or single-use agents, longer-lived agents would continue to use whatever image was tagged latest when they ran their first codecov upload.

To explicitly pull the image, set always_pull to true.

steps:
  - command: make test
    plugins:
      - grapl-security/codecov#v0.1.5:
          image: foobar/codecov
          tag: latest
          always_pull: true

By default, this plugin will fail a job if Codecov does not succesfully run. If you do not want to do this, use the fail_job_on_error parameter:

steps:
  - command: make test
    plugins:
      - grapl-security/codecov#v0.1.5:
          image: docker.mycompany.com/codecov
          fail_job_on_error: false

Configuration

Configuration flags are organized by thematic category.

codecov Uploader Flags

file (optional, string)

A file name or glob for the coverage files to upload to https://coverage.io. The value is passed as the --file argument to the Codecov Uploader.

Defaults to dist/coverage/**/*.xml.

flags (optional, string)

Flag the upload to group coverage metrics. The value is passed as the --flags argument to the Codecov Uploader.

Error Handling

fail_job_on_error (optional, boolean)

Whether or not an error in Codecov will fail the job. This can be useful for catching misconfigurations and errors in your Codecov setup, at the expense of failing jobs that would otherwise succeed.

Defaults to true.

Container Image Configuration

image (requried, string)

The container image with the Codecov Uploader binary that the plugin uses. Any container used should have the codecov binary as its entrypoint.

tag (optional, string)

The container image tag the plugin uses.

Defaults to latest.

always_pull (optional, boolean)

Whether or not to perform an explicit docker pull of the configured image before running. Useful when using the latest tag to ensure you are always using the actual latest image.

Defaults to false.

Building and Contributing

Requires make, docker, the Docker buildx plugin, and Docker Compose v2.

make all will run all formatting, linting, testing, and image building.

Run make help to see all available targets, with brief descriptions.

Alternatively, you may also use Gitpod.

Open in Gitpod

Useful Background Information for Contributors

Codecov GPG Key

The codecov_pgp_keys.asc file was downloaded from https://keybase.io/codecovsecurity/pgp_keys.asc on 2021-08-10, per the instructions at https://about.codecov.io/blog/introducing-codecovs-new-uploader/.

Its fingerprint is 27034E7FDB850E0BBC2C62FF806BB28AED779869, which can be verified by examining the output of

gpg --show-keys codecov_pgp_keys.asc

The output should match the following:

pub   rsa4096 2021-05-24 [SC]
      27034E7FDB850E0BBC2C62FF806BB28AED779869
uid                      Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>
sub   rsa4096 2021-05-24 [E]

This key is used to verify the Codecov Uploader artifact that is built into the container this plugin uses (see Dockerfile)

codecov-buildkite-plugin's People

Contributors

christophermaier avatar nextdayflight avatar thomaswunderlich avatar wimax-grapl avatar

Stargazers

 avatar

Watchers

 avatar

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.