"schema violations found" in my config file


#1

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

Check https://circleci.com/docs/2.0/language-java/ for more details

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 ?


#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.)


#3

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:

image


#4

Where do you get those warnings, @pieterlukasse?


#5

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


#6
# 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?


#7

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:'

#8

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 :smile:


#9

Ah, if you ignore the header block, L23 corresponds to your commented-out code. Try removing that.


#10

tried, not working.


#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.


#12
# 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

#13


Same errors came up with above file as well


#14

This is wrong too - a command should not start with a -. That would probably cause the YAML parser to expect an array.


#15

@halfer Thanks! :slight_smile: Removing - before cp worked. Missed that out while changing from V1 to V2 migration.


#16

see here for example: https://circleci.com/gh/cBioPortal/datahub/181


#17

@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.


#18

@halfer it fixed the problem! Thanks for your help.


#20

I removed the trailing tabs. See https://github.com/cBioPortal/datahub/pull/213


#22

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.