CONTROLLED DATA
Leidos Proprietary - US Citizens ONLY
The information contained herein is proprietary to Leidos, Inc. It may not be used, reproduced, disclosed, or exported without the written approval of Leidos.

A project using Bamboo for its CI/CD pipeline will have been provided with a build plan cloned from the PBC Build Agent Template. This article outlines the steps necessary to modify this template to create a PBC suitable for use in an application Maven build pipeline. 

Step-by-step guide


Step
1

Locate the cloned build plan in the Bamboo project. For example, HMT Maven Build Agent.

2

Click on the Configure plan icon in the center of the right most column.

3

Click on the Build Agent link under Default Stage in Plan Contents.

4

Click on the Docker tab.

5

This items on this page typically should not have to be changed. However, note the following items:

  1. Run this job in
    The Per Build Container (PBC) plugin selection means that the build job will run inside of a Docker PBC.
  2. Docker Image
    This points to the PBC image that will be pulled from the Artifactory Docker registry to host the build.
  3. Agent Size
    The default resource value is usually sufficient.
  4. Additional Containers
    This points to the Docker-in-Docker image that is used as the Docker registry for the build. The default resource value is sufficient.

6

Click on the Plan Configuration link at the upper left of the navigation pane.

7

Update the values as appropriate under the Plan details tab.

8Click on the Variables tab.
9

Edit and save the following variables with the appropriate values:

  • ARTIFACTORY_USERNAME
    The project specific service account name.
  • ARTIFACTORY_PASSWORD
    The project specific service account password.
  • ARTIFACTORY_REPO
    The project specific target repository.
  • ARTIFACTORY_GENERIC_REPO
    The project specific resources repository.
  • PBC_BUILD_AGENT
    The desired name of the PBC.

NOTE: It may be the case that special characters in the password may need to be escaped with a backslash, i.e. '\'. This may be dependent on the client used for a particular task. In this case, create another variable called ARTIFACTORY_PASSWORD_ESC, escape the special characters and modify the affected tasks accordingly.

10Click the Repository task.
11Click Add repository.

12Click Bitbucket Server / Stash.

13Provide a Name for the repository.

14Select SDO Bitbucket from the Server dropdown.
15Locate the Repository. This repository is the location of the Dockerfile source code from which the PBC will be built. Note that the name will be different than that in the screenshot.
16For now leave the Branch as the default, i.e. master.
17Click Save Repository.
18Click on the Stages tab.

19Click on the Build Agent link under Default Stage.

20Click on the Source Code Checkout task

21Uncheck Disable this task.


22Verify that the selected Repository is the repository that was created in the repository creation step.
23Click Save.
24

Click on the JFrog CLI Login command task.

This task logs the JFrog CLI into Artifactory.

25Uncheck Disable this task.

26Click Save.
27

Click on the Download Resource command task.

This task uses the JFrog CLI to download resources directly from Artifactory. It depends on the previous login task.

Hint: Use this task as a template to create other tasks to download all the resources necessary to build the PBC.

28

Change the Task description as appropriate.

29Uncheck Disable this task.
30Change the Argument field to correspond to the path of the actual resource being downloaded.
31Click Save.
32

Click on the Docker Login command task.

This task logs into the project-specific Artifactory repository where the PBC will eventually be uploaded.

33Change the Task description as appropriate.

34Uncheck Disable this task.
35The Argument field can be left as is.
36Click Save.
37

Click on the Docker Login - sdo-docker-public command task.

This task logs into the public SDO Docker Artifactory repository that hosts the base Docker images from which every SDO tenant PBC must extend.

38

Leave the Task description field as is.

39Uncheck Disable this task.
40Leave the Argument field as is.
41Click Save.
42

Click on the Docker Build task.

This task builds the PBC using the Docker plugin task.

43

Uncheck Disable this task and do not edit any other fields.

Note the Environment variables field. This variable points to the Docker registry in the Docker-inDocker container (i.e. the DinD) described in Step 5.

44Click Save.
45

OPTIONAL: Click on the Docker Tag command task.

The only purpose of this task is to add an additional 'latest' tag to the versioned image built in the previous step. This may or may not be desirable and will be governed by how a project chooses to tag its Docker images. This task is therefore included as a demonstration of how to use Bamboo plugins to accomplish this task should such an extra step be warranted. Note that if this task is enabled, that it should be used in conjunction with the Push By Latest Docker task described in the next section.

46OPTIONAL: Uncheck Disable this task and do not edit the other fields.

47OPTIONAL: Click Save.
48

OPTIONAL: Click on the Push By Latest Docker task.

This task is a corollary of the preceding task. If a project chooses to use both an explicit version tag and a 'latest' tag, then both tags should be pushed to Artifactory.

49OPTIONAL: Uncheck Disable this task.

50OPTIONAL: If this task is used, update the username and password with the credentials of the project service account.
51OPTIONAL: Click Save.
52

Click on the JFrog CLI - Push by version command task.

This task and the remaining other JFrog CLI tasks must be used to meet the SDO security and quality control requirements necessary to migrate a project PBC to the SDO docker repository where it will subsequently be used in project specific application builds. Specifically, this task is a prerequisite for the following JFrog CLI - Publish build-info task which pushes the 'build-info' metadata required to perform an Xray scan.

53Uncheck Disable this task.

54Leave all other fields unchanged.
55Click Save.
56

Click on JFrog CLI - Publish build-info task.

As described in the previous section this task pushes the 'build-info' metadata required to perform the Xray scan which is initiated in the final step..

57Uncheck Disable this task.

58Leave all other fields unchanged.
59Click Save.
60

Click on the JFrog CLI - Xray scan task.

This task initiates the Xray scan that, in addition to a code review, forms the basis of the security and quality control requirements necessary to migrate a project PBC to the SDO Docker repository where it can be used in project specific application builds.

61Uncheck Disable this task.

62Leave all other fields unchanged.
63Click Save.
64In the upper right of the Bamboo page, select Run → Run plan.

65

The plan should successfully execute. If any problems are encountered, inspect the logs and contact the SDO Service Desk for further assistance.