# "target" conditions can't use the exclude syntax

**URL:** <https://drone.discourse.group/t/target-conditions-cant-use-the-exclude-syntax/5502>\
**Category:** Drone Support\
**Created:** [July 3, 2019, 3:26pm UTC](https://drone.discourse.group/t/target-conditions-cant-use-the-exclude-syntax/5502 "2019-07-03T15:26:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffDownie](https://avatars.discourse-cdn.com/v4/letter/j/bb73d2/32.png) [@JeffDownie](https://drone.discourse.group/u/JeffDownie)\
**Post date:** [July 3, 2019, 3:26pm UTC](https://drone.discourse.group/t/target-conditions-cant-use-the-exclude-syntax/5502/1 "2019-07-03T15:26:43Z")

</div>

I only noticed this was not in the documentation ([https://docs.drone.io/user-guide/pipeline/triggers/#by-target](https://docs.drone.io/user-guide/pipeline/triggers/#by-target)) after trying to use it, as I believed the “exclude” syntax in conditions worked across all keys, but the following does not work:

```
trigger:
  event:
  - promote
  target:
    exclude:
    - production

```

And will run a pipeline on any promote event, with no warnings about (for example) an unknown key in the yaml file. If there is a technical reason why the exclude syntax can’t work for the promote event, could we at least make drone error on this kind of exclude key, as it feels very misleading, with it working in all other cases I’ve tried!

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [July 3, 2019, 4:46pm UTC](https://drone.discourse.group/t/target-conditions-cant-use-the-exclude-syntax/5502/2 "2019-07-03T16:46:23Z")

</div>

target supports exclude syntax. you can inspect the code here [1][2]. I am not able to reproduce any issues with target or exlcude, and would therefore encourage sending a patch if this is something you can reliably reproduce.

[1] [https://github.com/drone/drone-yaml/blob/master/yaml/cond.go#L26](https://github.com/drone/drone-yaml/blob/master/yaml/cond.go#L26)  
[2] [https://github.com/drone/drone-yaml/blob/master/yaml/cond.go#L35](https://github.com/drone/drone-yaml/blob/master/yaml/cond.go#L35)

---

<div class="post-metadata">

**Author:** ![JeffDownie](https://avatars.discourse-cdn.com/v4/letter/j/bb73d2/32.png) [@JeffDownie](https://drone.discourse.group/u/JeffDownie)\
**Post date:** [July 4, 2019, 10:07am UTC](https://drone.discourse.group/t/target-conditions-cant-use-the-exclude-syntax/5502/3 "2019-07-04T10:07:19Z")

</div>

Hmm I think I may have confused myself - testing again this morning on a repository, everything seems to work correctly, as you are saying!

I must have taken a wrong turn when debugging my own issue yesterday - sorry for the misunderstanding!
