Workflows not detecting any of my jobs

workflow
config
2.0

#1

Here is my config:

# CircleCI 2.0 config
version: 2
jobs:
  defaults: &defaults
    working_directory: ~/work
    docker:
      - image: python:3.5.2

  build:
    <<: *defaults
    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - vdo-deps-{{ checksum "adm/pip_requirements.txt" }}
            - vdo-deps-
      - run:
          name: Install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install coverage
            pip install nose
            . adm/update_requirements.sh
      - save_cache:
          paths:
            - venv
          key: vdo-deps-{{ checksum "adm/pip_requirements.txt" }}

      # Testing
      # - run: yarn test

  awscli:
    <<: *defaults
    steps:
      - run:
          name: Download AWS CLI
          command: pip install --upgrade --user awscli
      - persist_to_workspace:
          root: /usr/local/bin
          paths:
            - aws

  kops:
    <<: *defaults
    steps:
      - run:
          name: Download kops
          command: |
            [ ! -d bin ] && mkdir bin
            wget https://github.com/kubernetes/kops/releases/download/1.6.1/kops-linux-amd64
            mv kops-linux-amd64 bin/kops
            chmod +x bin/kops
      - persist_to_workspace:
          root: bin
          paths:
            - kops

  kubectl:
    <<: *defaults
    steps:
      - run:
          name: Download kubectl
          command: |
            [ ! -d bin ] && mkdir bin
            curl -L -o bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
            chmod +x bin/kubectl
      - persist_to_workspace:
          root: bin
          paths:
            - kubectl

  devops:
    <<: *defaults
    steps:
      - run:
          name: Setup devops repo
          command: git clone git@github.com:exampleorg/devops.git devops
      - persist_to_workspace:
          root: ~/work
          paths:
            - devops

  staging:
    <<: *defaults
    environment:
      - API_URL: http://api.staging.example.com
      - CLUSTER_DOMAIN: us-east.staging.example.com
    steps:
      - attach_workspace:
          at: /usr/local/bin/aws
      - attach_workspace:
          at: bin/kops
      - attach_workspace:
          at: bin/kubectl
      - attach_workspace:
          at: devops
      - run:
          name: Setup kubectl
          command: bin/kops export kubecfg --name ${CLUSTER_DOMAIN}
      - run:
          name: Build and push image
          command: make build deploy
      - run:
          name: Deploy ${CIRCLE_PROJECT_REPONAME} to ${API_URL}
          command: make verify all

  prod:
    <<: *defaults
    environment:
      - API_URL: http://api.example.com
      - CLUSTER_DOMAIN: us-east.example.com
    steps:
      - attach_workspace:
          at: /usr/local/bin/aws
      - attach_workspace:
          at: bin/kops
      - attach_workspace:
          at: bin/kubectl
      - attach_workspace:
          at: devops
      - run:
          name: Setup kubectl
          command: bin/kops export kubecfg --name ${CLUSTER_DOMAIN}
      - run:
          name: Build and push image
          command: make build deploy
      - run:
          name: Deploy ${CIRCLE_PROJECT_REPONAME} to ${API_URL}
          command: make verify all

workflows:
  version: 2
  test_and_deploy:
    jobs:
      - build
      - staging:
          requires:
            - build
            - awscli
            - kops
            - kubectl
            - devops
          filters:
            branches:
              only: master
      # - prod:
      #     requires:
      #       - build
      #       - awscli
      #       - kops
      #       - kubectl
      #       - devops
      #     filters:
      #       tag:
      #         only: /v[0-9]+(\.[0-9]+)*/

I’m sure there are plenty of things in there that are done incorrectly, since this is my first shot, but I’d really like to know why the workflows are failing as if the jobs don’t even exist:


#2

Apparently all “requires” items also have to be included under “jobs” in workflow. I was assuming any requires would be run automatically. Whoops.


#3

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