gitjenkinsbitbucketaws-code-deploybitbucket-aws-code-deploy

Solution for Bitbucket -> pipeline that can build different OSes -> deploy to hardware


Our code is hosted in Bitbucket, originally we wanted to use Bitbucket pipeline to do the build. Since Bitbucket pipeline does not support building windows application, we need to find alternative solution to build.

2 options: 1. Use Jenkins as build server to build 2. Use AWS CodePipeline to build

After code is built, it needs to be downloaded to a system connected with hardware. Thus AWS CodeDeploy to on-premise solution seems the right choice.

Here are the questions: 1. Is the assumption of using AWS CodeDeploy to download applications to on-premise correct? 2. If not correct, what should be the solution?

If using Jenkins pipeline: 3. If using Jenkins for build server, would specifying "Poll SCM" or use GitPlugin be good enough for the connection from Bitbucket to Jenkins pipeline? 4. Would Webhook help for the connection from Bitbucket to Jenkins' pipeline? Does it help in doing something when pull request? 5. How to connect Jenkins to AWS CodeDeploy if #1 assumption is correct?

  1. If using AWS CodePipeline and then CodeDeploy, what are the steps?

Thanks a lot in advance


Solution

  • Here are the answers:

    1. Is the assumption of using AWS CodeDeploy to download applications to on-premise correct?

    Yes

    1. If not correct, what should be the solution?

    CodeDeploy will download application or artifacts on the server where it is running.

    1. If using Jenkins for build server, would specifying "Poll SCM" or use GitPlugin be good enough for the connection from Bitbucket to Jenkins pipeline?

    You can use the BitBucket Jenkins Plugin @ https://wiki.jenkins.io/display/JENKINS/Bitbucket+Plugin

    1. Would Webhook help for the connection from Bitbucket to Jenkins' pipeline? Does it help in doing something when pull request?

    You can look at the plugin documentation to figure out if this feature is supported.

    1. How to connect Jenkins to AWS CodeDeploy if #1 assumption is correct?

    You can use the Jenkins Plugin for CodeDeploy @ https://github.com/awslabs/aws-codedeploy-plugin

    If using AWS CodePipeline and then CodeDeploy, what are the steps?

    If you want to do the orchestration of the build process (e.g. pulling from SCM, building etc.) then you will use CodePipeline. CodePipeline will kick-off as soon as it detects changes in the SCM and then will execute CodeBuild and eventually CodeDeploy to Deploy. You may also end up setting a Notification using EventBus or CloudWatch Events.

    We have a project which has used Jenkins in local server already. To utilize the existing work, creating 4-stage pipeline in AWS

    For the above, you can use the CodeDeploy Plugin in Jenkins to deploy to AWS. You can keep the existing Jenkins environment as is.

    you want to do the orchestration of the build process

    In a build process there are different steps that you would need to execute, e.g. pull from SCM, build/compile, and deploy. Going from one state to another ( pull from sim -> build -> deploy) is called the orchestration of the build process.