Duplicate steps in UI for pipeline after adding approval step

We are seeing duplicates in our pipeline after adding an approval step for a deployment.

Our yaml file looks something like this:

version: '1.0'
stages:
  - setup
  - build
  - push
  - deploy
  - post-deploy
  - deploy-to-prod
steps:
  main_clone:
    stage: setup
    type: git-clone
    description: Cloning...
    repo: 'Our repo'
    revision: 'Some branch'
  test_and_build:
    stage: build
    type: parallel
    steps:
      lint:
        title: Linting
        image: 'Our image'
        working_directory: 'Some directory'
        commands:
          - npm run linter:check
      unit_testing:
        title: Unit Testing
        image: 'Our image'
        working_directory: 'Some directory'
        commands:
          - npm run test:unit
      build_static_asset:
        title: Build
        image: 'Our image'
        working_directory: 'Some directory'
        commands:
          - npm run build
  build_image:
    stage: build
    title: Build Image
    type: build
    image_name: 'Our image'
    tag: 'Some tag'
    dockerfile: Dockerfile
    working_directory: 'Some directory'
    build_arguments:
      - 'GITHUB_TOKEN=${{GITHUB_TOKEN}}'
    when:
      branch:
        only:
          - master
  push_parallel:
    stage: push
    type: parallel
    steps:
      annotate_build:
        title: Annotating Build
        image: '${{build}}'
        working_directory: 'Some directory'
        commands:
          - echo Annotating...
        on_success:
          metadata:
            set:
              - '${{build.imageId}}':
                  - CF_QUALITY: true
        on_error:
          metadata:
            set:
              - '${{build.imageId}}':
                  - CF_QUALITY: false
      push:
        title: Pushing image...
        type: push
        image_name: 'Our image'
        registry: 'Our registry'
        candidate: '${{build}}'
        tags:
          - '${{CF_BRANCH_TAG_NORMALIZED}}-latest'
    when:
      branch:
        only:
          - master
  deploy_lower_envs:
    stage: deploy-lower-envs
    type: parallel
    steps:
      development:
        stage: deploy-lower-envs
        title: Deploy to development
        type: codefresh-run
        arguments:
          PIPELINE_ID: Apps/deploy-dev
        when:
          branch:
            only:
              - master
      staging:
        stage: deploy-lower-envs
        title: Deploy to staging
        type: codefresh-run
        arguments:
          PIPELINE_ID: Apps/deploy-stag
        when:
          branch:
            only:
              - master
  post_deploy_tests:
    stage: post-deploy
    type: parallel
    steps:
      run_tests_in_dev:
        stage: post-deploy
        title: Post Deploy Development Tests
        type: codefresh-run
        arguments:
          PIPELINE_ID: Tests/api-dev
        when:
          branch:
            only:
              - master
      run_tests_in_stag:
        stage: post-deploy
        title: Post Deploy Staging Tests
        type: codefresh-run
        arguments:
          PIPELINE_ID: Tests/api-stag
        when:
          branch:
            only:
              - master
  deploy_to_prod:
    stage: deploy-to-prod
    image: "${{build}}"
    steps:
      get_approval_for_prod_deploy:
        stage: deploy-to-prod
        title: Approve deployment to production?
        type: pending-approval
        when:
          branch:
            only:
              - master
      production:
        stage: deploy-to-prod
        title: Deploy to production
        type: codefresh-run
        arguments:
          PIPELINE_ID: Apps/deploy-prod
        when:
          steps:
          - name: get_approval_for_prod_deploy
            on:
            - approved

My only guess right now is that the duplicates might be due to some previous stages containing parallel steps however this current stage with the approval step has no parallel step at all.

Hello

The deploy_to_prod yaml is not correct. And it doesn’t even need to be parallel.

Please remove the deploy_to_prod parent step and simply have 2 sequential steps, 1 for the approval and one for the codefresh-run step.

You should still open a support ticket with us so that we can inform our dev team to not allow this kind of syntax

Thanks for your response @Kostis
May I ask what’s wrong with the yaml though? We are using go templates to generate the yaml and we make use of steps. So, we use a parent step to encapsulate both the approval and the deploy. Do you mean that is not possible and we would need to separate the approval from the deploy?
Plus what if we want to add another approval and deploy to the go template being called by that parent step? Does that mean we would need to spell everything out in the parent yaml as against using it in a step?

There is no concept of “generic parent steps” in Codefresh. If you saw this somewhere in our documentation please let me know where and I will fix it.

In Codefresh you either have serial steps (one after the other) or parallel steps (that are indeed grouped under a common parent step).

The yaml you posted has a parent step without being parallel. This is not allowed.

Please correct me if I am wrong, but all the scenarios I can think of are

  1. a step asks for approval. The pipeline stops running.
  2. user approves and pipeline continues
  3. a deployment happens to an environment (e.g. production)

This is a strictly serial process. I don’t see a need for parallel steps or any kind of “grouping”

I think I understand what you mean. I will look into it and get back to you.

@Kostis thanks man. It’s clear now. I guess there’s definitely a bug in the system based on what we highlighted earlier though.

Yes, as I said please open a Zendesk ticket from the Codefresh UI and our dev team will fix it.