-
Notifications
You must be signed in to change notification settings - Fork 12
/
pipeline-container-image.ts
30 lines (25 loc) · 1.02 KB
/
pipeline-container-image.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import ecs = require('@aws-cdk/aws-ecs');
import cdk = require('@aws-cdk/cdk');
import ecr = require('@aws-cdk/aws-ecr');
export class PipelineContainerImage extends ecs.ContainerImage {
public readonly imageName: string;
private readonly repository: ecr.IRepository;
private parameter?: cdk.CfnParameter;
constructor(repository: ecr.IRepository) {
super();
this.imageName = repository.repositoryUriForTag(new cdk.Token(() => this.parameter!.stringValue).toString());
this.repository = repository;
}
public bind(containerDefinition: ecs.ContainerDefinition): void {
this.repository.grantPull(containerDefinition.taskDefinition.obtainExecutionRole());
this.parameter = new cdk.CfnParameter(containerDefinition, 'PipelineParam', {
type: 'String',
});
}
public get paramName(): string {
return new cdk.Token(() => this.parameter!.logicalId).toString();
}
public toRepositoryCredentialsJson(): ecs.CfnTaskDefinition.RepositoryCredentialsProperty | undefined {
return undefined;
}
}