Configuring jobs in Jenkins

Version 47.1 by David LeBer on 2012/01/30 19:08
Warning
For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

Information

Make sure you have the *Git* and *Multiple SCM* plugins in your Jenkins installation before following those instructions

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:
git clone https://github.com/avendasora/WOJenkins_Job_InstallWOAndWOnder.git
  • Go into the WOJenkinsJobInstallWOAndWOnder directory that was created with the previous command:
cd WOJenkins_Job_InstallWOAndWOnder
  • Add the config into Jenkins. You can add it by doing a POST request to Jenkins, like this:
curl -v --user youruser:yourpassword -H "Content-Type: text/xml" -s --data "@config.xml" http://yourjenkinsserver:8080/createItem?name=Install_WO

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:


SafariScreenSnapz143.png

  • InformationNote: If the Git and Multiple SCM plugins were installed when you created the Install_WO job above, the next two steps may not be necessary.
  • 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:
git clone https://github.com/avendasora/WOJenkins_Job_WOProject_Git.git
  • Go into the WOJenkinsJobWOProjectGit directory that was created with the previous command:
cd WOJenkins_Job_WOProject_Git
  • Add the config into Jenkins. You can add it by doing a POST request to Jenkins, like this:
curl -v --user youruser:yourpassword -H "Content-Type: text/xml" -s --data "@config.xml" http://yourjenkinsserver:8080/createItem?name=YourProjectName

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)
    SafariScreenSnapz144.jpg
  • 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:
${WORKSPACE}/WOJenkins/Build/Wonder/WorkspaceSetupScripts/Git/setupWonderWorkspace.sh
  • In the Invoke Ant section, the properties file should be hudson.build.properties, so replace /Root/build.properties with /Root/hudson.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.

Warning

If your project is missing some default folders, like _Libraries_ or _WebServerResources_, woproject won't be able to build the project. Make sure that those directories are in your Git repository.

Unknown macro: color. Click on this message for details.

/var/lib/jenkins/jobs/ERGroupware/workspace/Root/Local/Library/WebObjects/Extensions does not exist.

Unknown macro: color. Click on this message for details.

ln -s /var/lib/jenkins/WOFrameworksRepository/WebObjects/5.4.3/Local/Library/WebObjects/Extensions /var/lib/jenkins/jobs/<NameOfYourProject>/workspace/Root/Local/Library/WebObjects/Extensions

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