Assumptions:

  • You have created a Jenkins server in AWS according to these instructions
  • You have a “jenkins-regression-test” repository with a build script ready for ANT to run (borrow ours [here] if you like!)

Instructions:

  1. Use a browser on a bastion to connect to your Jenkins server as installed earlier and login
  2. Click New item (near top left)
  3. Supply a name
  4. Select Freestyle project
  5. Click OK
  6. Pick Git under source code management
  7. Cut and paste your repository URL (use https://bitbucket.org/<TeamName>/jenkins-regression-test.git or similar for testing)
    1. Examine the files in this repository and note what additional resources you may need to create, eg an RDS instance, for the build test to run correctly
    2. Create those additional resources with the correct security groups and note the relevant connection details (eg a public address to an RDS, user/password)
  8. Ignore the error, and click add credentials
  9. Select user name and password (default) and enter your bitbucket username and password (better if this is a generic read-only account)
  10. From the Credentials drop-down, select the credentials you just created
  11. Scroll down to Build Triggers, click “Poll SCM” and enter H/5 * * * * (which is modified cron syntax.  H/5 means roughly every 5 minutes optimised to reduce load spikes)
  12. Click Add build step under Build and Select Invoke ANT
  13. Pick an ANT version (not the default, that doesn’t seem to work)
  14. Click post-build actions dropdown under Post-build Actions and select email notification
  15. Click both check boxes and enter the project leader’s email address
  16. Click Save
  17. Click Build Now on the left-hand menu to verify.
    1. When it fails, update the build files in the testing repository to reference the resources (ie RDS) created above, and push these changes (example here)
    2. Hopefully, after a little while you’ll get a friendly email from Jenkins to say your build is “back to normal”

Where to next?

Now you have a working continuous integration environment and can link it to a repository, it’s time to build something cool!