Storing cross build variables

I’d like to store the tests coverage in every build and if at some point the current build coverage is lower than the previous - make the build fail. Any guidelines on how to achieve this? any place to store cross build data?

Hello @i0natan,

You can accomplish this using Artifacts. Using artifacts you can save the coverage results at the end of job and then using the API you can pull the last saved artifact in the current build.

version: 2
      - image: python:3.6.0-jessie

    working_directory: /tmp
      - run:
          name: coverage
          command: echo "my artifact files in a dir" > /tmp/artifacts/coverage;

      - run:
          name: compare coverage
          command: |
            $PREV_RESULTS = curl${CI_TOKEN}
            #bash fun here to get the coverage results from the api 
            # and parse out the coverage values

            if [ $COVERAGE_CURRENT < $COVERAGE_OLD ]
                exit 1

      - store_artifacts:
          path: /tmp/artifacts

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.