2.1 Monorepo: Cannot find a job named `X` to run in the `jobs:` section of your configuration file

Hi,

I wanted to “dry” my configuration code a bit by using new features that come with version 2.1.
However, an essential part seems to be broken now.

Here is my config.yml:

version: 2.1

commands:
  build_and_push_docker:
    parameters:
      image_name:
        type: string
    steps:
      - checkout
      # omitted the rest for easier reading

jobs:
  build:
    docker:
      - image: circleci/golang
    environment:
      O: company_name
      R: devops-docker-images
    steps:
      - checkout
      - run:
          name: Determine which directories have changed
          command: |
            git diff --no-commit-id --name-only -r `git log -n 2 --oneline --pretty=format:"%h" | tail -n1` | cut -d/ -f1 | sort -u >  projects
            printf "Modified directories:\n"
            cat projects
            while read project; do
              if grep -Fxq $project projects.txt; then
                printf "\nTriggerring build for dir: "$project
                curl -s -u $CIRCLE_API_PROJECT_TOKEN: -d "build_parameters[CIRCLE_JOB]=${project}" "https://circleci.com/api/v1.1/project/github/${O}/${R}/tree/${CIRCLE_BRANCH}"
              fi
            done <projects
  serverless-deployer:
    docker:
      - image: docker:18.06.1-ce-git
    steps:
      - build_and_push_docker:
          image_name: "serverless-deployer"
  static-files-deployer:
    docker:
      - image: docker:18.06.1-ce-git
    steps:
      - build_and_push_docker:
          image_name: "static-files-deployer"

workflows:
  version: 2.1
  build-test-and-deploy:
    jobs:
      - build

The pipeline starts of with the “build” job that determines which of the included projects inside the monorepo should be be build. It then triggers the job via an API call.

The job then starts to run with the correct parameters. However, I get this errors message I did not get with version 2.0.

build-agent version 0.1.1073-1f69f340 (2018-11-20T18:07:03+0000) Configuration errors: 2 errors occurred: * Configuration version 2.1 requires the "Enable Build Processing" project setting. Enable Build Processing under Project Settings -&gt; Advanced Settings. In order to retrigger build processing, you must push a new commit. 
* Cannot find a job named `serverless-deployer` 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 cannot seem to sind the serverless-deployer job anymore.

The difference to version 2.0 is that I am now using “commands” instead of code replication.
I have also enabled Build Processing as advised.

Unfortunately, we don’t support 2.1 configuration (or, more specifically, we don’t support Build Processing) at that API endpoint. We are working to improve the other API endpoint for triggering your whole build config to allow specific jobs. We are also looking at ways to make our monorepo approach better, to help avoid this kind of scenario in the first place. In the mean time, to do trigger individual jobs from inside your config you’d need to either move away from build processing for that project or change the logic to avoid needing to trigger new jobs.

Thanks for the reply!

I will then revert to my 2.0 version and adapt when new features are ready.

If you’re just trying to DRY up a YAML file, can you use YAML references? They will be fine in 2.0.

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