Skip to Content

Using Jenkins

I have set up a Jenkins CI (continuous integration) server here: http://anonymous.cs.nmsu.edu:8800/ (Links to an external site.) .

Each of you have an account: the username is either your CS username or your NMSU username, so try the other if the first does not work, and your initial password is your Aggie ID. You can change your password if you like, but I would recommend not using your CS or NMSU password.

We will use Jenkins for a couple of assignments, and you might decide to use it for your project. For these individual assignments, always name your job(s) beginning with your username and an underscore. The view of Jenkins is public to all users, and so if we don’t follow this convention we will all be confused!

There is now an assignment available that requires you to use Jenkins (A3). Jenkins GitHub Repository Access

When creating a Jenkins job, you will need to point it to your GitHub repository. In the “Clone or Download” button on Github, choose the HTTP version of the repository URL and use this in your Jenkins job as the repository URL. Then choose the “joncookta” Github credentials that are listed in Jenkins. I think I have added this account (with read-only access) to your GitHub repository, but I may have missed a couple (I had to do it manually, one at a time). If your Jenkins job cannot gain access to your repo, let me know and I will check it.

The home screen (at login, or by clicking on Jenkins in the upper left) shows a listing of all the projects defined on this Jenkins server, and their current status. You create a new project by clicking on “New Item” and “Freestyle Project” and then filling out all of the details. You can look at my existing projects and scroll through their “configure” settings (but do not change them!), but some of these are much more complicated than your first project needs to be. Your first project does not need to use JUnit or JaCoCo, but it does need to use ant.

Once you have a project, and are at its “home page”, you can inspect it, and inspect its “builds”. If it does not have any yet, or if you made changes and want a new one, click “Build Now”. A “build” is an execution of your project definition, which generally involves checking out your project from a repository, and then running the command(s) to build it, and possibly testing it.

One the lower left of your project page is a list of builds, and you can click on a build to inspect it. On the build page, the “Console Output” selection will give you the raw output of your build, and this is the best source for information when debugging your project definition and build configurations. Ant Use in a Multi-project GitHub Repository

We are using a single GitHub repository for all of our individual assignments. This is non-typical for tools like Jenkins – which expects that a single project lives in a single GitHub repository. How can we handle this? We will do it with two Ant build files – one in your assignment folder that is specific for that assignment, and one that is in your repository root, which will kick off the appropriate assignment build.

Your top-level build.xml file will look something like:

<project name="main" default="assignment2">
  <target name="assignment1">
    <ant dir="assignment1" target="run"/>
  </target>
  <target name="assignment2">
    <ant dir="assignment2" target="test"/>
  </target>
</project>

This top-level file will be used by the Jenkins project, and in its configuration you will specify which target you want built. Ant will then fire off another copy of ant in that subdirectory and with the build target given. It works!

OLD: Do not use: Jenkins Subversion Credentials

When creating your jobs, you need to specify your specific job repository that will be checked out, as a full URL such as “svn://anonymous.cs.nmsu.edu/cs581sp2019/jcook/exsum” for my example job. Then you need to choose access repository credentials. You should just choose the one that lists me “jcook” and names the cs581sp2019 repository. Since I have full repository access, this will enable the Jenkins job to check out your workspace. I have not configured Jenkins to allow you to create your own credentials, and I don’t plan to. I believe that Jenkins does not allow you to see my repository password even though you can select the credentials, but if I am wrong, someone please tell me! :-)