Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching a way to allow specific matrix entries to fail #9302

Closed
weiznich opened this issue Jan 10, 2019 · 20 comments
Closed

Searching a way to allow specific matrix entries to fail #9302

weiznich opened this issue Jan 10, 2019 · 20 comments

Comments

@weiznich
Copy link

Environment

Repo: diesel.rs/diesel

Issue Description

We have setup azure pipelines as automatic CI service for diesel.rs. That works mostly fine.
Now it is specific to the rust ecosystem that there are several compiler version, notably a stable version, a beta version and a nightly version. The later is updated every night a may not work. To detect such broken version projects are encouraged to run their CI also with the nightly version of the rust compiler, but setup the CI in such a way that failing builds with a nightly compiler are ignored. Basically I've found no way to do this with azure pipelines.

@moswald
Copy link
Member

moswald commented Feb 11, 2019

This may be possible with our yaml builds. @ericsciple do you know if this can be done?

@ericsciple
Copy link
Contributor

@vtbassmatt fyi

@weiznich Unfortunately it is not allowed today. The current solution would be to model it as a separate job.

@vtbassmatt
Copy link
Member

@ericsciple how do you prevent a task failure from bubbling up to the job (or job failure from bubbling up to the pipeline)? I could update the docs with a pattern for implementing allow-failure, but I don't actually know how to do it 😀

@ericsciple
Copy link
Contributor

@vtbassmatt continueOnError is a task-level control and job-level control. However, when set on the job I believe it applies to all configurations.

My initial thoughts are: that behavior makes sense, especially as we think about deployment phases coming soon. If we need additional control, we might want an additional option somewhere else.

This is a similar problem to condition. The property actually exists at the phase-level, not on each job configuration.

A workaround would be to use templates instead of matrix.

Rather than adding additional controls, it makes me wonder whether the correct long term solution here is something like templates without actually requiring you to declare a separate file.

@chriskrycho
Copy link

This is going to end up being a serious pain point for effective adoption in both the Rust and Ember.js communities, where it's common to run against the current stable release, the current beta release, and often also the current unstable/nightly/master channel. (We're doing it against beta on ember-cli-typescript.) In that case, it's perfectly acceptable for the beta channel to fail, and it shouldn't report that the whole build failed as a result. Unfortunately, because it's at a job or task level, it's not possible to handle with matrixes as far as I can see (and as your comment suggests).

@vtbassmatt
Copy link
Member

Thanks @chriskrycho - good to hear reinforcement of how important this is. If you want to point me at an example pipeline, I might be able to suggest a workaround. (And to be clear, it'll be a workaround, not the solution we want to deliver.)

@chriskrycho
Copy link

@vtbassmatt thanks! Here is our config for the ember-cli-typescript project:

@vtbassmatt
Copy link
Member

Gotcha. Here's how I'd work around the limitation. In the template, add a parameter allowedToFail defaulted to false. In the template, update the lines that run tests:

  - ${{ if not(eq(parameters.allowedToFail, 'true')) }}:
    - script: |
        ${{ parameters.emberTestCommand }}
      displayName: ${{ parameters.emberTestDisplayName }}
  - ${{ if eq(parameters.allowedToFail, 'true') }}:
    - script: |
        ${{ parameters.emberTestCommand }}
        exit 0
      displayName: ${{ parameters.emberTestDisplayName }}

Then in your top-level pipeline, you'll have to have separate matrixes for the allowed-to-fail legs:

  - job: ember_cli_versions
    displayName: 'ember-cli'
    dependsOn: linux_fixed
    pool:
      vmImage: 'ubuntu-16.04'
    strategy:
      matrix:
        release:
          eCliVersion: latest
    steps:
      - template: .azure/ci-template.yml
        parameters:
          emberCliVersion: $(eCliVersion)
  - job: ember_cli_versions_allowed_failures
    displayName: 'ember-cli [allowed failures]'
    dependsOn: linux_fixed
    pool:
      vmImage: 'ubuntu-16.04'
    strategy:
      matrix:
        beta:
          eCliVersion: beta
    steps:
      - template: .azure/ci-template.yml
        parameters:
          emberCliVersion: $(eCliVersion)
          allowedToFail: 'true'

@mike-north
Copy link

mike-north commented Apr 18, 2019

    - script: |
        ${{ parameters.emberTestCommand }}
        exit 0
      displayName: ${{ parameters.emberTestDisplayName }}

With this use of exit 0, it seems like a reviewer would have to actually dig into the test logs of each passing pull request, in order to ascertain whether a given code change introduced a build failure on these allowed-to-fail jobs.

It's still very important to surface feedback about these failures in a first class way.

An example implementation might involve using GitHub's CheckRun feature to report failures with a "neutral" or "warning" state in the pull request "checks" page, while still marking the Status as green.

Example of Neutral Status

github_apps_checks_annotations

Currently, Azure Pipelines does not make full use of this feature

Azure Pipeline Warnings

Screen Shot 2019-04-17 at 10 09 47 PM

By adding this capability, developers could do something like

script: <test-command> || echo -e "\043#vso[task.logissue type=warning;] Yikes!!"

to effectively turn failures into warnings, while having them surface in the GitHub UI just like they do in the Pipelines UI

Screen Shot 2019-04-17 at 10 19 49 PM

Screen Shot 2019-04-17 at 10 19 56 PM

Screen Shot 2019-04-17 at 10 20 05 PM

@vtbassmatt
Copy link
Member

@mike-north fair point, I didn't think about that. You can actually inject an error and still not fail the leg, which might be what's needed.

@moswald
Copy link
Member

moswald commented May 20, 2019

@vtbassmatt I assigned you to this issue while the correct functionality is being ironed out.

@pllim
Copy link

pllim commented Jun 6, 2019

I am in the Python world and looking into transitioning a similar functionality from Travis CI. I think this issue covers it, but if not, please let me know whether to open a new one or look at a different one. Thanks!

xref spacetelescope/synphot_refactor#194 and astropy/astropy#8445

@letmaik
Copy link
Member

letmaik commented Jul 25, 2019

@vtbassmatt Any updates? We would also need that for some projects.

@vtbassmatt
Copy link
Member

Nothing to report, sorry.

@Zac-HD
Copy link

Zac-HD commented May 21, 2020

@vtbassmatt - any updates to share?

I'm adding Python 3.9 to our build in HypothesisWorks/hypothesis#2445, and I'd love to have an allowed-to-fail matrix entry for 3.10 / nightly too.

@vtbassmatt
Copy link
Member

@Zac-HD sorry, still nothing. It hasn't been forgotten, but we've had a number of other priorities. Does one of the above workarounds help at all?

@Zac-HD
Copy link

Zac-HD commented May 21, 2020

No worries, I'll look into setting up a separate job for it, or might just get around to moving to GitHub Actions as I have for smaller projects 😄

@pllim
Copy link

pllim commented May 21, 2020

@Zac-HD , if you have "allowed to fail" working for Actions, I would like the recipe. Thank you!

@Zac-HD
Copy link

Zac-HD commented May 21, 2020

@pllim I'll be experimenting with https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error and will let you know how it goes.

@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants