circleci-cli
circleci-cli copied to clipboard
Confusing error message for builds against 2.0 configuration
I am using the latest version of CLI tool
etc :: ~/projects/scio » circleci version
0.1.3667+073b0ec
And validate command is perfectly fine with my config
etc :: ~/projects/scio » circleci config validate
Config file at .circleci/config.yml is valid.
But once I try to spin local container, provision fails.
etc :: ~/projects/scio » circleci local execute
Docker image digest: sha256:3d88cfffd448da07ff8ced22ccdca5adc09ff18e87dc7db9b8af5b8a47647c08
====>> Spin up Environment
Build-agent version 0.1.750-336e0196 (2018-09-13T19:48:06+0000)
Error: Configuration errors: 1 error occurred:
* Cannot find a job named `build` to run in the `jobs:` section of your configuration file.
If you expected a workflow to run, check your config contains a top-level key called 'workflows:'
Step failed
Task failed
Even though it should not:
etc :: ~/projects/scio » grep "workflows" -A 17 .circleci/config.yml
workflows:
version: 2
# Per commit build
build:
jobs:
- build_211
- build_212
- deploy:
requires:
- build_211
- build_212
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
As far as I can tell, the problem is on the picard side, which is closed sourced. How can I see the piece of code where this parsing and validation happens to somehow contribute the fix? Any other directions?
@lazyval can you share the whole config? If not, can you email it to [email protected] please?
@marcomorain it's https://github.com/spotify/scio/blob/master/.circleci/config.yml
I will try to dumb it down to minimal reproducible example
@lazyval that's a bug on our end - if you run circleci config process
the result is not valid YAML for some reason - there is a newline character being inserted for some reason on long lines, like here:
- checkout
- restore_cache:
keys:
- v2-scio-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ checksum "build.sbt"
}}
- v2-scio-{{ .Environment.CIRCLE_JOB }}-
I'll look into it here with the team.
@marcomorain oh, thanks a lot for such a quick feedback!
with that said, I've simplified config and have same result even for a shorter lines. Seems like some other problem also lurking around, or am I missing something?
etc :: ~/projects/scio » cat .circleci/config.yml
####################
# Templates
####################
scala_211_version: &scala_211_version 2.11.12
common_settings: &common_settings
working_directory: ~/scio
jdk8: &jdk8
docker:
- image: circleci/openjdk:8-jdk
build_settings: &build_settings
steps:
- checkout
- run: ./scripts/circleci_test.sh
####################
# Jobs
####################
version: 2
jobs:
build_211:
<<: [*build_settings, *jdk8]
environment:
- SCALA_VERSION: *scala_211_version
####################
# Workflows
####################
workflows:
version: 2
# Per commit build
build:
jobs:
- build_211
process output (which is valid YAML according to http://www.yamllint.com/):
etc :: ~/projects/scio » circleci config process .circleci/config.yml
scala_211_version: 2.11.12
common_settings:
working_directory: ~/scio
jdk8:
docker:
- image: circleci/openjdk:8-jdk
build_settings:
steps:
- checkout
- run: ./scripts/circleci_test.sh
version: 2
jobs:
build_211:
steps:
- checkout
- run: ./scripts/circleci_test.sh
docker:
- image: circleci/openjdk:8-jdk
environment:
- SCALA_VERSION: 2.11.12
workflows:
version: 2
build:
jobs:
- build_211
which still breaks the execute
:
etc :: ~/projects/scio » circleci local execute
Docker image digest: sha256:3d88cfffd448da07ff8ced22ccdca5adc09ff18e87dc7db9b8af5b8a47647c08
====>> Spin up Environment
Build-agent version 0.1.750-336e0196 (2018-09-13T19:48:06+0000)
Error: Configuration errors: 1 error occurred:
* Cannot find a job named `build` to run in the `jobs:` section of your configuration file.
If you expected a workflow to run, check your config contains a top-level key called 'workflows:'
Step failed
Task failed
🤦♂️
This isn't a config issue - the local execute
command it not aware of workflows, so it runs the job specified with --job
. If none is specified, it looks for a job named build
by default.
The error message that we are showing is really poor, and doesn't describe the issue at all. I'm really sorry about that.
circleci local execute --job build_211
wow, so it's boils down to improper use of command and confusing error thank you for distilling the problem!
I guess the better error message can't be contributed as it is a part of the picard?
+1 on improving the error message :D
+1 please
cc @KunalJain
Internal note: We will be able to improve this error message once we enabled pipelines for all projects.
Shouldn't the documentation be updated to explain that the CLI does not work with workflows? I'm using the config that CircleCI generated for me and following the instructions in the official documentation. I was surprised to see this has been an issue since 2018.
Shouldn't the documentation be updated to explain that the CLI does not work with workflows? I'm using the config that CircleCI generated for me and following the instructions in the official documentation. I was surprised to see this has been an issue since 2018.
The documentation on the limitations of the execute command are listed here: https://circleci.com/docs/how-to-use-the-circleci-local-cli#limitations-of-running-jobs-locally
The error message was improved !