< Previous | Next >

Lesson 4: Creating a source template

A source template is a reusable source code configuration that defines a source-code build type. Source templates can be used by any project that requires the same source type.

Before you begin

Ensure that you installed the Git source-type plug-in before you start this lesson.

About this task

In this lesson, you define a Git source configuration that the tutorial project uses.

Procedure

  1. On the IBM® UrbanCode Build dashboard, click Templates, click Source, and then click Create.
  2. In the New Source Config Template dialog, in the Source Type list, select Git. All installed source-type plug-ins are listed.
  3. Click Select. Fields that are related to the selected source type are displayed.
  4. In the Name field, type GitHub.
  5. In the Working Directory Script list, select Default Workflow Directory.
  6. In the Remote URL field, type ${p:remote.url}. This value refers to a property that you create in the next section. You supply the property value when you configure the project.
  7. In the Remote Name field, type ${p:remote.name}.
  8. In the Branch field, type ${p:branch}.
  9. Click Save.

Results

The GitHub source template is listed along with the other source templates on the Source Templates tab.

Creating properties for the source template

Define the properties that you referred to in the previous section.

Procedure

  1. If the Source tab is not already displayed, then on the IBM UrbanCode Build dashboard, click Templates, click Source, and then click the GitHub source template that you created earlier in the lesson.
  2. Click Properties, and then click Create.
  3. Create the remote.url property by completing these steps.
    1. In the Name field, type remote.url.
    2. In the Label field, type Remote URL. The label text identifies the property to users who use the source template.
    3. In the Display Type list, select Text.
    4. In the Value area, accept the default option, Defined. The Value option determines when and where the value for the property is defined. By selecting Defined, you can provide a value in the Default Value field, or supply the value on the project configuration before the project runs.
    5. Select the Value Required check box.
    6. Leave the Default Value field blank. You define the value when you configure the project.
    7. Click Save.
  4. Create the remote.name property by completing these steps.
    1. In the Properties tab, click Create.
    2. In the Name field, type remote.name.
    3. In the Label field, type Remote Name.
    4. In the Display Type list, select Text.
    5. In the Value area, accept the default option Defined.
    6. Select the Value Required check box.
    7. In the Default Value field, type origin.
    8. Click Save.
  5. Create the branch property by completing these steps.
    1. In the Properties tab, click Create.
    2. In the Name field, type branch.
    3. In the Label field, type Branch.
    4. In the Display Type list, select Text.
    5. In the Value area, accept the default option Defined.
    6. Select the Required check box.
    7. In the Default Value field, type master.
    8. Click Save.

Lesson checkpoint

In this lesson, you created a source template and defined properties that identify the source material that is used in the build.
The GitHub source template properties are shown in this figure:
The GitHub source template properties
< Previous | Next >

Feedback