0.0.58 • Published 6 days ago

projen-pipelines v0.0.58

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 days ago

Projen Pipelines

npm version

Projen Pipelines is a projen library that provides high-level abstractions for defining continuous delivery (CD) pipelines for AWS CDK applications. It is specifically designed to work with the projen project configuration engine.

This library provides high-level abstractions for defining multi-environment and multi-account AWS CDK applications with ease. With this library, you can handle complex deployment scenarios with less code and manage your AWS infrastructure in a more efficient and straightforward way.

How Projen Pipelines work

High level Projen Pipelines Overview Under the hood, after you defined the pipeline and selected target engine that you want to work on, we are using code generation methods that will create - in your project - the required CI/CD pipeline.

We are considering to allow selecting multiple engines going forward - please let us know if this is a feature you would use or not!

Getting Started

Installation

To install the package, add the package projen-pipelines to your projects devDeps in your projen configuration file.

After installing the package, you can import and use the constructs to define your CDK Pipelines.

Usage

You can start using the constructs provided by Projen Pipelines in your AWS CDK applications. Here's a brief example:

import { awscdk } from 'projen';
import { CDKPipeline, CDKPipelineOptions } from 'projen-pipelines';

// Define your AWS CDK TypeScript App
const app = new awscdk.AwsCdkTypeScriptApp({
  cdkVersion: '2.80.0',
  name: 'my-awesome-app',
  defaultReleaseBranch: 'main',
  devDeps: [
    'projen-pipelines',
  ],
});

// Create the pipeline
new GithubCDKPipeline(app, {
  stackPrefix: 'MyApp',
  pkgNamespace: '@company-assemblies',
  stages: [
    {
      name: 'dev',
      env: { account: '123456789012', region: 'eu-central-1' },
    }, {
      name: 'prod',
      manualApproval: true,
      env: {account: '123456789012', region: 'eu-central-1' },
    }],
});

After running projen (npx projen) a new file called src/app.ts will be created and contain a specialized CDK App class for your project.

You can then use this in your main.ts to configure your deployment.

import { PipelineApp } from './app';
import { BackendStack } from './stack';

const app = new PipelineApp({
  provideDevStack: (scope, id, props) => {
    return new BackendStack(scope, id, {
      ...props,
      apiHostname: 'api-dev',
      myConfigSetting: 'value-for-dev',
    });
  },
  provideProdStack: (scope, id, props) => {
    return new BackendStack(scope, id, {
      ...props,
      apiHostname: 'api',
      myConfigSetting: 'value-for-prod',
    });
  },
  providePersonalStack: (scope, id, props) => {
    return new BackendStack(scope, id, {
      ...props,
      apiHostname: `api-${props.stageName}`,
      myConfigSetting: 'value-for-personal-stage',
    });
  },
});

app.synth();

Deployment

The <Engine>CDKPipeline class creates and adds several tasks to the projen project that then can be used in your pipeline to deploy your application to AWS.

Here's a brief description of each one:

  1. deploy:personal - This task deploys the application's personal stage, which is a distinct, isolated deployment of the application. The personal stage is intended for personal use, such as testing and development.

  2. watch:personal - This task deploys the personal stage of the application in watch mode. In this mode, the AWS CDK monitors your application source files for changes, automatically re-synthesizing and deploying when it detects any changes.

  3. diff:personal - This task compares the deployed personal stage with the current state of the application code. It's used to understand what changes would be made if the application were deployed.

  4. destroy:personal - This task destroys the resources created for the personal stage of the application.

  5. deploy:feature - This task deploys the application's feature stage. The feature stage is used for new features testing before these are merged into the main branch.

  6. diff:feature - This task is similar to diff:personal, but for the feature stage.

  7. destroy:feature - This task destroys the resources created for the feature stage of the application.

  8. deploy: - This task deploys a specific stage of the application (like 'dev' or 'prod').

  9. diff: - This task compares the specified application stage with the current state of the application code.

  10. publish:assets - This task publishes the CDK assets to all accounts. This is useful when the CDK application uses assets like Docker images or files from the S3 bucket.

  11. bump - This task bumps the version based on the latest git tag and pushes the updated tag to the git repository.

  12. release:push-assembly - This task creates a manifest, bumps the version without creating a git tag, and publishes the cloud assembly to your registry.

Remember that these tasks are created and managed automatically by the CDKPipeline class. You can run these tasks using the npx projen TASK_NAME command.

Contributing

By raising feature requests or issues

Use the Github integrated "Issues" view to create an item that you would love to have added to our open source project.

No request is too big or too small - get your thoughts created and we'll get back to you if we have questions!

By committing code

We welcome all contributions to Projen Pipelines! Here's how you can get started:

  1. Fork the Repository: Click the 'Fork' button at the top right of this page to duplicate this repository in your GitHub account.

  2. Clone your Fork: Clone the forked repository to your local machine.

git clone https://github.com/<your_username>/projen-pipelines.git
  1. Create a Branch: To keep your work organized, create a branch for your contribution.
git checkout -b my-branch
  1. Make your Changes: Make your changes, additions, or fixes to the codebase. Remember to follow the existing code style.

  2. Test your Changes: Before committing your changes, make sure to test them to ensure they work as expected and do not introduce bugs.

  3. Commit your Changes: Commit your changes with a descriptive commit message using conventional commit messages.

git commit -m "feat: Your descriptive commit message"
  1. Push to your Fork: Push your commits to the branch in your forked repository.
git push origin my-branch
  1. Submit a Pull Request: Once your changes are ready to be reviewed, create a pull request from your forked repository's branch into the main branch of this repository.

Your pull request will be reviewed and hopefully merged quickly. Thanks for contributing!

0.0.58

6 days ago

0.0.56

11 days ago

0.0.57

11 days ago

0.0.55

13 days ago

0.0.54

15 days ago

0.0.53

22 days ago

0.0.52

29 days ago

0.0.51

1 month ago

0.0.50

1 month ago

0.0.49

1 month ago

0.0.47

2 months ago

0.0.48

2 months ago

0.0.46

2 months ago

0.0.45

2 months ago

0.0.44

2 months ago

0.0.42

2 months ago

0.0.43

2 months ago

0.0.41

2 months ago

0.0.40

3 months ago

0.0.39

3 months ago

0.0.38

3 months ago

0.0.37

3 months ago

0.0.36

4 months ago

0.0.35

4 months ago

0.0.34

4 months ago

0.0.33

4 months ago

0.0.32

4 months ago

0.0.31

5 months ago

0.0.30

5 months ago

0.0.29

5 months ago

0.0.20

7 months ago

0.0.21

6 months ago

0.0.22

6 months ago

0.0.23

6 months ago

0.0.24

6 months ago

0.0.25

6 months ago

0.0.17

7 months ago

0.0.18

7 months ago

0.0.19

7 months ago

0.0.26

6 months ago

0.0.27

5 months ago

0.0.28

5 months ago

0.0.16

9 months ago

0.0.15

9 months ago

0.0.14

10 months ago

0.0.13

10 months ago

0.0.12

10 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago

0.0.0

11 months ago