4.5 Configure a scripted deployment job

Learning Objectives

By the end of this lesson you will be able to:

Create a scripted deployment job in Jenkins

  1. From the Jenkins dashboard, select the New Job link.
  2. Enter MyDeployment in the Job name field. Click on the Build a free-style software project radio button and click the OK button.
  3. Under the Source Code Management section, select the Git radio button. In the Repository URL field, enter your forked repository URL. Mine is git@github.com:stelligent/devopsinthecloud.git. Yours will be something like:
  4. In the Branches to build | Branch Specifier field, enter master.
  5. Within the Build section, enter the following command in the Execute shell text field.
    instance_ip=`ruby /usr/share/tomcat6/sqs_receive_message.rb Deployment $AWS_ACCESS_KEY $AWS_SECRET_ACCESS_KEY`
    echo $instance_ip
    cd $WORKSPACE/deployment/
    cap deploy:deploy
  6. Click the Save button.
  7. Go back to the Jenkins dashboard and click the Build button next to the MyDeployment job.