I am not sure if this is a bug, but I just connected to my repository from github, added suggested file config.yml to repo, and got info that build failed. This is error:
Your config file has errors and may not run correctly:
#: 2 schema violations found
#: required key [jobs] not found
#: required key [version] not found
This is config.yml:
Java Maven CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: mvn dependency:go-offline
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}
# run tests! and gen code coverage
- run: mvn integration-test cobertura:cobertura
- store_test_results:
path: target/surefire-reports
- run:
name: Send to CodeCov
command: bash <(curl -s https://codecov.io/bash)
What is going on ?
halfer
April 14, 2018, 5:51pm
2
(Please format the whole of your YAML file in a code block. To do this, edit your post, select the whole thing with your mouse, click the </>
code button in the tool bar, then save the post.)
I have the same issue. This is how my file starts:
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build: ... etc etc
So, the file clearly starts with version and job. Why do I get this warning:
Where do you get those warnings, @pieterlukasse ?
Update: never mind, it was an incorrect indentation inside the job.
I’m also seeing this error. Loaded the YAML in a Ruby console just to make sure that the format was correct and both jobs
and version
keys are available.
Full file at https://gist.github.com/milgner/98d259bb9b3c0e2cc7a3c6902f153941
# Java Gradle CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2.0
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
branches:
ignore:
- develop
- /feature/
steps:
- checkout
- run:
name: Download Repo
command: git clone --recursive git@github.com:toppr/toppr-android.git
- run:
name: Copy Licenses
command: - cp -r licenses/. $ANDROID_HOME/licenses
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
# - run:
# name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
# command: sudo chmod +x ./gradlew
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Run Tests
command: ./gradlew lint test
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
Facing the same issue. @pieterlukasse Did u find any solution?
Also these errors.
Configuration errors: 2 errors occurred:
* Error parsing config file: yaml: line 23: block sequence entries are not allowed in this context
* 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:'
I wonder if the version should be 2
and not 2.0
?
Check all your spaces are really spaces, and not tabs.
I might suggest removing the commented block as well, just in case
Ah, if you ignore the header block, L23 corresponds to your commented-out code. Try removing that.
halfer
May 9, 2018, 10:32am
11
Alright, well keep trying. Remember that you’re the only person that can see your screen, and the latest copy of your config. “Not working” does not give me anything new to go on with, so I cannot assist further.
# Java Gradle CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
branches:
ignore:
- develop
- /feature/
steps:
- checkout
- run:
name: Download Repo
command: git clone --recursive git@github.com:toppr/toppr-android.git
- run:
name: Copy Licenses
command: - cp -r licenses/. $ANDROID_HOME/licenses
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Run Tests
command: ./gradlew lint test
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
Also these errors.
Configuration errors: 2 errors occurred:
* Error parsing config file: yaml: line 23: block sequence entries are not allowed in this context
* 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:'
Same errors came up with above file as well
halfer
May 9, 2018, 10:37am
14
This is wrong too - a command should not start with a -
. That would probably cause the YAML parser to expect an array.
@halfer Thanks! Removing -
before cp
worked. Missed that out while changing from V1 to V2 migration.
1 Like
@pieterlukasse : I just tried a YAML validator picked at random, and pasted your YAML. You have some trailing tabs in the paths
key in the save_cache
section; try removing those.
@halfer it fixed the problem! Thanks for your help.
1 Like
system
Closed
August 21, 2018, 3:43pm
22
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.