aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Bug: SAM Quick Start Templates are not working, need fixes

Open cmoutafidis opened this issue 3 years ago • 4 comments

Description:

I am using sam init to create a Hello World Lambda Function and then sam pipeline init --bootstrap to create a Gitlab pipeline for this.

The gitlab-ci.yml and the samconfig.toml need the following changes in order to work:

gitlab-ci.yml

before_script: - apk add --update python3 py-pip python3-dev build-base - apk add libffi-dev - pip install --upgrade pip - pip install awscli aws-sam-cli

samconfig.toml [default.deploy] [default.deploy.parameters] capabilities = "CAPABILITY_IAM" confirm_changeset = ~~true~~ false ~~resolve_s3 = true~~

[default.package] [default.package.parameters] ~~resolve_s3 = true~~

Steps to reproduce:

sam init AWS Quick Start Template First template, Hello World Function name: example

cd example sam pipeline init --bootstrap AWS Quick Start Pipeline Template Gitlab (configure pipelines)

git add . & git commit & git push

Observed result:

Pipelines failing for multiple reason

Expected result:

AWS Lambda would be deployed normally.

I get that AWS is rolling out new changes all the time, but in my POV I believe that maintaining your default templates and making sure that old templates are not breaking should be number 1 priority. In my case, it was not that I wanted to create a new template, but my old template that used to work months ago just sudently stopped working and I could not make any deployments.

cmoutafidis avatar Apr 26 '23 07:04 cmoutafidis

@cmoutafidis Thanks for opening this issue and bringing it our notice! I agree with you on ensuring that we our in-built templates are upto date and working.

If you are open to submitting a PR: https://github.com/aws/aws-sam-cli-pipeline-init-templates/tree/main/Gitlab/two-stage-pipeline-template/%7B%7Bcookiecutter.outputDir%7D%7D is where you could raise a PR. Contributions are welcome!

On the changes themselves, it is mentioned that old templates stopped working. This could be related to a change where init templates come with a default samconfig.toml which resolves s3 buckets on your behalf for better UX. However, https://github.com/aws/aws-sam-cli-pipeline-init-templates/blob/main/Gitlab/two-stage-pipeline-template/%7B%7Bcookiecutter.outputDir%7D%7D/.gitlab-ci.yml#L80 seems to indicate to use a created S3 bucket, I believe this is the root of the problem.

For now, I would ask you to remove the generated samconfig.toml or make the changes you have made above. Since pipelines are generated after initial application is generated, another idea would be to add samconfig.toml to your ignores file.

sriram-mv avatar May 01 '23 05:05 sriram-mv

https://github.com/aws/aws-sam-cli-pipeline-init-templates/pull/68 is a PR in progress.

sriram-mv avatar May 01 '23 22:05 sriram-mv

Closing as the mentioned PR is merged. Feel free to reopen if the issue isn't resolved.

hawflau avatar May 19 '23 23:05 hawflau

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar May 19 '23 23:05 github-actions[bot]