Closed Stewart86 closed 2 years ago
After trying to understand the whole logic of the deploy command and their internals, I have managed to retain the CodePipeline in AWS console to run for my automated CI / CD pipeline.
Just to put it out there so if anyone facing the similar issue, can refer to this. Also, suggest an update on the guide to reflect.
Here is what i found.
sam pipeline init
sam deploy
is executedsam deploy
sam deploy -t codepipeline.yaml
sam pipeline init
sam deploy
but this time with template.yaml
sam deploy
is called, it finds a CloudFormation stack that you indicate and modify when sam deploy
with codepipeline.yaml
template, a CloudFormation stack is created on the fly from your terminal to create the AWS CodePipeline, AWS CodeBuild and any other required resources for CI / CD with the stack name you defined in sam deploy
once it is successfully created/updated, the CodePipeline will run, which includes a creation / updating of the CloudFormation stack you defined during sam pipeline init
however at this step, if you already have a CloudFormation stack with the same name, it will be modified.
In this case, it modified the stack I created for the CI / CD, but CodePipeline is mostly only deleted last, therefore it is removed as soon as it's done with the deployment
The moral of this story is, do not name your stack for sam pipeline init
and sam deploy
the same!
Description:
Following the guide in AWS SAM documentation, step by step created pipeline as instructed in the documentation till the final step where I copied the command from step 4 to connect to CodeCommit, I ran;
I can see that CloudFormation events being generated in the shell (with
Successfully created/updated stack - prod in None
), as well as seeing the CodePipeline being generated and running the deployment stages.However, as soon as the deployment is done, that pipeline is missing from AWS Developer Tool Console.
Shouldn't the pipeline be retained and when a new commit to the branch is merged, it automatically run the pipeline every time? why is my pipeline got removed right after the deployment is done?
Steps to reproduce:
Observed result:
in AWS CodePipeline console, pipeline is removed after a while. Resources seems to be deployed.
Expected result:
in AWS CodePipeline console, pipeline should remain, and when the next branch merge, pipeline will run to update resources.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.50.0Add --debug flag to command you are running