AWS文档描述了您如何使用浏览器向Github进行身份验证,以及您当前以有效用户身份登录到Github,该用户对您要从中部署的存储库具有访问权限:
http://docs.aws.amazon.com/codedeploy/latest/userguide/github-integ.html#github-integ-behaviors-auth
有没有办法在不链接我的用户和没有浏览器的情况下设置CodeDeploy?我很乐意在每个存储库和AWS API调用上使用webhooks,但如果有必要的话,我会创建一个Github 'service user‘。
更多示例:http://blogs.aws.amazon.com/application-management/post/Tx33XKAKURCCW83/Automatically-Deploy-from-GitHub-Using-AWS-CodeDeploy
我喜欢在我的repo上使用webhooks,或者自己设置它们,而不是允许AWS访问我Github账户上的每个存储库。
发布于 2016-09-01 17:26:18
在这一点上,除了在浏览器中执行OAuth流之外,似乎没有其他方法可供选择。如果你担心向亚马逊开放你的整个Github账户,创建一个服务用户可能是最好的方法,不幸的是,这个用户似乎仍然需要你的repos的管理权限来设置集成。
发布于 2016-09-02 03:33:22
经过更多的研究,我意识到我的第一个答案是错误的,你可以使用AWS CLI来创建一个使用Github OAuth令牌的CodePipeline。然后,您可以从那里插入您的CodeDeploy部署。下面是一个配置示例:
{
"pipeline": {
"roleArn": "arn:aws:iam::99999999:role/AWS-CodePipeline-Service",
"stages": [
{
"name": "Source",
"actions": [
{
"inputArtifacts": [],
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"version": "1",
"provider": "GitHub"
},
"outputArtifacts": [
{
"name": "MyApp"
}
],
"configuration": {
"Owner": "myusername",
"Repo": "myrepo",
"Branch": "master",
"OAuthToken": "**************"
},
"runOrder": 1
}
]
},
{
"name": "Beta",
"actions": [
{
"inputArtifacts": [
{
"name": "MyApp"
}
],
"name": "CodePipelineDemoFleet",
"actionTypeId": {
"category": "Deploy",
"owner": "AWS",
"version": "1",
"provider": "CodeDeploy"
},
"outputArtifacts": [],
"configuration": {
"ApplicationName": "CodePipelineDemoApplication",
"DeploymentGroupName": "CodePipelineDemoFleet"
},
"runOrder": 1
}
]
}
],
"artifactStore": {
"type": "S3",
"location": "codepipeline-us-east-1-99999999"
},
"name": "MySecondPipeline",
"version": 1
}
}您可以使用以下命令创建管道:
aws codepipeline create-pipeline --cli-input-json file://input.json确保Github OAuth标记具有权限admin:repo_hook和repo。
参考:http://docs.aws.amazon.com/cli/latest/reference/codepipeline/create-pipeline.html
发布于 2016-08-30 06:38:44
CodeDeploy和Github的集成基于Github Oauth。因此,要使用CodeDeploy和Github集成,您必须使用您的github帐户信任CodeDeploy github应用程序。目前,此集成只能在您的浏览器中使用有效的github帐户工作,因为CodeDeploy应用程序将始终重定向回CodeDeploy控制台,以验证并完成OAuth身份验证过程。
https://stackoverflow.com/questions/39101344
复制相似问题