0.1.0 • Published 2 years ago

@gdsgroup/aws-pipeline v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

aws-pipeline

Provision AWS CodePipeline and CodeBuild Project

Requirements

NameVersion
Pulumi>= 3.8.0, < 4.0.0

Providers

NameVersion
aws>= 3.51.0, < 4.0.0

Inputs

NameDescriptionTypeDefaultRequired
nameThe common name for resources created as part of this modulestringn/ayes
descriptionDescription of the codebuild projectstringn/ano
buildTimeOutNumber in minutes between 5 to 480 (8 hours) until the build times outnumbern/ano
IAMRoleARNThe ARN of the IAM role the pipeline will assumestringn/ano
buildStagesDefine custom build stages for the pipeline. See pipeline referencePipelineStage[]See Example Belowno
codebuildComputeTypeThe computeType of the build containerstringBUILD_GENERAL1_SMALLno
codebuildImageThe codebuild docker imagestringaws/codebuild/standard:5.0no
codebuildEnvironmentVariablesCodebuild Environment variablesProjectEnvironmentEnvironmentVariable[]n/ano
githubRepoThe Github repo to pull the source from in the form of 'org/repo' or 'user/repo'stringn/ayes
githubBranchThe branch to pull source fromstringmainno
pipelineSourceConnectionArnThe ARN of the codestar connection. See: https://www.pulumi.com/registry/packages/aws/api-docs/codestarconnections/connection/stringn/ayes

Outputs

NameDescription
codepipelineBucketThe S3 bucket created by this module
codepipelineThe codepipeline created by this module
codebuildProjectThe codebuild project created by this module

Usage

Note

Ensure your buildspec.yml is in the root of the GitHub repository that you passed to the Input githubRepo (See #Inputs above)

Ensure you have the following set in your environment

export PULUMI_PREFER_YARN=true
export PULUMI_CONFIG_PASSPHRASE=<PASSPHRASE HERE>
export PULUMI_BACKEND_URL=`s3://<PULUMI STATE BUCKET HERE>/<SUB PATH HERE>`
pulumi preview
pulumi up

Debug

pulumi up --logtostderr -v=9 2> out.txt

Examples

Simplest Usage

import { AwsPipeline } from 'gdsgroup/aws-pipeline'
import { codestarconnections } from '@pulumi/aws'

const connection = new codestarconnections.Connection('example', {
    name: 'example',
    providerType: 'GitHub',
});

const demo = new AwsPipeline('example', {
    name: 'example',
    githubRepo: 'org-name/repo-name',
    pipelineSourceConnectionArn: connection.arn,
});

Define Your Own Pipeline Build Stage

import { AwsPipeline } from 'gdsgroup/aws-pipeline'
import { codestarconnections } from '@pulumi/aws'

const connection = new codestarconnections.Connection('example', {
    name: 'example',
    providerType: 'GitHub',
});

const test = new AwsPipeline('example', {
    name: 'example',
    githubRepo: 'org-name/repo-name',
    pipelineSourceConnectionArn: connection.arn,
    buildTimeOut: 90,
    
    buildStages: [
        {
            name: 'Build',
            actions: [
                {
                    name: 'Build',
                    category: 'Build',
                    owner: 'AWS',
                    provider: 'CodeDeploy',
                    inputArtifacts: ['source-output-artifact'],
                    version: '1',
                    runOrder: 2,


                    configuration: {
                        PrimarySource: 'source-output-artifact',
                        ProjectName: codeDeployProjectName,
                    },
                },
            ],
        },
    ],
});

See Pipeline reference

PULUMI_BACKEND_URL=s3://dev-immersify-state-bucket/aws-pipeline