circleci-cli icon indicating copy to clipboard operation
circleci-cli copied to clipboard

using "when condition" at workflow level causes unhelpful error: Error: All Workflows have been filtered from this Pipeline.

Open airtonix opened this issue 4 years ago • 27 comments
trafficstars

Meta:

CircleCI CLI Version:

0.1.14915+4e9d967 (release)

Operating System:

 npx envinfo

  System:
    OS: macOS 11.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 2.30 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v12.13.1/bin/yarn
    npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /Users/zeno.jiricek/.rvm/gems/ruby-2.4.10/bin/pod
    Gradle: 6.8.1 - /usr/local/bin/gradle
    Homebrew: 3.0.1 - /usr/local/bin/brew
    Maven: 3.6.3 - /usr/local/bin/mvn
    pip3: 21.0.1 - /usr/local/bin/pip3
    RubyGems: 3.0.9 - /Users/zeno.jiricek/.rvm/rubies/ruby-2.4.10/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 4.2.1 - /usr/bin/gcc
    Git: 2.24.3 - /usr/bin/git
    Clang: 1200.0.32.29 - /usr/bin/clang
  Servers:
    Apache: 2.4.46 - /usr/sbin/apachectl
  Virtualization:
    Docker: 20.10.2 - /usr/local/bin/docker
    VirtualBox: 5.2.12 - /usr/local/bin/vboxmanage
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Nano: 2.0.6 - /usr/bin/nano
    VSCode: 1.52.1 - /usr/local/bin/code
    Vim: 8.2 - /usr/bin/vim
    WebStorm: 2017.3.4
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Java: 1.8.0_222 - /usr/bin/javac
    Perl: 5.28.2 - /usr/bin/perl
    PHP: 7.3.24 - /usr/bin/php
    Python: 2.7.16 - /usr/bin/python
    Python3: 3.8.2 - /usr/bin/python3
    Ruby: 2.4.10 - /Users/zeno.jiricek/.rvm/rubies/ruby-2.4.10/bin/ruby
  Databases:
    SQLite: 3.32.3 - /usr/bin/sqlite3
  Browsers:
    Safari: 14.0.2
  Monorepos:
    Yarn Workspaces: 1.22.10

CircleCI CLI Diagnostic:

$ circleci diagnostic

---
CircleCI CLI Diagnostics
---
Debugger mode: false
Config found: /Users/zeno.jiricek/.circleci/cli.yml
API host: https://circleci.com
API endpoint: graphql-unstable
OK, got a token.
Trying an introspection query on API... 
Ok.
Hello, Zeno Jiricek.

Current behavior:

$ cat .circleci/config.yml
version: 2.1

jobs:
  foo:
    docker:
      - image: circleci/node:10
    steps:
      - checkout

workflows:
  version: 2

  master:

    when:
      or:
        - equal: [ master, << pipeline.git.branch >> ]

    jobs:
      - foo
$ circleci config validate
Error: All Workflows have been filtered from this Pipeline.
No Jobs have been run.

Expected behavior:

$ circleci config validate
Config file at .circleci/config.yml is valid.

When did this begin / Was this previously working?:

no idea

Additional Information:

nope.

airtonix avatar Feb 22 '21 00:02 airtonix

Sounds to me that the error is on the server side. right? I mean, if there is nothing to run. Why would it fail? Doesn't make sense

alejandrod-f avatar Aug 27 '21 20:08 alejandrod-f

This should really be fixed, as in under certain scenarios this is not actually an issue. I've added a pre-commit hook that triggers a validate against my config and need to disable it now as there's no workflow to run against my conditions. I'd rather not add another pointless workflow as a workaround.

when:
      not:
        or:
          - equal: [ someValue, << pipeline.parameters.someParameter >> ]
          - equal: [ someOtherValue, << pipeline.parameters.someOtherParameter>> ]

mickutz avatar Oct 27 '21 14:10 mickutz

This actively affects our pipeline as well where we're using the environment as a parameter and matching against the branch name to when: or: at the workflow level - I really do not want to have to add a superfluous workflow just to stop an overzealous error message.

thopiddock avatar Jan 20 '22 09:01 thopiddock

Same here. Using the new(ish) setup workflows and path filtering, sometimes there are no workflows to run. Right now I have a useless noop workflow but I would love to get rid of it.

otherguy avatar Apr 14 '22 22:04 otherguy

Any update on this one? Due to migrating from the deprecated "scheduled workflows" to "scheduled pipelines" we are also seeing this in some repos.

mathaeus avatar May 02 '22 10:05 mathaeus

Would also be interested in having this changed. We are using conditional workflows in combination with the path filtering orb to skip build steps if only certain files were changed. The current behavior is falsely indicating a failure of the CI pipeline.

viktorbahr avatar May 04 '22 09:05 viktorbahr

Hi folks, I had same problem. But I detected that it fixed up if remove version: 2 from workflow section.

nicrom8b avatar May 10 '22 20:05 nicrom8b

Hi, you're likely seeing this issue because you're running circleci config validate from a certain local branch and that gets prefilled into the pipeline values. Config compilation then works as usual.

