# Flags in codecov.yml vs sending a report with the --flag argument

**URL:** <https://community.codecov.com/t/flags-in-codecov-yml-vs-sending-a-report-with-the-flag-argument/694>\
**Category:** Support\
**Created:** [November 12, 2019, 12:49am UTC](https://community.codecov.com/t/flags-in-codecov-yml-vs-sending-a-report-with-the-flag-argument/694 "2019-11-12T00:49:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PureKrome](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/purekrome/32/375_2.png) [@PureKrome](https://community.codecov.com/u/PureKrome)\
**Post date:** [November 12, 2019, 12:49am UTC](https://community.codecov.com/t/flags-in-codecov-yml-vs-sending-a-report-with-the-flag-argument/694/1 "2019-11-12T00:49:17Z")

</div>

I’m trying to learn the difference between defining flags in a `codecov.yml` file and for manually defining the flag when publishing a report via the cli.

In our example, we have a mono repo with 3x projects. As such, I’ve created a `codecov.yml `file with 3x flags in it:

```
coverage:
  status:
    project:
      default: on
      project1:
        target: 85%
        flags: project1
      project2:
        target: 85%
        flags: project2
      project3:
        target: 85%
        flags: project3

flags:
  project1:
    paths:
        - <paths to src and all tests, etc>
  project2:
    paths:
        - <paths to src and all tests, etc>
  project3:
    paths:
        - <paths to src and all tests, etc>

```

now, in any of the projects i send the reports up to codcov like this…

(This is using Azure DevOps but it’s a CLI tool so it could be anywhere)

\*\* Project 1’s CI file (called a pipeline yml file)

```
# Send coverage reports
- script: |
   codecov -f "$(Build.SourcesDirectory)/Project1.UnitTest1/coverage.opencover.xml" -t $(CODECOV_TOKEN) --flag project1
  displayName: 'upload report to codecov.io for Project1 UnitTest 1'

- script: |
   codecov -f "$(Build.SourcesDirectory)/Project1.UnitTest2/coverage.opencover.xml" -t $(CODECOV_TOKEN) --flag project1
  displayName: 'upload report to codecov.io for Project1 UnitTest 2'

```

=\> notice the flag there?

of course, i’ll hardcode different flag values in the other project CI files …

so …

**Q1: do i need to define the flag stuff in BOTH files?**  
**Q2: what is the releationship between the flag settings in the codecov.yml file vs the CLI tool ?**

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [November 21, 2019, 5:54pm UTC](https://community.codecov.com/t/flags-in-codecov-yml-vs-sending-a-report-with-the-flag-argument/694/2 "2019-11-21T17:54:35Z")

</div>

> [@PureKrome](#):
>
> **Q1: do i need to define the flag stuff in BOTH files?**  
> **Q2: what is the releationship between the flag settings in the codecov.yml file vs the CLI tool ?**

A1: You need both parts 🙂  
A2: You define the flags in the codecov.yml. You tell Codecov which of those flags you are using for an upload by adding `--flag` to your bash upload command.

Does that help?

---

<div class="post-metadata">

**Author:** ![PureKrome](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/purekrome/32/375_2.png) [@PureKrome](https://community.codecov.com/u/PureKrome)\
**Post date:** [November 22, 2019, 6:00am UTC](https://community.codecov.com/t/flags-in-codecov-yml-vs-sending-a-report-with-the-flag-argument/694/3 "2019-11-22T06:00:25Z")

</div>

Yes sir, it does! cheers!
