Config.yml - build and deploy conditionals - Testing

Now have a configuration which works when parameters are “true” for both build and deploy.

This builds and deploys

    type: boolean
    default: true
    type: boolean
    default: true

Prior topic: Config.yml conditional for build and deploying multiple environments

Then I sequentially changed run_workflow_deploy: to false (change) (result) This seems to work properly and none of the multiple environments deploy to cloudsmith.

and then run_workflow_build: to false (change) (result)
This does not seem to be working properly for some reason. There are not individual builds showing, but errors.

The next thing I tried testing was enabling one of the environment buster-armhf build=true
(result) This still seems to have ‘schema’ errors again, and buster-armhf build does not work properly.

The next thing I tried testing was enabling environment buster-armhf build=true and enabling buster-armhf deploy=true (result) The environment does not deploy and there are lots of schema errors.

How do I fix these problems?

Hi @rgleason,

You need to add a “fallback step” that handles the case where none of the conditions are met; for example: a simple echo.

Here’s what it’d be for the build-android-armhf job:

     - image: 'circleci/android:api-28-ndk'
      - OCPN_TARGET: android-armhf
      - when:
          condition: <<pipeline.parameters.run_workflow_build>>
            - checkout
            - run: chmod a+x ci/*.sh
            - run: bash ci/
      - when:
          condition: << pipeline.parameters.run_workflow_deploy >>
            - run: ci/
            - run: echo "deploying"

      - run: echo "None of the conditions are met"

Also, note that you can use the CircleCI CLI to validate your config.yml before attempting to run the build.

Let me know if this helps.