Creating a Hudson/Jenkins build definition

You can create a Hudson/Jenkins build definition that links to a Hudson/Jenkins project that is hosted on the Hudson or Jenkins server.

Before you begin

You created a Hudson/Jenkins build engine and a Hudson/Jenkins project, such as a free-style project that runs the Windows dir command through a Windows batch command.

About this task

You can set Hudson/Jenkins build definition options, such as Jazz Source Control or Post-build Deliver. However, the build definition does not automatically run the options. You must configure the Hudson/Jenkins build to run build definition options by using Ant tasks, such as teamAccept and teamFetch, or by using a Hudson/Jenkins plug-in for Engineering Workflow Management.

Procedure

  1. In the Team Artifacts view, expand the project folder.
  2. Right-click Builds; then click New Build Definition.
  3. In the New Build Definition wizard, on the New Build Definition page, accept the defaults settings and click Next.
  4. On the General Information page, in the Available build templates pane, select Hudson/Jenkins Build, and then click Next.
  5. Optional: If you use source control, on the Pre-build page, select Jazz Source Control and click Next.
  6. Optional: On the Post-Build page, to automatically deliver components to a stream based on build status, select Post-build Deliver and click Next.
  7. On the Additional Configuration page, ensure that all of the options are selected and then click Finish.
  8. In the Build Definition editor, on the Overview page, in the Supporting Build Engines area, click Add.
  9. In the Add Build Engines window, select the appropriate Hudson/Jenkins build engine and click OK.
  10. Click the Hudson/Jenkins tab.
  11. Click Get Jobs, and then define a Hudson/Jenkins job to run.
  12. Optional: To schedule builds:
    1. Click the Schedule tab.
    2. To enable build scheduling, under Schedule, select Enabled.
    3. Click Add.
    4. In the Build Time pane, specify either continuous build intervals in minutes, or a specific build time.
    5. In the Build Days pane, select the days of the week that the build runs.
  13. Optional: If you selected Jazz Source Control in Step 5, complete the following steps:
    Note: Ensure that the build definition refers to a dedicated build workspace, rather than the team stream, so that builds are isolated from ongoing changes in the stream.
    1. Click the Jazz Source Control tab.
    2. To specify a repository workspace, in the Build workspace pane, click Create.
    3. In the New Repository Workspace Wizard, on the Select a stream page, select Flow with a stream and in the lower pane, select the repository stream that you want to build from.
      This selection enables the repository workspace to accept changes from the stream.
    4. Click Next.
    5. On the New Repository Workspace page, in the Repository Workspace Name field, rename the repository workspace and click Next.
    6. On the Read Access Permission page, select the read access permissions for the repository workspace.
    7. On the Components to Add page, ensure that your component is selected.
    8. Ensure that the Load repository workspace after creation check box is cleared and click Finish.
    9. To specify a build user for the build workspace, in the Workspace Owner dialog box, click Open Workspace.
    10. In the Repository Workspace editor, in the Owned by field, browse to the location of your special-purpose build user.
    11. Click Save.
    12. In the Build Definition editor, in the Load Options pane, in the Load directory field, type the path to the directory on the build machine where workspace files should be loaded.
    13. Select the appropriate option to load the workspace.
      • Do a full load – Deletes the contents of the load directory and fetches all the files from the workspace in every build.
      • Do an incremental load – Does not delete the load directory before loading. Fetches only modified files from the repository, reverts local changes and deletes untracked files.
      • Do an optimized incremental load – Does not delete the load directory before loading. Fetches only modified files from the repository, ignores local changes and untracked files.
        • When you select the Do an optimized incremental load option, the following build goes through a full load if the build is loading the workspace for the first time. Otherwise, the build goes through an incremental load. Optimized incremental load happens from the next build.
        • Optimized incremental load is not supported in personal builds. The first regular build after a personal build goes through an incremental load and the builds following that would go through an optimized incremental load.
        • For a large workspace size, optimized incremental load is much faster than a regular incremental load.
        • You can confirm if an optimized incremental load happened in a build by looking for the following message in the build log – Invoking optimized incremental load.
        Note:

        The option to Do a full load and Do an incremental load replace the Delete the directory before loading option. The Do a full load option is selected by default for older build definitions, created before EWM release 7.0.1, where the Delete the directory before loading option is selected. The Do an incremental load option is selected by default for older build definitions where the Delete the directory before loading option is not selected.

    14. Optional: To define a subset of component files and folders for the build to load, select Load components by using a load rule file and then select a load rule file. When a load rule file is specified, only those components for which the load rules are specified are loaded according to the rules.
      Note: The Load Policy field is not displayed for build definitions that were created by using earlier client versions. If you select the Switch to the new format for loading components check box, the load policy user interface is displayed.
    15. Optional: To build only if changes are delivered to a build stream, select Build only if there are changes accepted. This option is only applicable for scheduled builds.
      Tip: To set up a continuous integration build, set the build schedule to run at an interval, such as every 5 minutes, and ensure that the Build only if there are changes accepted option is selected. If no changes are accepted when the scheduled build runs, the build is deleted.
    16. Optional: The Components to exclude option can be used to restrict which components are loaded during the build.
    17. Optional: The flow targets of the build workspace can be scoped to include only specific components from the target stream(s). Only these components are considered in the pre-build check for whether there are Engineering Workflow Management source control changes to build. Also, the snapshot for the build includes only these components. For more information, see Flow targets.
  14. Click Save.

What to do next

After you start the Hudson/Jenkins build engine, you can request a Hudson/Jenkins build and view the build results.