Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error: Template file not found at /builds/…/…/template.yml

I am running into this error when running my pipeline upon a merge into gitlab. My .gitlab-ci.yml file looks like this

image: python:3.12

stages:
  - deploy

production:
  stage: deploy
  before_script:
    - pip3 install awscli --upgrade
    - pip3 install aws-sam-cli --upgrade
  script:
    - sam build
    - sam package --output-template-file output.yaml --s3-bucket my-bucket-name
    - sam deploy --template-file output.yaml --stack-name sam-test-1 --capabilities CAPABILITY_IAM
  environment: production

My project is in the main repository directory under /lambda_functions/app/ which is also where the above file is along with my template.yaml file.

I’ve tried moving files around to see if they could be found but no luck. I’ve also tried renaming the extension of the template file to .yml instead of .yaml, but that did not make a difference. I have gitlab pointing to the correct .gitlab-ci.yml. All works fine when I deploy locally.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Again, the error is

Error: Template file not found at /builds/.../.../template.yml

>Solution :

You have to change the working directory to the location of your template file.


image: python:3.12

stages:
  - deploy

production:
  stage: deploy
  before_script:
    - pip3 install awscli --upgrade
    - pip3 install aws-sam-cli --upgrade
  script:
    - cd lambda_functions/app
    - sam build
    - sam package --output-template-file output.yaml --s3-bucket my-bucket-name
    - sam deploy --template-file output.yaml --stack-name sam-test-1 --capabilities CAPABILITY_IAM
  environment: production
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading