Skip to content

Commit

Permalink
feat: switch to MonoCDK (-experiment)
Browse files Browse the repository at this point in the history
Try out the new monocdk to see if it works the way we need it to.

BREAKING CHANGE: to use this version, your application must depend on
`monocdk-experiment`.
  • Loading branch information
Rico Huijbers committed Feb 13, 2020
1 parent ec8c58d commit 9bdc2a7
Show file tree
Hide file tree
Showing 34 changed files with 6,930 additions and 764 deletions.
15 changes: 9 additions & 6 deletions lib/auto-build.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import codebuild = require('@aws-cdk/aws-codebuild');
import serverless = require('@aws-cdk/aws-sam');
import { Construct, Token } from '@aws-cdk/core';
import { BuildEnvironmentProps, createBuildEnvironment } from './build-env';
import { aws_codebuild as codebuild, aws_sam as serverless, core as core } from "monocdk-experiment";
import { BuildEnvironmentProps, createBuildEnvironment } from "./build-env";



const { Token } = core;

import { IRepo } from './repo';

export interface AutoBuildOptions {
Expand Down Expand Up @@ -52,8 +55,8 @@ export interface AutoBuildProps extends AutoBuildOptions {
readonly branch?: string;
}

export class AutoBuild extends Construct {
constructor(scope: Construct, id: string, props: AutoBuildProps) {
export class AutoBuild extends core.Construct {
constructor(scope: core.Construct, id: string, props: AutoBuildProps) {
super(scope, id);

const project = new codebuild.Project(this, 'Project', {
Expand Down
6 changes: 5 additions & 1 deletion lib/build-env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import cbuild = require('@aws-cdk/aws-codebuild');
import { aws_codebuild as cbuild } from "monocdk-experiment";





export interface BuildEnvironmentProps {
computeType?: cbuild.ComputeType;
Expand Down
3 changes: 3 additions & 0 deletions lib/build-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { mapValues, noUndefined } from "./util";




const MAGIC_ARTIFACT_NAME = 'PRIMARY';

/**
Expand Down
16 changes: 8 additions & 8 deletions lib/bump/bump.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import cloudwatch = require('@aws-cdk/aws-cloudwatch');
import cbuild = require('@aws-cdk/aws-codebuild');
import events = require('@aws-cdk/aws-events');
import events_targets = require('@aws-cdk/aws-events-targets');
import cdk = require('@aws-cdk/core');
import { createBuildEnvironment } from '../build-env';
import permissions = require('../permissions');
import { WritableGitHubRepo } from '../repo';
import { aws_cloudwatch as cloudwatch, aws_codebuild as cbuild, aws_events as events, aws_events_targets as events_targets, core as cdk, } from "monocdk-experiment";
import { createBuildEnvironment } from "../build-env";
import permissions = require("../permissions");
import { WritableGitHubRepo } from "../repo";





// tslint:disable:max-line-length

Expand Down
10 changes: 4 additions & 6 deletions lib/canary.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import cloudwatch = require('@aws-cdk/aws-cloudwatch');
import cbuild = require('@aws-cdk/aws-codebuild');
import events = require('@aws-cdk/aws-events');
import events_targets = require('@aws-cdk/aws-events-targets');
import cdk = require('@aws-cdk/core');
import { aws_cloudwatch as cloudwatch, aws_codebuild as cbuild, aws_events as events, aws_events_targets as events_targets, core as cdk } from "monocdk-experiment";
import { Shellable, ShellableProps } from "./shellable";



import { Shellable, ShellableProps } from './shellable';

export interface CanaryProps extends ShellableProps {
/**
Expand Down
15 changes: 5 additions & 10 deletions lib/change-controller.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import cloudwatch = require('@aws-cdk/aws-cloudwatch');
import cp = require('@aws-cdk/aws-codepipeline');
import events = require('@aws-cdk/aws-events');
import events_targets = require('@aws-cdk/aws-events-targets');
import iam = require('@aws-cdk/aws-iam');
import lambda = require('@aws-cdk/aws-lambda');
import s3 = require('@aws-cdk/aws-s3');
import s3_notifications = require('@aws-cdk/aws-s3-notifications');
import cdk = require('@aws-cdk/core');
import path = require('path');
import { aws_cloudwatch as cloudwatch, aws_codepipeline as cp, aws_events as
events, aws_events_targets as events_targets, aws_iam as iam, aws_lambda as
lambda, aws_s3 as s3, aws_s3_notifications as s3_notifications, core as cdk }
from "monocdk-experiment";
import path = require("path");

export interface ChangeControllerProps {
/**
Expand Down
21 changes: 12 additions & 9 deletions lib/chime-notifier/chime-notifier.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { Construct, Duration } from "@aws-cdk/core";
import * as cpipeline from '@aws-cdk/aws-codepipeline';
import * as iam from '@aws-cdk/aws-iam';
import * as lambda from '@aws-cdk/aws-lambda';
import * as events from '@aws-cdk/aws-events';
import * as events_targets from '@aws-cdk/aws-events-targets';
import fs = require('fs');
import { core as core, aws_codepipeline as cpipeline, aws_iam as iam,
aws_lambda as lambda, aws_events as events, aws_events_targets as
events_targets } from "monocdk-experiment";
import fs = require("fs");




const { Duration } = core;

import path = require('path');

/**
Expand Down Expand Up @@ -39,8 +42,8 @@ export interface ChimeNotifierProps {
/**
* Send a message to a Chime room when a pipeline fails
*/
export class ChimeNotifier extends Construct {
constructor(scope: Construct, id: string, props: ChimeNotifierProps) {
export class ChimeNotifier extends core.Construct {
constructor(scope: core.Construct, id: string, props: ChimeNotifierProps) {
super(scope, id);

const message = props.message ?? "/md @All Pipeline **$PIPELINE** failed in action **$ACTION**. Latest change:\n```\n$REVISION\n```\n([Failure details]($URL))";
Expand Down
6 changes: 4 additions & 2 deletions lib/chime-notifier/notifier-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import AWS = require('aws-sdk');
import * as https from 'https';
import AWS = require("aws-sdk");
import * as https from "https";



// export for tests
export const codePipeline = new AWS.CodePipeline();
Expand Down
14 changes: 8 additions & 6 deletions lib/code-signing/certificate-signing-request.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import cfn = require('@aws-cdk/aws-cloudformation');
import lambda = require('@aws-cdk/aws-lambda');
import cdk = require('@aws-cdk/core');
import path = require('path');
import { hashFileOrDirectory } from '../util';
import { RsaPrivateKeySecret } from './private-key';
import { aws_cloudformation as cfn, aws_lambda as lambda, core as cdk } from "monocdk-experiment";
import path = require("path");
import { hashFileOrDirectory } from "../util";
import { RsaPrivateKeySecret } from "./private-key";





export interface CertificateSigningRequestProps {
/**
Expand Down
18 changes: 9 additions & 9 deletions lib/code-signing/code-signing-certificate.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import iam = require('@aws-cdk/aws-iam');
import kms = require('@aws-cdk/aws-kms');
import secretsManager = require('@aws-cdk/aws-secretsmanager');
import ssm = require('@aws-cdk/aws-ssm');
import cdk = require('@aws-cdk/core');
import { ICredentialPair } from '../credential-pair';
import permissions = require('../permissions');
import { DistinguishedName } from './certificate-signing-request';
import { RsaPrivateKeySecret } from './private-key';
import { aws_iam as iam, aws_kms as kms, aws_secretsmanager as secretsManager, aws_ssm as ssm, core as cdk } from "monocdk-experiment";
import { ICredentialPair } from "../credential-pair";
import permissions = require("../permissions");
import { DistinguishedName } from "./certificate-signing-request";
import { RsaPrivateKeySecret } from "./private-key";





export { DistinguishedName } from './certificate-signing-request';

Expand Down
16 changes: 8 additions & 8 deletions lib/code-signing/private-key.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import cfn = require('@aws-cdk/aws-cloudformation');
import iam = require('@aws-cdk/aws-iam');
import kms = require('@aws-cdk/aws-kms');
import lambda = require('@aws-cdk/aws-lambda');
import cdk = require('@aws-cdk/core');
import path = require('path');
import { hashFileOrDirectory } from '../util';
import { CertificateSigningRequest, DistinguishedName } from './certificate-signing-request';
import { aws_cloudformation as cfn, aws_iam as iam, aws_kms as kms, aws_lambda as lambda, core as cdk } from "monocdk-experiment";
import path = require("path");
import { hashFileOrDirectory } from "../util";
import { CertificateSigningRequest, DistinguishedName } from "./certificate-signing-request";





export interface RsaPrivateKeySecretProps {
/**
Expand Down
8 changes: 6 additions & 2 deletions lib/credential-pair.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import secretsManager = require('@aws-cdk/aws-secretsmanager');
import ssm = require('@aws-cdk/aws-ssm');
import { aws_ssm as ssm } from "monocdk-experiment";
import { aws_secretsmanager as secretsManager } from "monocdk-experiment";





/**
* A Credential Pair combines a secret element (the credential) and a public
Expand Down
17 changes: 7 additions & 10 deletions lib/open-pgp-key-pair.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import cfn = require('@aws-cdk/aws-cloudformation');
import iam = require('@aws-cdk/aws-iam');
import kms = require('@aws-cdk/aws-kms');
import lambda = require('@aws-cdk/aws-lambda');
import secretsManager = require('@aws-cdk/aws-secretsmanager');
import ssm = require('@aws-cdk/aws-ssm');
import cdk = require('@aws-cdk/core');
import path = require('path');
import { ICredentialPair } from './credential-pair';
import { hashFileOrDirectory } from './util';
import { aws_cloudformation as cfn, aws_iam as iam, aws_kms as kms, aws_lambda as lambda, aws_secretsmanager as secretsManager, aws_ssm as ssm, core as cdk } from "monocdk-experiment";
import path = require("path");
import { ICredentialPair } from "./credential-pair";
import { hashFileOrDirectory } from "./util";




/**
* The type of the {@link OpenPGPKeyPairProps.removalPolicy} property.
Expand Down
6 changes: 5 additions & 1 deletion lib/permissions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import iam = require('@aws-cdk/aws-iam');
import { aws_iam as iam } from "monocdk-experiment";





/**
* Describe a Secrets Manager secret external to the CDK app
Expand Down
4 changes: 3 additions & 1 deletion lib/pipeline-watcher/watcher-handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import AWS = require('aws-sdk');
import AWS = require("aws-sdk");



// export for tests
export const codePipeline = new AWS.CodePipeline();
Expand Down
17 changes: 7 additions & 10 deletions lib/pipeline-watcher/watcher.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import cloudwatch = require('@aws-cdk/aws-cloudwatch');
import cpipeline = require('@aws-cdk/aws-codepipeline');
import events = require('@aws-cdk/aws-events');
import events_targets = require('@aws-cdk/aws-events-targets');
import iam = require('@aws-cdk/aws-iam');
import lambda = require('@aws-cdk/aws-lambda');
import logs = require('@aws-cdk/aws-logs');
import cdk = require('@aws-cdk/core');
import fs = require('fs');
import path = require('path');
import { aws_cloudwatch as cloudwatch, aws_codepipeline as cpipeline, aws_events as events, aws_events_targets as events_targets, aws_iam as iam, aws_lambda as lambda, aws_logs as logs, core as cdk } from "monocdk-experiment";
import fs = require("fs");
import path = require("path");





export interface PipelineWatcherProps {
/**
Expand Down
44 changes: 20 additions & 24 deletions lib/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
import cloudwatch = require('@aws-cdk/aws-cloudwatch');
import cbuild = require('@aws-cdk/aws-codebuild');
import { BuildEnvironment } from '@aws-cdk/aws-codebuild';
import cpipeline = require('@aws-cdk/aws-codepipeline');
import cpipeline_actions = require('@aws-cdk/aws-codepipeline-actions');
import events = require('@aws-cdk/aws-events');
import events_targets = require('@aws-cdk/aws-events-targets');
import iam = require('@aws-cdk/aws-iam');
import s3 = require('@aws-cdk/aws-s3');
import sns = require('@aws-cdk/aws-sns');
import sns_subs = require('@aws-cdk/aws-sns-subscriptions');
import cdk = require('@aws-cdk/core');
import { AutoBuild, AutoBuildOptions } from './auto-build';
import { createBuildEnvironment } from './build-env';
import { AutoBump, AutoBumpOptions } from './bump';
import { Canary, CanaryProps } from './canary';
import { ChangeController } from './change-controller';
import { PipelineWatcher } from './pipeline-watcher';
import publishing = require('./publishing');
import { IRepo, WritableGitHubRepo } from './repo';
import { Shellable, ShellableProps } from './shellable';
import { determineRunOrder } from './util';
import { ChimeNotifier } from './chime-notifier';
import { aws_cloudwatch as cloudwatch, aws_codebuild as cbuild,
aws_codepipeline as cpipeline, aws_codepipeline_actions as cpipeline_actions,
aws_events as events, aws_events_targets as events_targets, aws_iam as iam,
aws_s3 as s3, aws_sns as sns, aws_sns_subscriptions as sns_subs, core as cdk
} from "monocdk-experiment";
import { AutoBuild, AutoBuildOptions } from "./auto-build";
import { createBuildEnvironment } from "./build-env";
import { AutoBump, AutoBumpOptions } from "./bump";
import { Canary, CanaryProps } from "./canary";
import { ChangeController } from "./change-controller";
import { PipelineWatcher } from "./pipeline-watcher";
import publishing = require("./publishing");
import { IRepo, WritableGitHubRepo } from "./repo";
import { Shellable, ShellableProps } from "./shellable";
import { determineRunOrder } from "./util";
import { ChimeNotifier } from "./chime-notifier";




const PUBLISH_STAGE_NAME = 'Publish';
const TEST_STAGE_NAME = 'Test';
Expand Down Expand Up @@ -158,7 +154,7 @@ export class Pipeline extends cdk.Construct {
private readonly concurrency?: number;
private readonly repo: IRepo;
private readonly dryRun: boolean;
private readonly buildEnvironment: BuildEnvironment;
private readonly buildEnvironment: cbuild.BuildEnvironment;
private readonly buildSpec?: cbuild.BuildSpec;

constructor(parent: cdk.Construct, name: string, props: PipelineProps) {
Expand Down
28 changes: 14 additions & 14 deletions lib/publishing.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import cbuild = require('@aws-cdk/aws-codebuild');
import cpipeline = require('@aws-cdk/aws-codepipeline');
import cpipeline_actions = require('@aws-cdk/aws-codepipeline-actions');
import iam = require('@aws-cdk/aws-iam');
import s3 = require('@aws-cdk/aws-s3');
import cdk = require('@aws-cdk/core');
import path = require('path');
import { ICodeSigningCertificate } from './code-signing';
import { OpenPGPKeyPair } from './open-pgp-key-pair';
import permissions = require('./permissions');
import { AddToPipelineOptions, IPublisher } from './pipeline';
import { WritableGitHubRepo } from './repo';
import { LinuxPlatform, Shellable } from './shellable';
import { noUndefined } from './util';
import { aws_codebuild as cbuild, aws_codepipeline as cpipeline,
aws_codepipeline_actions as cpipeline_actions, aws_iam as iam, aws_s3 as s3,
core as cdk } from "monocdk-experiment";
import path = require("path");
import { ICodeSigningCertificate } from "./code-signing";
import { OpenPGPKeyPair } from "./open-pgp-key-pair";
import permissions = require("./permissions");
import { AddToPipelineOptions, IPublisher } from "./pipeline";
import { WritableGitHubRepo } from "./repo";
import { LinuxPlatform, Shellable } from "./shellable";
import { noUndefined } from "./util";




export interface PublishToMavenProjectProps {
/**
Expand Down
19 changes: 10 additions & 9 deletions lib/repo.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import cbuild = require('@aws-cdk/aws-codebuild');
import ccommit = require('@aws-cdk/aws-codecommit');
import cpipeline = require('@aws-cdk/aws-codepipeline');
import cpipeline_actions = require('@aws-cdk/aws-codepipeline-actions');
import cdk = require('@aws-cdk/core');
import { ExternalSecret } from './permissions';
import { SecretValue } from '@aws-cdk/core';
import { core as core, aws_codebuild as cbuild, aws_codecommit as ccommit,
aws_codepipeline as cpipeline, aws_codepipeline_actions as cpipeline_actions,
core as cdk } from "monocdk-experiment";
import { ExternalSecret } from "./permissions";





export interface IRepo {
repositoryUrlHttp: string;
repositoryUrlSsh: string;
readonly allowsBadge: boolean;
readonly token: SecretValue | undefined;
readonly token: core.SecretValue | undefined;
createBuildSource(parent: cdk.Construct, webhook: boolean, branch?: string): cbuild.ISource;
createSourceStage(pipeline: cpipeline.Pipeline, branch: string): cpipeline.Artifact;
describe(): any;
}

export class CodeCommitRepo implements IRepo {
public readonly allowsBadge = false;
public readonly token: SecretValue | undefined = undefined;
public readonly token: core.SecretValue | undefined = undefined;

constructor(private readonly repository: ccommit.IRepository) {

Expand Down
Loading

0 comments on commit 9bdc2a7

Please sign in to comment.