Skip to content

Commit

Permalink
Merge pull request #55 from nateglims/cdk-pipeline
Browse files Browse the repository at this point in the history
Pipeline Example Updates
  • Loading branch information
nateglims committed Aug 15, 2023
2 parents 924942f + 2f6b049 commit c570fa1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
14 changes: 6 additions & 8 deletions demos-pipeline/example/bin/poky-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
import * as cdk from "aws-cdk-lib";
import {
DemoPipelineStack,
RepoKind,
BuildImageDataStack,
BuildImagePipelineStack,
BuildImageRepoStack,
PipelineNetworkStack,
ImageKind,
DistributionKind,
} from "aws4embeddedlinux-cdk-lib";

const app = new cdk.App();

/**
* User Data
*/
/* See https://docs.aws.amazon.com/sdkref/latest/guide/access.html for details on how to access AWS. */
const env = {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION,
Expand All @@ -26,7 +24,7 @@ const env = {
*/
const defaultProps: cdk.StackProps = {
tags: { PURPOSE: "META-AWS-BUILD" },
terminationProtection: false, // TODO: enable.
terminationProtection: false, // TODO: enable or remove.
env,
};

Expand Down Expand Up @@ -57,7 +55,7 @@ const vpc = new PipelineNetworkStack(app, "PipelineNetwork", {
});

/**
* Create a poky pipeline.
* Create a poky distribution pipeline.
*/
new DemoPipelineStack(app, "PokyPipeline", {
...defaultProps,
Expand All @@ -74,12 +72,12 @@ new DemoPipelineStack(app, "QemuDemoPipeline", {
imageRepo: buildImageRepo.repository,
imageTag: ImageKind.Ubuntu22_04,
vpc: vpc.vpc,
layerKind: RepoKind.MetaAwsDemo,
layerRepoName: "qemu-demo-layer-repo",
distroKind: DistributionKind.MetaAwsDemo,
});

/**
* Create a poky pipeline.
* Create a 3rd Party Distribution Pipeline.
*/
// TODO(nateglims): implement
// new DemoPipelineStack(app, "three-p-Pipeline", {
Expand Down
12 changes: 9 additions & 3 deletions demos-pipeline/lib/lib/constructs/source-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@ import { Code, Repository } from "aws-cdk-lib/aws-codecommit";

import * as path from "path";

export enum RepoKind {
/** A Poky Based Repository */
/**
* The kind of Yocto Distribution built.
*/
export enum DistributionKind {
/** A Poky Based Distribution. */
Poky = "poky",
/** The meta-aws Demonstration Distribution. */
MetaAwsDemo = "meta-aws-demo",
}

export interface SourceRepoProps extends cdk.StackProps {
/** The name of the CodeCommit Repository created. */
readonly repoName: string;
readonly kind: RepoKind;
/** The type of distribution to see this repository with. */
readonly kind: DistributionKind;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions demos-pipeline/lib/lib/demo-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
SecurityGroup,
} from "aws-cdk-lib/aws-ec2";
import { Bucket } from "aws-cdk-lib/aws-s3";
import { SourceRepo, RepoKind } from "./constructs/source-repo";
import { SourceRepo, DistributionKind } from "./constructs/source-repo";

/**
* Properties to allow customizing the build.
Expand All @@ -32,7 +32,7 @@ export interface DemoPipelineProps extends cdk.StackProps {
/** VPC where the networking setup resides. */
readonly vpc: IVpc;
/** The type of Layer */
readonly layerKind?: RepoKind;
readonly distroKind?: DistributionKind;
/** A name for the layer-repo that is created. Default is 'layer-repo' */
readonly layerRepoName?: string;
}
Expand Down Expand Up @@ -60,14 +60,14 @@ export class DemoPipelineStack extends cdk.Stack {
const dlFS = this.addFileSystem("Downloads", props.vpc, projectSg);
const tmpFS = this.addFileSystem("Temp", props.vpc, projectSg);

/** Create our CodePipeline Actions. */

const sourceRepo = new SourceRepo(this, "SourceRepo", {
...props,
repoName: props.layerRepoName ?? `layer-repo-${this.stackName}`,
kind: props.layerKind ?? RepoKind.Poky,
kind: props.distroKind ?? DistributionKind.Poky,
});

/** Create our CodePipeline Actions. */

const sourceOutput = new codepipeline.Artifact();
const sourceAction = new codepipeline_actions.CodeCommitSourceAction({
output: sourceOutput,
Expand Down

0 comments on commit c570fa1

Please sign in to comment.