Ignore option not working

Description

I’m trying to ignore some java auto-generated files from coverage using the ignore option but it is still showing up in the reports
https://codecov.io/gh/sushantmimani/asherah/tree/remove-server-codecov/server/java/target/generated-sources/protobuf

Repository

CI/CD

CircleCI

Uploader

I’m using the codecov orb on CircleCI

Commit SHAs

79769cb5ef9fefe20d8c208609d09b419bdd8e7f
f3211c74897c3d85a0beb950d8f12aca2cc57de0

Codecov YAML

coverage:
  status:
    project:
      default:
        target: 90%
        threshold: 5%
      csharp-AppEncryption:
        flags: csharp_AppEncryption
        target: 90%
      csharp-Logging:
        flags: csharp_Logging
        target: 90%
      csharp-SecureMemory:
        flags: csharp_SecureMemory
        target: 90%
      go-securememory:
        flags: go_securememory
        target: 90%
      go-appencryption:
        flags: go_appencryption
        target: 90%
      java-app-encryption:
        flags: java_app_encryption
        target: 90%
      java-secure-memory:
        flags: java_secure_memory
        target: 90%
      server-go:
        flags: server_go
        target: 90%
      server-java:
        flags: server_java
        target: 90%
# Note flags have to be "\w" charset (hence underscore instead of hyphen)
flags:
  csharp_AppEncryption:
    paths:
      - csharp/AppEncryption
  csharp_Logging:
    paths:
      - csharp/Logging
  csharp_SecureMemory:
    paths:
      - csharp/SecureMemory
  go_securememory:
    paths:
      - go/securememory
  go_appencryption:
    paths:
      - go/appencryption
  java_app_encryption:
    paths:
      - java/app-encryption
  java_secure_memory:
    paths:
      - java/secure-memory
  server-go:
    paths:
      - server/go
  server-java:
    paths:
      - server/java
ignore:
  # Ignore non-linux native paths. Ideally, be nice to setup separate OS-specific builds.
  # No need for C# path since the dotnet test command handles it currently (should change if/when we do the above)
  - "**/com/godaddy/asherah/securememory/protectedmemoryimpl/macos" # java macos path
  - "*/**/target/generated-sources/protobuf/java/com/godaddy/asherah/grpc"
  - "*/**/target/generated-sources/protobuf/grpc-java/com/godaddy/asherah/grpc"

Codecov Output

#!/bin/bash -eo pipefail 
curl -s https://codecov.io/bash | bash -s -- \ 
  -f "server/java/target/site/jacoco/jacoco.xml" \ 
  -t "${CODECOV_TOKEN}" \ 
  -n "${CIRCLE_BUILD_NUM}" \ 
  -y ".codecov.yml" \ 
  -F "server_java" \ 
  -Z || echo 'Codecov upload failed' 
 

 
  _____          _
 
 / ____|        | |
 
| |     ___   __| | ___  ___ _____   __
 
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
 
