Search code examples
clouddevopscicd

circleci config.yml: 'Invalid template path ./.circleci/file.s/backend.yml'


I have written this code in the job command named Infrastructure Deployment.

  deploy-infrastructure:
docker:
  - image: amazon/aws-cli
steps:
  # Checkout code from git
  - run:
      name: Ensure back-end infrastructure exists
      command: |
          yum -y install gzip tar 
          aws cloudformation deploy \
            --template-file .circleci/files/backend.yml \
            --stack-name "updapeople-backend-${CIRCLE_WORKFLOW_ID:0:7}" \
            --parameter-overrides ID="${CIRCLE_WORKFLOW_ID:0:7}" 

but every single time it gave me the same error I am pretty sure the name is totally correct.this path is actually on github and I am trying to build a full automated Pipline for CI/CD.


Solution

  • You need an actual checkout step (https://circleci.com/docs/configuration-reference#checkout) before that "Ensure back-end infrastructure exists" step:

    deploy-infrastructure:
      docker:
        - image: amazon/aws-cli
      steps:
        # Checkout code from git
        - checkout
        - run:
            name: Ensure back-end infrastructure exists
            command: |
                yum -y install gzip tar 
                aws cloudformation deploy \
                  --template-file .circleci/files/backend.yml \
                  --stack-name "updapeople-backend-${CIRCLE_WORKFLOW_ID:0:7}" \
                  --parameter-overrides ID="${CIRCLE_WORKFLOW_ID:0:7}"