# Setting conditionals in staging is not executed in travis

**URL:** <https://travis-ci.community/t/setting-conditionals-in-staging-is-not-executed-in-travis/11596>\
**Category:** Travis CI Discussions & Feedback\
**Tags:** conditions, travis-yml\
**Created:** [May 14, 2021, 9:35am UTC](https://travis-ci.community/t/setting-conditionals-in-staging-is-not-executed-in-travis/11596 "2021-05-14T09:35:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SolarUltima](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/solarultima/32/4019_2.png) [@SolarUltima](https://travis-ci.community/u/SolarUltima)\
**Post date:** [May 14, 2021, 9:35am UTC](https://travis-ci.community/t/setting-conditionals-in-staging-is-not-executed-in-travis/11596/1 "2021-05-14T09:35:12Z")

</div>

here snippet of my build for the `.travis.yml` file:

I’ve got a simple stage configuration

```auto
env:
  global:
    - BUILD_TYPE=demo
    - EXECUTABLE=false
if: env(EXECUTABLE) = false
jobs:
  include:
    - stage: stage_exec_1
      if: env(BUILD_TYPE) IN (dem, prod)
    - stage: stage_exec_3
      if: sender = lapots
    - stage: stage_not_exec
      if: (NOT branch = master

```

thank you for all help

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [May 14, 2021, 9:39am UTC](https://travis-ci.community/t/setting-conditionals-in-staging-is-not-executed-in-travis/11596/2 "2021-05-14T09:39:03Z")

</div>

So a few things I instantly see wrong in your `.travis.yml`.

To be clear, `if:` nor `jobs:` are valid values in `.travis.yml` (if you don’t believe me, try lint), so they’re just discarded, tossed essentially. Travis is pretty liberal about silently dropping hooks it doesn’t know what to do with unless you specify otherwise with a verbose tag.

Specifying behavior in `env:` is fine, but move the logic into a `script:` block and execute your `if`  
statements there, or you could even theoretically run your `if` statements from a script that the `.travis.yml` calls, this would obviously be done using bash, so an example would be a file called:

```bash
deploy.sh

```

Make sure this is properly credentialed using `chmod u+x`. So there you have it, two ways you can properly do what you’re actually trying to do. I’m going to give you an article to read, I recommend reading it.

I recommend a bit more [reading](https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps), but that should solve it for you.