| |___| (_) | (_| |  __/ (_| (_) \ V /
 
 \_____\___/ \__,_|\___|\___\___/ \_/
 
                              Bash-tbd
 

 

 
==> Circle CI detected.
 
    project root: .
 
    Yaml found at: .codecov.yml
 
    -> Found 1 reports
 
==> Detecting git/mercurial file structure
 
==> Reading reports
 
    + server/java/target/site/jacoco/jacoco.xml bytes=459998
 
==> Appending adjustments
 
    http://docs.codecov.io/docs/fixing-reports
 
    + Found adjustments
 
==> Gzipping contents
 
==> Uploading reports
 
    url: https://codecov.io
 
    query: branch=remove-server-codecov&commit=79769cb5ef9fefe20d8c208609d09b419bdd8e7f&build=1210&build_url=&name=1210&tag=&slug=sushantmimani%2Fasherah&service=circleci&flags=server_java&pr=&job=0
 
    -> Pinging Codecov
 
https://codecov.io/upload/v4?package=bash-tbd&token=secret&branch=remove-server-codecov&commit=79769cb5ef9fefe20d8c208609d09b419bdd8e7f&build=1210&build_url=&name=1210&tag=&slug=sushantmimani%2Fasherah&service=circleci&flags=server_java&pr=&job=0
 
    -> Uploading
 
    -> View reports at https://codecov.io/github/sushantmimani/asherah/commit/79769cb5ef9fefe20d8c208609d09b419bdd8e7f
 
CircleCI received exit code 0

Hi @sushantmimani, please rename the yaml file to codecov.yml. Let me know if that solves your issue.

I ran my job with codecov.yml but same result.

Commit SHA - 3424861819052b1dbc1bc06ef496283c8e6fbcbf

The codecov orb documentation states that the default file is .codecov.yml

PARAMETER DESCRIPTION REQUIRED DEFAULT TYPE
conf Used to specify the location of the .codecov.yml config file - .codecov.yml string

Do i need to make any additional updates to my circleci config?

Hi @sushantmimani, that is accurate, but we are working on pushing out a new version of the orb here. The underlying bash uploader should be giving a deprecation warning here: codecov-bash/codecov at master · codecov/codecov-bash · GitHub

One other thing, there was a bug in the yaml, try this

coverage:
  status:
    project:
      default:
        target: 90%
        threshold: 5%
      csharp-AppEncryption:
        flags:
          - csharp_AppEncryption
        target: 90%
      csharp-Logging:
        flags:
          - csharp_Logging
        target: 90%
      csharp-SecureMemory:
        flags:
          - csharp_SecureMemory
        target: 90%
      go-securememory:
        flags:
          - go_securememory
        target: 90%
      go-appencryption:
        flags:
          - go_appencryption
        target: 90%
      java-app-encryption:
        flags:
          - java_app_encryption
        target: 90%
      java-secure-memory:
        flags:
          - java_secure_memory
        target: 90%
      server-go:
        flags:
          - server_go
        target: 90%
      server-java:
        flags: 
          - server_java
        target: 90%
# Note flags have to be "\w" charset (hence underscore instead of hyphen)
flags:
  csharp_AppEncryption:
    paths:
      - csharp/AppEncryption
  csharp_Logging:
    paths:
      - csharp/Logging
  csharp_SecureMemory:
    paths:
      - csharp/SecureMemory
  go_securememory:
    paths:
      - go/securememory
  go_appencryption:
    paths:
      - go/appencryption
  java_app_encryption:
    paths:
      - java/app-encryption
  java_secure_memory:
    paths:
      - java/secure-memory
  server-go:
    paths:
      - server/go
  server-java:
    paths:
      - server/java
ignore:
  # Ignore non-linux native paths. Ideally, be nice to setup separate OS-specific builds.
  # No need for C# path since the dotnet test command handles it currently (should change if/when we do the above)
  - "**/com/godaddy/asherah/securememory/protectedmemoryimpl/macos" # java macos path
  - "*/**/target/generated-sources/protobuf/java/com/godaddy/asherah/grpc"
  - "*/**/target/generated-sources/protobuf/grpc-java/com/godaddy/asherah/grpc"

Is it necessary to delete existing codcov data or should it automatically remove ignored files when the results are uploaded next?

Hi @sushantmimani, I believe it should not be automatically removed from previous uploads

Hi @tom. I made the following changes to my project:

  • Used the updated yaml provided above
  • Added a conf: codecov.yml statement to my circleci config
  • Deleted past data on Codecov

Then when i ran the job, it ignored the files as expected.

I have one last question. Why does the first ignore statement work correctly with **/ while the second and third ones require */**/?

Hi @sushantmimani, I’m glad that worked for you! I’ll be honest I don’t think you need */ on the 2nd and 3rd ones, as I had copied it from what you had provided above. I don’t think it is necessary.

Perfect! Thanks once again, Tom!

1 Like