I'm not sure I understand well your use case but we have a ticket in the backlog to let users pass their own pipeline values. That would enable you to do config validation based on pipeline values of your choice so you can create a realistic validation. For e.g. in your case pipeline.git.branch = master. Let us know if that would still not solve your use case though

ruben1 avatar Jun 03 '22 15:06 ruben1

Hi @ruben1, the issue is not about circleci config validate spitting out an error. The OP just showcased the problem by using that command.

The underlying problem is that the when condition makes the whole CI workflow fail, if there is no workflow that matches any condition. That is the problem where we'd love to see a fix for, because currently some of us have a dummy workflow set up, just so that this dummy workflow matches in case no other workflow matches, in order to prevent this failure on CI.

mathaeus avatar Jun 06 '22 07:06 mathaeus

@mathaeus thanks for the clarification, I routed this to the right internal team to look into it.

ruben1 avatar Jun 14 '22 11:06 ruben1

Bumping this. It shouldn't be considered an error if all pipelines have been filtered.

JonTheStone avatar Jun 15 '22 21:06 JonTheStone

yeah we have also the same error, in the mean time, do you have any dummy noop implementation, any really light executor? I am using the executor that was already in the job but I would like to know if do you know a really light executor just to "do nothing"

in my case it looks like that

jobs:
  noop:
    executor: my-executor-which-needs-my-context
    steps:
      - run:
        command: |
          echo "do nothing"
          
....

workflows:
  noop:
    jobs:
      - noop:
          context: myContext

vmrvictor avatar Jul 25 '22 14:07 vmrvictor

@ruben1 any update on this? Thank you! :)

mathaeus avatar Aug 01 '22 06:08 mathaeus

I had the same issue, you should check your regex removing the version will just hide the warning and it is not a solution.

As per the official docs:

matches uses Java regular expressions for its pattern. A full match pattern must be provided, prefix matching is not an option. Though, it is recommended to enclose a pattern in ^ and $ to avoid accidental partial matches.

Solution -> enclose your pattern in ^ and $ and check if it matches what you expect e.g. on regex101.

Tip: use single quotes in YAML if you get the following error:

Error: Unable to parse YAML while scanning a double-quoted scalar

dnhyde avatar Oct 14 '22 14:10 dnhyde

I could be misremembering as it has been a while but I believe the issue here is not a pipeline not being picked up, but that CircleCI considers any workflow that does not correlate with a pipeline to be an error and unintentional when some of us are intentionally filtering all pipelines and do not expect it to be an error.

JonTheStone avatar Oct 14 '22 14:10 JonTheStone

Hey folks, I escalated this to the internal team that owns that. It hasn't been prioritized as of now.

If you have an issue directly related with the CLI, feel free to update here/open issues in the repo but if your issue has to do with running pipelines in the core platform, I'd advise to go through the standard support channels so that there's more visibility into that and a faster solution.

ruben1 avatar Nov 01 '22 09:11 ruben1

@ruben1 thanks for the update, what do you consider as "standard support channels"?

mathaeus avatar Nov 01 '22 12:11 mathaeus

+1

adi-accessibe avatar Mar 08 '23 19:03 adi-accessibe

Hey, If you are facing this error and you use circleci config validate command as the pre-commit .. you can use below pre-commit repo. Here we just skip the know errors. https://github.com/fluxninja/pre-commit-hooks

slayer321 avatar Apr 03 '23 08:04 slayer321

If you want to save a portion of credits for noop workflow, you can create a scheduled workflow that will never execute. e.g. February 31st

jobs:
  noop:
    docker:
      - image: cimg/base:current
    resource_class: small
    steps:
      - run: echo "noop"

workflows:
  noop: # This workflow is required, but will never run. https://github.com/CircleCI-Public/circleci-cli/issues/577
    triggers:
      - schedule:
          cron: "0 0 31 2 0" # February 31st
          filters:
            branches:
              only:
                - some_branch_that_will_never_exist_and_nobody_will_create_it
    jobs:
      - noop

Kylmakalle avatar Apr 20 '23 13:04 Kylmakalle

I thought cron is not supported anymore 🤔

mathaeus avatar Apr 20 '23 15:04 mathaeus

@mathaeus

Not yet.

Update 6-Dec-2022: We previously announced that we will be sunsetting scheduled workflows at the end of this year. Since that announcement went live, we’ve been closely tracking your feedback and feature requests, and have decided to postpone the deprecation - no new timelines are set yet.

https://discuss.circleci.com/t/scheduled-pipelines-are-here/41684/17

Kylmakalle avatar Apr 20 '23 16:04 Kylmakalle

Thanks @Kylmakalle, I missed that update. Good to know 👍

mathaeus avatar Apr 20 '23 16:04 mathaeus

is there a resolution to this? still experiencing this issue in June 2023

davidyuloom avatar Jun 14 '23 13:06 davidyuloom

Same. My working example is that I want to run workflows when commits are pushed to my default branch, but all other branches are triggered manually via api. The noise from no workflow "errors" becomes almost unbearable.

JonTheStone avatar Jun 14 '23 14:06 JonTheStone