[Workflows] "Config does not conform to schema" error

circle.yml
workflow

#1

Hi everybody!

I’m migrating my circle ci configuration from 1.0 to 2.0 then i encountered an error that i dont understand. I want to use workflow feature.

Here is my config.yml:

version: 2
jobs:
  build_develop_consumer:
    macos:
      xcode: "9.4"
    steps:
      - checkout
      - run:
        name: Update dependencies
        command: bundle install
      - run:
        name: Update cocoapods
        command: pod update --verbose
      - run:
        name: Build consumer
        command: bundle exec fastlane staging
  build_develop_business:
    macos:
      xcode: "9.4"
    steps:
      - checkout
      - run:
        name: Update dependencies
        command: bundle install
     - run:
        name: Update cocoapods
        command: pod update --verbose
      - run:
        name: Build business
        command: bundle exec fastlane stagingBusiness
  build_master_consumer:
    macos:
      xcode: "9.4"
    steps:
      - checkout
      - run:
        name: Update dependencies
        command: bundle install
      - run:
        name: Update cocoapods
        command: pod update --verbose
      - run:
        name: Build consumer
        command: bundle exec fastlane prod
  build_master_business:
    macos:
      xcode: "9.4"
    steps:
      - checkout
      - run:
        name: Update dependencies
        command: bundle install
      - run:
        name: Update cocoapods
        command: pod update --verbose
      - run:
        name: Build business
        command: bundle exec fastlane prodBusiness

workflows:
  version: 2
  build_develop_build_master:
    jobs:
      - build_develop_consumer:
        filters:
          branches:
            only: develop
      - build_develop_business:
        filters:
          branches:
            only: develop
      - build_master_consumer:
        filters:
          branches:
            only: master
      - build_master_business:
        filters:
          branches:
            only: master

Thank you for your help.


#2

This is just a YAML validation problem. Paste it here and then get it to validate. On line 18 the - run is missing one space indent. Hard to spot, but the above tool helps to find such issues.

Also, the format this will create is wrong. For each run block like so:

  - run:
    name: Update dependencies
    command: bundle install

That will produce three keys at an equal object level, with run being null. You want this:

  - run:
      name: Update dependencies
      command: bundle install

That will produce a run object containing two keys. Try modifying it in the above tool to see the difference.


#3

Also, once you have that running, look into YAML references (Wikipedia has a good explanation). The following block can be turned into a reference and then re-used several times:

macos:
  xcode: "9.4"
steps:
  - checkout
  - run:
      name: Update dependencies
      command: bundle install
  - run:
      name: Update cocoapods
      command: pod update --verbose
  - run:
      name: Build business
      command: bundle exec fastlane prodBusiness

I think the changing item in steps.run[2].command can be overwritten on a per-usage basis. I’ve not done this, but have a play around - I think it can be done.


#4

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