# Test against GitHub and cran version of a dependency, allow\_fail only on the latter

**URL:** <https://travis-ci.community/t/test-against-github-and-cran-version-of-a-dependency-allow-fail-only-on-the-latter/6935>\
**Category:** R\
**Tags:** r\
**Created:** [January 20, 2020, 9:12am UTC](https://travis-ci.community/t/test-against-github-and-cran-version-of-a-dependency-allow-fail-only-on-the-latter/6935 "2020-01-20T09:12:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronpeikert](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@aaronpeikert](https://travis-ci.community/u/aaronpeikert)\
**Post date:** [January 20, 2020, 9:12am UTC](https://travis-ci.community/t/test-against-github-and-cran-version-of-a-dependency-allow-fail-only-on-the-latter/6935/1 "2020-01-20T09:12:30Z")

</div>

> <https://github.com/aaronpeikert/repro/blob/d7f926fa48c3adb8e553beb2c7a336d6e2e78853/.travis.yml#L23>

I want to allow failure on only the part of the build matrix that has the cran version. However, this code seems to allow failure everywhere:

```auto
jobs:
  include:
  - r: release
    r_github_packages: r-lib/usethis
  - r: devel
    r_github_packages: r-lib/usethis
  - r: release
  - r: devel
  allow_failures:
  - r: release
    r_github_packages:
  - r: devel
    r_github_packages:

```

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [January 21, 2020, 5:01am UTC](https://travis-ci.community/t/test-against-github-and-cran-version-of-a-dependency-allow-fail-only-on-the-latter/6935/2 "2020-01-21T05:01:57Z")

</div>

I think the problem here is that you cannot match a job by the absence of value.

```auto
jobs:
  include:
  - r: release
    r_github_packages: r-lib/usethis
  - r: devel
    r_github_packages: r-lib/usethis
  - r: release
  - r: devel
  allow_failures:
  - r: release
    r_github_packages: # <---
  - r: devel
    r_github_packages: # <---

```

I think these lines are effectively no-op, and the configuration amounts to:

```auto
jobs:
  # ⋮
  allow_failures:
    - r: release
    - r: devel

```

which matches all of the defined jobs.

One way to get around this problem is to introduce a auxiliary environment variable to indicate whether or not the job should be allowed to fail.

```auto
jobs:
  include:
  - r: release
    r_github_packages: r-lib/usethis
  - r: devel
    r_github_packages: r-lib/usethis
  - r: release
    env: ALLOW=true
  - r: devel
    env: ALLOW=true
  allow_failures:
  - env: ALLOW=true

```

---

<div class="post-metadata">

**Author:** ![aaronpeikert](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@aaronpeikert](https://travis-ci.community/u/aaronpeikert)\
**Post date:** [January 21, 2020, 6:58am UTC](https://travis-ci.community/t/test-against-github-and-cran-version-of-a-dependency-allow-fail-only-on-the-latter/6935/3 "2020-01-21T06:58:15Z")

</div>

Thank you very much that solved my problem. Very kind of you to provide  
a copy-n-paste ready solution!
