Reputation: 1151
Currently I'm using @aws-cdk/pipelines
package for quick and easy setup of CI/CD for my service.
However during the experimentation/development phase, I would like to manually call cdk deploy
for my stack with business logic components, so the deployment loop would be a lot faster, as I don't need pipeline self-mutation steps and also I don't want to push everything to repository each time.
Unfortunately I'm not able to achieve this. After trying to call manually npx cdk deploy
command in the repository root folder, it's simply deploying the stack, that contains the pipeline resources.
I was also trying to achieve this by calling stack name directly:
npx cdk deploy -c config=dev <full-stack-name>
And it fails with No stacks match the name(s) [...]
message.
Is this possible? I believe it's quite important use case, since deploying through proper CI/CD pipeline takes at least 2-3 minutes and it ruins my focus.
Upvotes: 4
Views: 1525
Reputation: 2400
If you're using Codestar as the source of your pipeline, you can point it toward a specific branch in your repo of choice. Then just commit your code to said branch and this will trigger your pipeline.
I do recommend as other answers however, and keeping your Pipeline Stack and your App stack separate - you can make use of cdk-pipelines to auto update your stack (self mutating) if you desire, but for rapid development having your app as its own stack is best. - not only is it safer, you can use cdk watch now to have it auto deploy changes, skipping the pipeline entirely.
Upvotes: 0
Reputation: 11482
As an alternative to creating a separate app, you can also deploy the stacks directly. To get the stack name, use cdk ls
. It will be <Pipeline Name>/<Stage Name>/<Stack name>
.
Also, you can deploy the whole stage manually with
cdk deploy "<Pipeline Name>/<Stage Name>"
Upvotes: 3
Reputation: 25649
Create a new, plain vanilla app to handle the standalone, non-pipeline deploy scenario:
// bin/dev-app.ts
const app = new cdk.App();
new MyBusinessLogicStack(app, 'DevStack', props)
Tell the CLI to deploy the dev-app
with an explicit app command:
cdk deploy --app 'npx ts-node bin/dev-app.ts'
You now have two "apps": one that deploys the pipeline and the new one that deploys a standalone "business logic stack".
Upvotes: 0