在基于詹金斯,码头工人和Artifactory的一个CI管道,我的分量建成,集装箱,然后刊登了以下id来artifactory的部署特定的神器版本AWS ECS:如何在没有硬编码的ID在Cloudformation模板
docker.artifacts.mycompany.com/my-component:{Unix时间戳}
詹金斯的最后一个阶段,然后还标记,神器与 “最新” 标签:
docker.artifacts.mycompany.com/my-component:latest
通过这个Cloudformation模板,这个标签允许AWS ECS拿起神器(标记为 “最新”)并进行部署:
Parameters:
SourceInstanceRole:
Type: String
Description: The IAM role that the my-component instance will use
Default: Jenken-Automation
ImageRepository:
Type: String
Description: The name of the Docker repository which holds my-component Docker images
Default: docker.artifacts.mycompany.com
ImageName:
Type: String
Description: The name of the Docker image for my-component
Default: my-component
ImageVersion:
Type: String
Description: The version tag of my-component docker image in Artifactory
Default: latest
MyComponentTaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Volumes:
- Name: no-volume
ContainerDefinitions:
- Name: !Ref ContainerName
Essential: true
Memory: !Ref Memory
MemoryReservation: !Ref MemoryReservation
Image: !Sub ${ImageRepository}/${ImageName}:${ImageVersion}
我需要摆脱这种方式,因为我希望能够指定任何版本的部署工件 - 而不是“最新”。我的问题是:
如何在未对Cloudformation模板中的图像版本进行硬编码的情况下触发将特定工件版本部署到ECS?
例如为:docker.artifacts.mycompany.com/my-component:1500436061