Configuring jobs in Jenkins
Installing WebObjects and Project Wonder
First, you need to have a WebObjects and Project Wonder installation in Jenkins. David Avendasora is providing a sample config file to install and setup Wonder and WebObjects. To install that configuration into Jenkins, do the following:
- Clone the script somewhere:
- Go into the WOJenkinsJobInstallWOAndWOnder directory that was created with the previous command:
- Add the config into Jenkins. You can add it by doing a POST request to Jenkins, like this:
Replace youruser and yourpassword with your Jenkins credentials and replace yourjenkinsserver with the DNS name (or IP address) of your Jenkins installation.
The -user parameter is not required. You can simply remove it if you have no Jenkins user configured.
- Login into Jenkins. You should see a new job called InstallWO. This job will install the WebObjects frameworks (either 5.4.3 or 5.3.3), fetch the Wonder code, compile it and install the Wonder frameworks. It will also create a WOFrameworksRepository directory into Hudson home (on Linux, it's /var/lib/jenkins/ :: On Mac it's Users/Shared/Jenkins/Home ), that directory is where the WebObjects and Wonder frameworks are installed.
- Check the Execute Shell Script task in the Build section of the job configuration in Jenkins to make sure the carriage return was not stripped from between the two scripts when it was imported into Jenkins. The task should look like this:
${WORKSPACE}/WOJenkins/Install/WebObjects/installWebObjects.sh
${WORKSPACE}/WOJenkins/Build/Wonder/WorkspaceSetupScripts/Git/setupWonderWorkspace.sh
not this:
- We need to configure the InstallWO job because it's missing the steps to fetch the Wonder code and some scripts from the WOJenkins repository. Under the Source Code Management section, select Multiple SCMs. Add a Git repository with the following details:
- Repositories: git://github.com/avendasora/WOJenkins.git
- Branches to build: master
- Local subdirectory for repo (in the Advanced section): WOJenkins
- We need to add another Git repository, for Wonder, with the following details:
- Repositories: $WONDERREPOSITORY
- Branches to build: $WONDERGITREFERENCE
- Local subdirectory for repo (in the Advanced section): Wonder
- Save the configuration and start a build of InstallWO. After a couple of minutes, the build should be complete, and in WOFrameworksRepository, the frameworks should be there.
Building an application or a framework
Now that WebObjects and Wonder are installed for Jenkins, you are ready to build an application or framework (or both). Again, we will use a script from David as a startup point.
- Clone the script somewhere:
- Go into the WOJenkinsJobWOProjectGit directory that was created with the previous command:
- Add the config into Jenkins. You can add it by doing a POST request to Jenkins, like this:
Replace youruser and yourpassword with your Jenkins credentials and replace yourjenkinsserver with the DNS name (or IP address) of your Jenkins installation. Replace YourProjectName with the name of the job (ERGroupware, SimpleBlog, whatever your project name is).
We need to make a couple of modifications to the configuration of the new Jenkins job.
- First: delete the PROJECTNAME string parameter. In the steps below, we are going to hardcode the project name in the job configuration.
- One of the SCM repositories is named $PROJECTGITREPOSITORY. Click the Advanced button (see screenshot)
- For Local subdirectory for repo, change the value to Projects/<InsertYourProjectNameHere>, and change the value of Unique SCM name to the name of your project.
- In the Build section, the path to setupWonderProjectWorkspace.sh is wrong. Change it to:
- In the Invoke Ant section, the properties file should be hudson.build.properties, so replace /Root/build.properties with /Root/jenkins.build.properties.
- Click on the Advanced button related to the Ant task. Change the value of Build File to Projects/<InsertYourProjectNameHere>/build.xml, and change the value of Properties to Projects/<InsertYourProjectNameHere>/
You are now readying to build your project with Jenkins Check the console for the job for any errors.
Unknown macro: color. Click on this message for details.
Unknown macro: color. Click on this message for details.
Building frameworks and applications
With the sample configuration, you can also build frameworks and applications at the same time. The trick is to add another SCM repository and another Ant task to the configuration, and for frameworks, the Ant task should call the install task instead of build. The Ant task to build a framework should be called BEFORE the task to build the application