Version 2019-Spring-1.0-Final, Revised 21 April 2019
This exercise is similar to the Continuous Integration Exercise, but takes it one step further and deploys the working code, as a web app running on the Heroku service. Heroku lets you continuously deploy apps as soon as the code has been changed, built, tested, reviewed and merged.
https://github.com/cs-worcester-cs-348-sp-2019/cd-exercise
gradlew clean build
OR
gradle clean build
https://travis-ci.org/cs-worcester-cs-348-sp-2019/cd-exercise/
Be sure to look at the tabs Current
, Branches
, Build History
, and Pull Requests
.
The most current merged build is deployed to https://cs-348-cd-exercise.herokuapp.com/
You do not need to create a Heroku account for this exercise. Just read the information and view the screen shots below.
Heroku requires that you make an account. You can deploy applications for free as long as you are willing to have Heroku shut them down after a period of inactivity. There will be a delay for them to start back up (about 20 seconds). You can keep applications running by paying.
You can connect your Heroku account to a GitHub repository:
And set Heroku to automatically deploy from the master branch (after CI has passed):
The dashboard will show you the status of the latest activity:
The Procfile
is used by Heroku to determine how to run the program:
web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/cs-348-cd-exercise.jar
It is telling Heroku to execute the jar file as a web process, passing it a server port to listen for connections on.
This is the same process as the CI Exercise with the addition of checking the deployed application to see that the changes show up.
I am intentionally not repeating all of the Git and GitHub commands for you here. You should be getting used to what you need to do. If you cannot remember how, do the following steps in order:
- Look at past in-class exercises and homework assignments.
- Ask your classmates for help.
- Ask me for help.
Replace yourname
with your own name.
Based on the last digit of your WSU Student ID, edit the appropriate EndsWith
class. For example, my ID ends with 2
, so I edited the EndsWith2.java
file. Look at EndsWith2.java
as an example for what to do.
Note that I have changed the code to use ,
as a separator between names instead of \n
because of the way the HTML display works.
The test will fail because you have not updated the test file for the class you edited.
Go update the test for the code you just wrote and test again.
Note that I have changed the code to use ,
as a separator between names instead of \n
because of the way the HTML display works.
gradle bootrun
Wait until you see this message:
2019-04-22 07:31:36.712 INFO 33423 --- [ restartedMain] CS_348_SP_2019.CDExercise.Application
: Started Application in 2.603 seconds (JVM running for 3.13)
View the running application on http://localhost:8080
Pull recent changes from your classmates
Resolve any conflicts
Make sure you are pushing to your branch.
Note that you cannot make a pull request until Travis has run your build, and your tests are successful.
https://cs-348-cd-exercise.herokuapp.com/
- Add the change
- Pull any changes that have ocurred since the last pull, and correct merge conflicts
- Commit the change, with a message describing the change.
- Push the change
- Make a pull request to have the change merged into the original repository
- To view hidden files (starting with .) in Bash, type
ls -al
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.