我正在尝试构建一个代码管道,以:
我能造罐子(我有第二阶段的工作)。我假设第3阶段将涉及调用sam模板来进行部署。该模板是同一github repo的一部分。
我的问题是:我看不出如何将jar和模板文件提供给第三阶段来进行部署。
我附上以下三个文件以供参考:
1.buildspec.yml
version: 0.2
phases:
install:
commands:
- echo Entered the install phase...
- apt-get update -y
- apt-get install -y maven
build:
commands:
- echo Entered the build phase...
- mvn package
post_build:
commands:
- echo Entered the post_build phase...
artifacts:
files:
- server/harvest/target/harvest-1.0-SNAPSHOT.jar
discard-paths: yes
secondary-artifacts:
cf-config:
files:
- server/aws/sam-app/sam-template.yml
discard-paths: yes
jar-file:
files:
- server/harvest/target/harvest-1.0-SNAPSHOT.jar
discard-paths: yes
2.codepipeline.json
{
"pipeline": {
"name": "<<Name>>",
"roleArn": "arn:aws:iam::xxxxxxxx",
"artifactStore": {
"type": "S3",
"location": "codepipeline-eu-west-1-xxxxxxx"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"provider": "GitHub",
"version": "1"
},
"runOrder": 1,
"configuration": {
"Branch": "master",
"OAuthToken": "****",
"Owner": "<<username>>",
"PollForSourceChanges": "false",
"Repo": "repo-name"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"inputArtifacts": []
}
]
},
{
"name": "Build",
"actions": [
{
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ProjectName": "Harvest"
},
"outputArtifacts": [
{
"name": "BuildArtifact"
}
],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
]
}
]
}
],
"version": 3
},
"metadata": {
"pipelineArn": "arn:aws:codepipeline:eu-west-1:xxxxxxxxx",
"created": 1546780342.845,
"updated": 1547288970.709
}
}
3.sam模板。yml
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS Serverless Spring Boot API - uk.co.pack::harvest
Globals:
Api:
EndpointConfiguration: REGIONAL
Outputs:
HarvestApi:
Description: URL for application
Export:
Name: HarvestApi
Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/ping'
Parameters:
amazonawsaccessKey:
Type: String
amazonawssecretkey:
Type: String
amazondynamodbendpoint:
Type: String
appid:
Type: String
url:
Type: String
Resources:
HarvestRatingsFunction:
Properties:
CodeUri: build/harvest-1.0-SNAPSHOT.jar
Environment:
Variables:
AMAZON_AWS_ACCESSKEY: !Ref 'amazonawsaccessKey'
AMAZON_AWS_SECRETKEY: !Ref 'amazonawssecretkey'
AMAZON_DYNAMODB_ENDPOINT: !Ref 'amazondynamodbendpoint'
IOS_APP_ID: !Ref 'appid'
IOS_URL: !Ref 'url'
Events:
GetResource:
Properties:
Method: any
Path: /{proxy+}
Type: Api
Handler: uk.co.pack.StreamLambdaHandler::handleRequest
MemorySize: 512
Policies: AWSLambdaBasicExecutionRole
Runtime: java8
Timeout: 60
Type: AWS::Serverless::Function
RatingsDbTable:
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
BillingMode: PROVISIONED
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: '1'
WriteCapacityUnits: '1'
TableName: Review
Type: AWS::DynamoDB::Table
Transform: AWS::Serverless-2016-10-31
代码管道中的第三个阶段可能如下所示:
{
"Name": "Deploy",
"Actions": [
{
"Name": "Beta",
"ActionTypeId": {
"Category": "Deploy",
"Owner": "AWS",
"Provider": "CloudFormation",
"Version": 1
},
"Configuration": {
"ActionMode": "CREATE_UPDATE",
"Capabilities": "CAPABILITY_IAM",
"RoleArn": "CloudformationRole.Arn",
"StackName": "Harvest",
"TemplatePath": "BuildOutput::sam-template.yml",
"ParameterOverrides": "{\"appid\": \"${app123456}\", \"url\": \"https://apple.com\"}"
},
"InputArtifacts": [
{
"Name": "BuildOutput"
}
],
"RunOrder": 1
}
]
}
jar和模板在BuildOutput
工件包中可用,因为您在buildspec中指定了它们。yml。只要您将BuildOutput
(或SourceOutput
)作为InputArtifacts
,就可以如上所示使用它们。
我正在使用代码管道部署云形成模板。问题是这个Cloud形成模板有一些嵌套堆栈。嵌套堆栈模板需要在S3存储桶中。所以在触发主(父)CF模板之前,我需要将CF嵌套堆栈上传到S3。 我没有找到使用代码管道实现这一点的方法。 有什么建议吗?
我正在尝试使用代码构建操作在AWS代码管道上部署AWS CDK应用程序。 构建和部署在本地完美工作(因为它会!)但是在CodeBuild上运行时,命令失败 这很可能是一些琐碎的事情,但我却在挠头,想弄明白是什么! 项目结构是自动生成的(使用) 对于阶段是 是(此阶段的输入目录是阶段的工件,即目录) 阶段抛出cdk ls步骤中的错误。由于上面的构建/部署步骤在本地工作(在干净的签出中),我怀疑这可能
基本上,我需要配置CI/CD与比特桶源代码到ECS容器。我想使用CodePipline部署新的ECR映像到ECS。 目前,AWS CodePipline中没有将bitbucket指定为源的选项。然而,我已经设法用webhooks配置了CodeBuild,这样它就可以构建docker文件,并在每次推送发布分支时将其推送到ECR。 我想将ECR配置为CodePipline中的“源”阶段,并将其部署到现
我们已经建立了管道脚本,工作得很好。最近,我们决定使用bitbucket管道自动部署到elastic beanstalk,并遵循使用命令进行部署的教程。显然,此命令在管道上失败。配置文件似乎是合法的,因为它在本地运行。它还可以在管道文件中指定的同一图像的容器中运行,也可以从本地使用docker exec在同一图像的容器中运行命令。下面是管道文件和我们使用命令得到的错误。我显然漏掉了什么。如有任何帮
我试图通过jenkins管道将azure web应用程序部署到azure form git 代码如下所示 这怎么可能?有什么方法可以将git repo url作为参数提供给azure插件吗? 谢了!
它们还提供了一个警告:如果您能够持续部署到测试系统,有时也会使用术语“持续部署”。 这一切让我很困惑。任何更详细的解释(或附带一个例子)都是赞赏的!