Manually approval of jobs not working

jobs:
build:
    docker:
    - image: circleci/node:7.10
working_directory: ~/repo
steps:
- checkout
- restore_cache:
    keys:
        - v1-dependencies-{{ checksum "package.json" }}
        - v1-dependencies-
- run: yarn install
- save_cache:
    paths:
        - node_modules
    key: v1-dependencies-{{ checksum "package.json" }}
deploy-staging:
docker:
- image: circleci/node:7.10
working_directory: ~/repo
steps:
- checkout
- restore_cache:
    keys:
        - v1-dependencies-{{ checksum "package.json" }}
        # fallback to using the latest cache if no exact match is found
        - v1-dependencies-
- run: yarn install
- run:
    name: deploy
    command: |
        ssh -o StrictHostKeyChecking=no ubuntu@MY_PUBLIC_IP "mkdir testing-CircleCI"
deploy-prod:
docker:
- image: circleci/node:7.10
working_directory: ~/repo
steps:
- checkout
- restore_cache:
    keys:
        - v1-dependencies-{{ checksum "package.json" }}
        - v1-dependencies-
- run: yarn install
workflows:
version: 2
build_and_deploy:
jobs:
- build
- deploy-staging:
    type: approval
    requires:
        - build
- deploy-prod:
    type: approval
    requires:
        - build

Here is my config file. I have three jobs in workflow. second and third job dependent on first. First job runs successfully after this when i approve second or third job manually, these jobs are not getting started. nothing happens when when i approve job. if i refresh page UI shows that jobs is completed successfully but when i go to jobs listing page there is no entry for that job which i approved manually.
If i remove type: approval from 2nd and third job than all jobs runs successfully and comes up in jobs listing page.

Hi,

I will try to reproduce this issue and would let you know.

Regards,
Pawan Bahuguna

Hi,

Yes, you are right and this is the intended behaviour of “approve job”. Approve job should have a unique name not used by any other job i.e., your custom configured jobs, such as build or deploy-staging, etc. wouldn’t be given a type: approval key.

You can modify your configuration like below, where you have to approve hold job, before deploy-staging and deploy-prod can start.

workflows:
 version: 2
 build_and_deploy:
   jobs:
     - build
     - hold:
         type: approval
         requires:
           - build
     - deploy-staging:
         requires:
           - hold
     - deploy-prod:
         requires:
           - hold

Please read “Holding a Workflow for a Manual Approval” for more details.

Regards,
Pawan Bahuguna