Debugging Help on matrix

Not sure what’s wrong with my config, but I am seeing this when running the validator:

➜ circleci config validate
Error: Error calling workflow: 'build_deploy'
Error calling job: 'deploy_helm_non_prod'
Unexpected argument(s): env

Here is my config:

version: 2.1

jobs:
  build:
    docker:
      - image: docker:stable
    steps:
      - checkout
      - setup_remote_docker:
          version: 19.03.13
      - run:
          name: install bash
          command: |
            apk add bash openssh-client
      - run:
          name: Build and push image
          command: .circleci/scripts/build_push.sh
  deploy_helm_non_prod: &deploy_helm_non_prod
    docker:
      - image: alpine/helm:2.16.9
    steps:
      - checkout
      - run:
          name: install bash
          command: apk add bash jq git openssh-client curl python3 py-pip git openssl
      - run:
          name: Helm deployment
          command: .circleci/scripts/deploy.sh
  deploy_helm_prod:
    <<: *deploy_helm_non_prod
  tear_down_non_prod:
    docker:
      - image: docker:stable
    steps:
      - checkout
      - run:
          name: install bash
          command: |
            apk add bash
      - run:
          name: Tear down namespace
          command: .circleci/scripts/tear_down.sh
workflows:
  build_deploy:
    jobs:
      - build:
          context: aws-non-prod
          filters:
              branches:
                  ignore: /.*/
              tags:
                  only: /^v.*/
      - deploy_helm_non_prod:
          context: aws-non-prod
          filters:
              branches:
                  ignore: /.*/
              tags:
                  only: /^v.*/
          matrix:
            parameters:
              env:
                - dev
                - qa
                - uat
          name: deploy_helm_non_prod_<< matrix.env >>
 

Hi, the issue is you have not declared the parameter in the job. As it stands you are calling a job with a parameter from the workflow, but the job does not accept any parameters, therefore you receive an error.

You need to add:

    parameters:
      env:
        type: string

To the deploy_helm_non_prod job for this to validate successfully. You can then use the env parameter in the job as required.

1 Like

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