CDK Workshopの中で、CodeCommitでリポジトリを作成し、パイプラインを作成しています。
https://catalog.us-east-1.prod.workshops.aws/workshops/10141411-0192-4021-afa8-2436f3c66bd8/ja-JP/2000-typescript-workshop/600-advanced-topics/700-pipelines/730-new-pipeline
ですが、CodeCommitは新規では、リポジトリはもう作成できないです。
なので、GitHubと連携して、パイプラインを構築しようとしています。
cdk.outがルートディレクトリ上に存在しないためビルド中にエラーが発生します。
なので、pipeline-stack.tsに以下のコードを追加しました。
primaryOutputDirectory: 'cdk-workshop/cdk.out',
ですが、未だcdk.outが見つからないとエラーが発生します。
考えられる問題点と解決策を教えてください。
// Directory
/[Repository name]/workshop-cdk/bin/...
/lib/...
/cdk.out/...
...
// pipeline-stack.ts
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import {
CodeBuildStep,
CodePipeline,
CodePipelineSource,
} from 'aws-cdk-lib/pipelines';
import { Pipeline } from 'aws-cdk-lib/aws-codepipeline';
export class WorkshopPipelineStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
/* 必要な情報をコマンドライン引数経由で取得 */
const owner = this.node.tryGetContext('Owner') as string
const repository = this.node.tryGetContext('Repository') as string
const branch = this.node.tryGetContext('Branch') as string
const connectionArn = this.node.tryGetContext('ConnectionArn') as string
// The basic pipeline declaration. This sets the initial structure
// of our pipeline
const pipeline = new CodePipeline(this, 'CodePipeline', {
codePipeline: new Pipeline(this, 'Pipeline', {
restartExecutionOnUpdate: false,
}),
selfMutation: false,
synth: new CodeBuildStep('SynthStep', {
/* GitHubから読み込み */
input: CodePipelineSource.connection(
`${owner}/${repository}`,
`${branch}`,
{
connectionArn: connectionArn,
triggerOnPush: false
}
),
installCommands: ['npm install -g aws-cdk'],
commands: [
'cd cdk-workshop',
'npm ci',
'npm run build',
'npx cdk synth',
],
primaryOutputDirectory: 'cdk-workshop/cdk.out',
}),
});
}
}
// error message
...
[Container] 2024/10/01 09:58:12.308309 Phase complete: BUILD State: SUCCEEDED
[Container] 2024/10/01 09:58:12.308326 Phase context status code: Message:
[Container] 2024/10/01 09:58:12.350697 Entering phase POST_BUILD
[Container] 2024/10/01 09:58:12.352285 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2024/10/01 09:58:12.352298 Phase context status code: Message:
[Container] 2024/10/01 09:58:12.451944 Expanding base directory path: cdk.out
[Container] 2024/10/01 09:58:12.453722 Assembling file list
[Container] 2024/10/01 09:58:12.453737 Expanding cdk.out
[Container] 2024/10/01 09:58:12.455382 Skipping invalid file path cdk.out
[Container] 2024/10/01 09:58:12.455764 Set report auto-discover timeout to 5 seconds
[Container] 2024/10/01 09:58:12.455860 Expanding base directory path: .
[Container] 2024/10/01 09:58:12.457414 Assembling file list
[Container] 2024/10/01 09:58:12.457428 Expanding .
[Container] 2024/10/01 09:58:12.459001 Expanding file paths for base directory .
[Container] 2024/10/01 09:58:12.459012 Assembling file list
[Container] 2024/10/01 09:58:12.459016 Expanding **/*
[Container] 2024/10/01 09:58:12.517114 Found 2 file(s)
[Container] 2024/10/01 09:58:12.517233 Report auto-discover file discovery took 0.061468 seconds
[Container] 2024/10/01 09:58:12.517842 Phase complete: UPLOAD_ARTIFACTS State: FAILED
[Container] 2024/10/01 09:58:12.517856 Phase context status code: CLIENT_ERROR Message: no matching base directory path found for cdk.out
no matching base directory path found for cdk.out