diff --git a/lib/__tests__/auto-build.test.ts b/lib/__tests__/auto-build.test.ts index fa7b6cf3..de5733b2 100644 --- a/lib/__tests__/auto-build.test.ts +++ b/lib/__tests__/auto-build.test.ts @@ -14,7 +14,7 @@ beforeEach(() => { test('webhooks are enabled by default', () => { new AutoBuild(stack, 'AutoBuild', { repo: new GitHubRepo({ - repository: 'some-repo', + repository: 'some-owner/some-repo', tokenSecretArn: 'arn:aws:secretsmanager:someregion:someaccount:secret:sometoken', }), }); @@ -38,7 +38,7 @@ test('webhooks are enabled by default', () => { test('webhooks for a single branch', () => { new AutoBuild(stack, 'AutoBuild', { repo: new GitHubRepo({ - repository: 'some-repo', + repository: 'some-owner/some-repo', tokenSecretArn: 'arn:aws:secretsmanager:someregion:someaccount:secret:sometoken', }), branch: 'banana', @@ -77,7 +77,7 @@ test('webhooks for a single branch', () => { test('webhooks for multiple branches', () => { new AutoBuild(stack, 'AutoBuild', { repo: new GitHubRepo({ - repository: 'some-repo', + repository: 'some-owner/some-repo', tokenSecretArn: 'arn:aws:secretsmanager:someregion:someaccount:secret:sometoken', }), branches: ['banana', 'grapefruit'], @@ -116,7 +116,7 @@ test('webhooks for multiple branches', () => { test('can disable webhooks', () => { new AutoBuild(stack, 'AutoBuild', { repo: new GitHubRepo({ - repository: 'some-repo', + repository: 'some-owner/some-repo', tokenSecretArn: 'arn:aws:secretsmanager:someregion:someaccount:secret:sometoken', }), webhook: false, @@ -133,7 +133,7 @@ test('can disable webhooks', () => { test('can enable artifacts', () => { new AutoBuild(stack, 'AutoBuild', { repo: new GitHubRepo({ - repository: 'some-repo', + repository: 'some-owner/some-repo', tokenSecretArn: 'arn:aws:secretsmanager:someregion:someaccount:secret:sometoken', }), artifacts: Artifacts.s3({ diff --git a/lib/repo.ts b/lib/repo.ts index 94dc81f5..2ee1ea8d 100644 --- a/lib/repo.ts +++ b/lib/repo.ts @@ -106,6 +106,9 @@ export class GitHubRepo implements IRepo { constructor(props: GitHubRepoProps) { const repository = props.repository; + if (repository.indexOf('/') == -1) { + throw new Error('Repository must be of the form "account/repo"'); + } const [owner, repo] = repository.split('/'); this.owner = owner; diff --git a/package.json b/package.json index 7169f6aa..974e9c41 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@typescript-eslint/parser": "^8", "adm-zip": "^0.5.16", "aws-cdk": "2.168.0", - "aws-cdk-lib": "2.150.0", + "aws-cdk-lib": "^2.150.0", "commit-and-tag-version": "^12", "constructs": "10.1.31", "esbuild": "^0.24.0", @@ -77,7 +77,7 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "aws-cdk-lib": "2.150.0", + "aws-cdk-lib": "^2.150.0", "constructs": "^10.1.31" }, "dependencies": { diff --git a/yarn.lock b/yarn.lock index 3018c90e..3195fe12 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,21 +10,29 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@aws-cdk/asset-awscli-v1@^2.2.202": - version "2.2.207" - resolved "https://registry.yarnpkg.com/@aws-cdk/asset-awscli-v1/-/asset-awscli-v1-2.2.207.tgz#c145967f88db58065369929084a39629c6f99306" - integrity sha512-5oRh5Ad7hGSqwM3+/X8MmIkUjBMGU9sd1g+pa3L0s8IL15OQcFW0ZT0gsUdEb/N/JV663jUUpSbtD7pLO65O4Q== +"@aws-cdk/asset-awscli-v1@^2.2.208": + version "2.2.212" + resolved "https://registry.yarnpkg.com/@aws-cdk/asset-awscli-v1/-/asset-awscli-v1-2.2.212.tgz#dd93cdd383d9b97a8dfeac32c08d9d68488cda38" + integrity sha512-7WqbnWUkBBcAzEdfRrpz6sCOheUPf4JEUdGvzJ4EEufXeT7v7nRbRmTvUBbQ+OQlCv9UrVj9XuFxKPjkvneGMQ== -"@aws-cdk/asset-kubectl-v20@^2.1.2": +"@aws-cdk/asset-kubectl-v20@^2.1.3": version "2.1.3" resolved "https://registry.yarnpkg.com/@aws-cdk/asset-kubectl-v20/-/asset-kubectl-v20-2.1.3.tgz#80e09004be173995e91614e34d947da11dd9ff4d" integrity sha512-cDG1w3ieM6eOT9mTefRuTypk95+oyD7P5X/wRltwmYxU7nZc3+076YEVS6vrjDKr3ADYbfn0lDKpfB1FBtO9CQ== -"@aws-cdk/asset-node-proxy-agent-v6@^2.0.3": +"@aws-cdk/asset-node-proxy-agent-v6@^2.1.0": version "2.1.0" resolved "https://registry.yarnpkg.com/@aws-cdk/asset-node-proxy-agent-v6/-/asset-node-proxy-agent-v6-2.1.0.tgz#6d3c7860354d4856a7e75375f2f0ecab313b4989" integrity sha512-7bY3J8GCVxLupn/kNmpPc5VJz8grx+4RKfnnJiO1LG+uxkZfANZG3RMHhE+qQxxwkyQ9/MfPtTpf748UhR425A== +"@aws-cdk/cloud-assembly-schema@^38.0.1": + version "38.0.1" + resolved "https://registry.yarnpkg.com/@aws-cdk/cloud-assembly-schema/-/cloud-assembly-schema-38.0.1.tgz#cdf4684ae8778459e039cd44082ea644a3504ca9" + integrity sha512-KvPe+NMWAulfNVwY7jenFhzhuLhLqJ/OPy5jx7wUstbjnYnjRVLpUHPU3yCjXFE0J8cuJVdx95BJ4rOs66Pi9w== + dependencies: + jsonschema "^1.4.1" + semver "^7.6.3" + "@aws-crypto/crc32@5.2.0": version "5.2.0" resolved "https://registry.yarnpkg.com/@aws-crypto/crc32/-/crc32-5.2.0.tgz#cfcc22570949c98c6689cfcbd2d693d36cdae2e1" @@ -2638,23 +2646,24 @@ available-typed-arrays@^1.0.7: dependencies: possible-typed-array-names "^1.0.0" -aws-cdk-lib@2.150.0: - version "2.150.0" - resolved "https://registry.yarnpkg.com/aws-cdk-lib/-/aws-cdk-lib-2.150.0.tgz#c5fb37f824e645dc7663f001eda7950bb09ec53d" - integrity sha512-A5dJ6iIAXlkSgUIKhhSd5slEjvDBiREv6/xw8CgrXU+puoFULu5bC0SOQARjTzcsAgAVtxdlaZ7qy7u9It7nHQ== +aws-cdk-lib@^2.150.0: + version "2.169.0" + resolved "https://registry.yarnpkg.com/aws-cdk-lib/-/aws-cdk-lib-2.169.0.tgz#555e5adf078ef5816070d5a822586044fcd1337f" + integrity sha512-JBwXMZNkXLCyIJmyK6HcA5UDaYYmJhQ0+ZmE10uTgNTqo/7lZpXYyQYES0SWGM4XrR18lFcH73RmHSAaoEyQhw== dependencies: - "@aws-cdk/asset-awscli-v1" "^2.2.202" - "@aws-cdk/asset-kubectl-v20" "^2.1.2" - "@aws-cdk/asset-node-proxy-agent-v6" "^2.0.3" + "@aws-cdk/asset-awscli-v1" "^2.2.208" + "@aws-cdk/asset-kubectl-v20" "^2.1.3" + "@aws-cdk/asset-node-proxy-agent-v6" "^2.1.0" + "@aws-cdk/cloud-assembly-schema" "^38.0.1" "@balena/dockerignore" "^1.0.2" case "1.6.3" fs-extra "^11.2.0" - ignore "^5.3.1" + ignore "^5.3.2" jsonschema "^1.4.1" mime-types "^2.1.35" minimatch "^3.1.2" punycode "^2.3.1" - semver "^7.6.2" + semver "^7.6.3" table "^6.8.2" yaml "1.10.2" @@ -4375,7 +4384,7 @@ iconv-lite@0.6.3: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -ignore@^5.2.0, ignore@^5.3.1: +ignore@^5.2.0, ignore@^5.3.1, ignore@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== @@ -6075,7 +6084,7 @@ semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.2, semver@^7.6.3: +semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==