Open airtonix opened 3 years ago
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
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>> ]
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.
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.
Any update on this one? Due to migrating from the deprecated "scheduled workflows" to "scheduled pipelines" we are also seeing this in some repos.
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.
Hi folks, I had same problem. But I detected that it fixed up if remove version: 2
from workflow section.
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
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 thanks for the clarification, I routed this to the right internal team to look into it.
Bumping this. It shouldn't be considered an error if all pipelines have been filtered.
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
@ruben1 any update on this? Thank you! :)
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
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.
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 thanks for the update, what do you consider as "standard support channels"?
+1
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
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
I thought cron
is not supported anymore 🤔
@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
Thanks @Kylmakalle, I missed that update. Good to know 👍
is there a resolution to this? still experiencing this issue in June 2023
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.
I had the same error and the following config worked for me. I hope this helps everyone else here. The problem only happened for me because of a mismatched regex. Basically you need at least one matching workflow to make it work.
version: 2.1
jobs:
build:
docker:
- image: cimg/node:12.22.1 # Using Node.js 12 image
steps:
- checkout
# Install dependencies (adjust based on your build process)
- run:
name: Install Dependencies
command: yarn install # Assuming you use yarn, adjust if needed
# Define build commands based on branch using switch statement
- run:
name: Build Application
command: |
case "$CIRCLE_BRANCH" in
feature/*)
echo "Building for feature branch..."
yarn build:netlify
;;
fix/*)
echo "Building for fix branch..."
yarn build:netlify
;;
dev)
echo "Building for dev branch..."
yarn build:staging
;;
main)
echo "Building for main branch..."
yarn build:prod
;;
*)
echo "Branch not recognized. Skipping build."
;;
esac
# Netlify Deployment (Draft Preview) - Feature/Fix Branch Only
deploy-to-netlify:
docker:
- image: node:latest # Assuming a basic Node.js image for Netlify CLI
steps:
- run:
name: Install Netlify CLI
command: npm install -g netlify-cli
# Login to Netlify (replace with access token)
- run:
name: Login to Netlify
command: netlify login -e YOUR_NETLIFY_ACCESS_TOKEN
# Deploy contents of dist folder using draft flag
# Consider using environment variables for Netlify site ID per branch type (optional)
- run:
name: Deploy to Netlify (Draft Preview)
command: netlify deploy -d -s YOUR_NETLIFY_FEATURE_SITE_ID dist/*
# Server Deployment (using rsync) - Dev/Main Branch Only
deploy-to-staging-or-production:
docker:
- image: alpine:latest # Using a minimal image for rsync
steps:
- run:
name: Deploy to Production (Dev/Main)
command: |
# Deploy using rsync (replace with your details)
rsync -avz \
--exclude='.git*' \
dist/ your_user@your_server:/path/to/destination/
workflows:
version: 2.0
build-and-deploy-for-feature-or-fix:
when:
or:
- \<< pipeline.git.branch =~ /^feature\// # Regex for feature/ branches
- \<< pipeline.git.branch =~ /^fix\// # Regex for fix/ branches
jobs:
- build
- deploy-to-netlify:
requires:
- build
build-and-deploy-to-staging:
when:
and:
- equal: [ dev, << pipeline.git.branch >> ]
jobs:
- build
- deploy-to-staging-or-production:
requires:
- build
build-and-deploy-to-production:
when:
and:
- equal: [ main, << pipeline.git.branch >> ]
jobs:
- build
- deploy-to-staging-or-production:
requires:
- build
Meta:
CircleCI CLI Version:
0.1.14915+4e9d967 (release)
Operating System:
CircleCI CLI Diagnostic:
Current behavior:
Expected behavior:
When did this begin / Was this previously working?:
no idea
Additional Information:
nope.