我需要为管道编写一个CFT,并将Jenkins集成用于构建/测试。我找到这个文档来为jenkins阶段设置ActionTypeId。但是这个文档没有指定如何设置server url的jenkins服务器。而且,我也不清楚在哪里给Jenkins提供程序命名为。它是在ActionTypeId还是在configuration属性中?
我在互联网上也找不到这个用例的例子。
请为使用AWS Cloudformation模板安装AWS Codepipeline的Jenkins操作提供程序提供一个适当的示例。
下面是我从上面的文档中学到的cft样本中的一节。
"stages": [
{
"name": "Jenkins",
"actions": [
...
{
"name": "Jenkins Build",
"actionTypeId": {
"category": "Build",
"owner": "Custom",
"provider": "Jenkins",
"version": "1"
},
"runOrder": 2,
"configuration": {
???
},
...
}
]
},
...
]发布于 2019-11-14 06:04:17
我所缺少的信息是,我需要创建一个习俗行动来使用Jenkins作为我的codepipeline的Action。
首先,我添加了以下自定义操作:
JenkinsCustomActionType:
Type: AWS::CodePipeline::CustomActionType
Properties:
Category: Build
Provider: !Ref JenkinsProviderName
Version: 1
ConfigurationProperties:
-
Description: "The name of the build project must be provided when this action is added to the pipeline."
Key: true
Name: ProjectName
Queryable: false
Required: true
Secret: false
Type: String
InputArtifactDetails:
MaximumCount: 5
MinimumCount: 0
OutputArtifactDetails:
MaximumCount: 5
MinimumCount: 0
Settings:
EntityUrlTemplate: !Join ['', [!Ref JenkinsServerURL, "/job/{Config:ProjectName}/"]]
ExecutionUrlTemplate: !Join ['', [!Ref JenkinsServerURL, "/job/{Config:ProjectName}/{ExternalExecutionId}/"]]
Tags:
- Key: Name
Value: custom-jenkins-action-typejenkins服务器URL是在自定义操作的
settings中提供的,Jenkins提供程序的名称是为Provider提供的。这是我最初遇到的问题。
然后按照以下方式配置管道阶段:
DevPipeline:
Type: AWS::CodePipeline::Pipeline
DependsOn: JenkinsCustomActionType
Properties:
Name: Dev-CodePipeline
RoleArn:
Fn::GetAtt: [ CodePipelineRole, Arn ]
Stages:
...
- Name: DevBuildVerificationTest
Actions:
- Name: JenkinsDevBVT
ActionTypeId:
Category: Build
Owner: Custom
Version: 1
Provider: !Ref JenkinsProviderName
Configuration:
# JenkinsDevBVTProjectName - Jenkins Job name defined as a parameter in the CFT
ProjectName: !Ref JenkinsDevBVTProjectName
RunOrder: 4必须在管道之前创建自定义操作。因此DependsOn: JenkinsCustomActionType
https://stackoverflow.com/questions/58832506
复制相似问题