我正在从Jenkins 1.x迁移到Jenkins2。我想使用Jenkinsfile构建和部署应用程序。我能够构建gradle应用程序,但是对于使用Jenkinsfile通过AWS Codedeploy部署应用程序感到困惑。
这是我的jenkinsfile
node {
// Mark the code checkout 'stage'....
stage 'Checkout'
// Get some code from a GitHub repository
git branch: 'master',
credentialsId: 'xxxxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxx',
url: 'https://github.com/somerepo/someapplication.git'
// Mark the code build 'stage'....
stage 'Build'
// Run the gradle build
sh '/usr/share/gradle/bin/gradle build -x test -q buildZip -Pmule_env=aws-dev -Pmule_config=server'
stage 'Deploy via Codedeploy'
//Run using codedeploy agent
}
我搜索了许多教程,但是他们使用的是AWS Code deploy插件。您能否帮助我使用Jenkinsfile通过AWS Codedeploy部署应用程序?
谢谢。
或者,您可以使用AWS CLI命令进行代码部署。这涉及两个步骤。
步骤1-将部署捆绑包推入S3存储桶。请参阅以下命令:
aws --profile {profile_name} deploy push --application-name {code_deploy_application_name} --s3-location s3://<s3_file_path>.zip
哪里:
步骤2-启动代码部署第二个命令用于触发代码部署。请参阅以下命令:
aws --profile {profile} deploy create-deployment --application-name {code_deploy_application_name} --deployment-group-name {code_deploy_group_name} --s3-location bucket={s3_bucket_name},bundleType=zip,key={s3_bucket_zip_file_path}
哪里:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句