Skip to content

Latest commit

 

History

History
210 lines (147 loc) · 6.66 KB

workshop3.md

File metadata and controls

210 lines (147 loc) · 6.66 KB

S-DOEA - Workshop 3 - Jenkins - CI Workshop

Pre-requisite

Setup Jenkins before creating new build job

  1. Launch internet browser, navigate to the link below. Login using the credential provided as below:-
  • Jenkins Server (AWS) - Take note do use your own AWS jenkins server
    • url : http://<your aws public ip>/jenkins/


Create an Ant Project Job

  1. Fork the following git repository https://github.com/kenken64/StackAnnotation to your own Github Account


  1. Clone the codes down to your local working directory. Replace <your username> with your own Github username.
git clone https://github.com/<your username>/StackAnnotation
  1. Go to Jenkins, configure a new freestyle job as per the screenshot. Name your job item as "StackAnnotation_your initial"


  1. Enter task description as 'This is a StackAnnotation ant build'

  2. Tick the Github Project option then enter the url as <your StackAnnotation github repo url>



  1. Under source code management, select Git then enter the repository URL as <your StackAnnotation github repo url>. Change the branch to be build to '*/development'


  1. Configure poll interval for the source code retrieval to be used as new build. Check Github hook trigger for GITScm polling and polling SCM. Configure the polling schedule as * * * * * (Polling every minute, feel free to change to your desire scheduling timing)


  1. Configure the pre build step, add invoke ant step then select Ant version as 'Ant' follow by targets as build


  1. Before configure this step. Run the build manually with the step 8 configured and saved. Once the manual trigger build is successful proceed with configure the post build action where it will generate Junit published report from the ant build


  1. The build will trigger automatically



11. Lets make changes to the test case and invalidate the build. the build on jenkins will fail. Under the file test/test/MyStringStackTest.java under the testPush method right after the instantiation of the MyStringStack class. Before making changes to the test case, kindly checkout to the development branch within the project working directory
$ cd  StackAnnotation
$ git checkout development
MyStringStack stack = new MyStringStack();
stack.push (s1);
assertTrue (stack.isEmpty());
  1. Commit the changes to the github.
git add .
git commit -m "fail the test case"
git push origin development
  1. The outcome of the build will be unstable






Create a Maven Project Job

  1. Fork the following git repository https://github.com/kenken64/StackAnnotationMaven.git to your own Github Account


  1. Clone the codes down to your local working directory. Replace <your username> with your own Github username.
git clone https://github.com/<your username>/StackAnnotationMaven.git

Change directory to the working directory and switch to the development branch

cd StackAnnotationMaven
git checkout development
  1. Go to Jenkins, configure a new freestyle job as per the screenshot. Name your job item as "StackAnnotationMaven_your initial"


  1. Enter task description as 'This is a StackAnnotation Maven build'

  2. Tick the Github Project option then enter the url as <your StackAnnotationMaven github repo url>



  1. Under source code management, select Git then enter the repository URL as 'your StackAnnotationMaven github repo url'. Change the branch to be build to '*/development'


  1. Check the poll interval for the source code retrieval to be used as new build. Check Github hook trigger for GITScm polling and polling SCM. Configure the polling schedule as * * * * * (Polling every minute, feel free to change to your desire scheduling timing)


  1. Configure the pre build step, add top-level Maven step then select Maven version as 'Maven' follow by entering goals as surefire-report:report. Refer to https://maven.apache.org/surefire/maven-surefire-report-plugin/usage.html


  1. Lastly, configure the post build action where it will generate Junit published report from the maven build. Enter 'target/surefire-reports/TEST-sg.edu.nus.StackAnnotation.AppTest.xml' to the test report XML field.


  1. The build will trigger automatically



  1. Before making changes to the code switch to the development branch. Lets make changes to the test case and invalidate the build. Under the file AppTest.java line 18 change the code to as below
assertTrue( false );
  1. Commit the changes to the github.
git add .
git commit -m "fail the test case"
git push origin development
  1. The outcome of the build will be unstable. Status of the build will be flag out as amber.