Skip to content

Commit

Permalink
Finalize the move to monocdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Elad Ben-Israel committed Feb 28, 2020
1 parent d8f30e5 commit a8fc11f
Show file tree
Hide file tree
Showing 13 changed files with 5,261 additions and 32 deletions.
2 changes: 1 addition & 1 deletion lib/auto-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class AutoBuild extends core.Construct {
});

const publicLogs = props.publicLogs !== undefined ? props.publicLogs : false;
const githubToken = props.repo.tokenSecretArn ? SecretValue.secretsManager(props.repo.tokenSecretArn) : undefined;
const githubToken = props.repo.tokenSecretArn ? core.SecretValue.secretsManager(props.repo.tokenSecretArn) : undefined;

if (publicLogs) {
new serverless.CfnApplication(this, 'GitHubCodeBuildLogsSAR', {
Expand Down
4 changes: 1 addition & 3 deletions lib/open-pgp-key-pair.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// tslint:disable-next-line: max-line-length
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
5 changes: 1 addition & 4 deletions lib/pipeline-watcher/watcher.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// tslint:disable-next-line: max-line-length
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 {
/**
* Code Pipeline to monitor for failed stages
Expand Down
2 changes: 1 addition & 1 deletion lib/repo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { core as core, aws_codebuild as cbuild, aws_codecommit as ccommit,
import { 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";
Expand Down
6 changes: 3 additions & 3 deletions lib/shellable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { aws_cloudwatch as cloudwatch, aws_codebuild as cbuild,
aws_codepipeline as cpipeline, aws_codepipeline_actions as cpipeline_actions,
aws_iam as iam, aws_s3_assets as assets, core as cdk } from
aws_iam as iam, aws_s3_assets as assets, core as cdk, aws_secretsmanager, aws_ssm } from
"monocdk-experiment";
import fs = require("fs");
import path = require("path");
Expand Down Expand Up @@ -246,13 +246,13 @@ export class Shellable extends cdk.Construct {

// Grant read access to secrets
Object.entries(props.environmentSecrets ?? {}).forEach(([name, secretArn]) => {
const secret = Secret.fromSecretArn(this, `${name}Secret`, secretArn);
const secret = aws_secretsmanager.Secret.fromSecretArn(this, `${name}Secret`, secretArn);
secret.grantRead(this.role);
});

// Grant read access to parameters
Object.entries(props.environmentParameters ?? {}).forEach(([name, parameterName]) => {
const parameter = StringParameter.fromStringParameterName(this, `${name}Parameter`, parameterName);
const parameter = aws_ssm.StringParameter.fromStringParameterName(this, `${name}Parameter`, parameterName);
parameter.grantRead(this.role);
});

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
"license": "Apache-2.0",
"dependencies": {},
"devDependencies": {
"@aws-cdk/assert": "1.26.0",
"monocdk-experiment": "1.26.0",
"@monocdk-experiment/assert": "1.26.0",
"@types/jest": "^25.1.3",
"@types/node": "^10.17.13",
"monocdk-experiment": "^1.23.0",
"aws-cdk": "1.23.0",
"@types/node": "^13.7.6",
"aws-cdk": "1.26.0",
"jest": "^25.1.0",
"jest-create-mock-instance": "^1.1.0",
"standard-version": "^7.1.0",
"tslint": "^6.0.0",
"typescript": "~3.8.2"
},
"peerDependencies": {
"monocdk-experiment": "^1.23.0"
"monocdk-experiment": "^1.26.0"
},
"jest": {
"collectCoverage": true,
Expand Down
6 changes: 4 additions & 2 deletions test/bump.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// tslint:disable: max-line-length
import { Stack } from "@aws-cdk/core";
import { core } from "monocdk-experiment";
import { AutoBump, WritableGitHubRepo } from "../lib";
import '@aws-cdk/assert/jest';
import '@monocdk-experiment/assert/jest';

const Stack = core.Stack;

const MOCK_REPO = new WritableGitHubRepo({
sshKeySecret: { secretArn: 'ssh-key-secret-arn' },
Expand Down
2 changes: 1 addition & 1 deletion test/canary.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { aws_events as events, core as cdk } from "monocdk-experiment";
import assert = require("@aws-cdk/assert");
import assert = require("@monocdk-experiment/assert");
import path = require("path");
import { Canary } from "../lib";

Expand Down
15 changes: 7 additions & 8 deletions test/chime-notifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import { core as core, aws_codepipeline as aws_codepipeline, aws_codepipeline_ac
import * as https from "https";
import { codePipeline, handler } from "../lib/chime-notifier/notifier-handler";
import { ChimeNotifier } from "../lib";
import "@aws-cdk/assert/jest";
var { Stack, Construct } = core;
var { Pipeline, IStage, ActionBindOptions, ActionConfig, ActionCategory, Artifact } = aws_codepipeline;
var { ManualApprovalAction, Action } = aws_codepipeline_actions;

import "@monocdk-experiment/assert/jest";
const { Stack } = core;
const { Pipeline, ActionCategory, Artifact } = aws_codepipeline;

jest.mock('https');

Expand Down Expand Up @@ -99,7 +97,7 @@ test('can add to stack', () => {
const stack = new Stack();
const pipeline = new Pipeline(stack, 'Pipe');
pipeline.addStage({ stageName: 'Source', actions: [new FakeSourceAction()] });
pipeline.addStage({ stageName: 'Build', actions: [new ManualApprovalAction({ actionName: 'Dummy' })] });
pipeline.addStage({ stageName: 'Build', actions: [new aws_codepipeline_actions.ManualApprovalAction({ actionName: 'Dummy' })] });

new ChimeNotifier(stack, 'Chime', {
pipeline,
Expand All @@ -110,7 +108,7 @@ test('can add to stack', () => {
expect(stack).toHaveResource('AWS::Lambda::Function');
});

export class FakeSourceAction extends Action {
export class FakeSourceAction extends aws_codepipeline_actions.Action {
constructor() {
super({
actionName: 'Fake',
Expand All @@ -126,7 +124,8 @@ export class FakeSourceAction extends Action {
});
}

protected bound(_scope: Construct, _stage: IStage, _options: ActionBindOptions): ActionConfig {
// tslint:disable-next-line: max-line-length
protected bound(_scope: core.Construct, _stage: aws_codepipeline.IStage, _options: aws_codepipeline.ActionBindOptions): aws_codepipeline.ActionConfig {
return {
configuration: { }
};
Expand Down
2 changes: 1 addition & 1 deletion test/open-pgp-key-pair.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { aws_kms as kms, core as cdk } from "monocdk-experiment";
import assert = require("@aws-cdk/assert");
import assert = require("@monocdk-experiment/assert");
import { OpenPGPKeyPair } from "../lib/open-pgp-key-pair";


Expand Down
3 changes: 2 additions & 1 deletion test/pipeline.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// tslint:disable-next-line: max-line-length
import { aws_codebuild as codebuild, aws_codecommit as codecommit, aws_codepipeline as cpipeline, aws_codepipeline_actions as cpipeline_actions, core as cdk } from "monocdk-experiment";
import { expect as cdk_expect, haveResource, haveResourceLike, SynthUtils } from "@aws-cdk/assert";
import { expect as cdk_expect, haveResource, haveResourceLike, SynthUtils } from "@monocdk-experiment/assert";
import path = require("path");
import delivlib = require("../lib");
import { AddToPipelineOptions, IPublisher } from "../lib";
Expand Down
4 changes: 2 additions & 2 deletions test/shellable.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { core as cdk, core as core } from "monocdk-experiment";
import { expect as assert, haveResource, ResourcePart, SynthUtils } from "@aws-cdk/assert";
import { expect as assert, haveResource, ResourcePart, SynthUtils } from "@monocdk-experiment/assert";
import path = require("path");
import { Shellable, ShellPlatform } from "../lib";
var { Stack } = core;
const { Stack } = core;


// tslint:disable:max-line-length
Expand Down
Loading

0 comments on commit a8fc11f

Please sign in to comment.