As a developer, you want to continuously integrate your code from a GitHub repository or a GitLab Enterprise repository. Whenever your developers update their code and commit changes to the repository, Code Stream can listen for those changes, and trigger the pipeline.

The workflow from a code check-in to a deployed application on a Kubernetes cluster can use GitHub, Code Stream, Docker Hub, the trigger for Git, and Kubernetes.

To have Code Stream trigger your pipeline on code changes, you use the Git trigger. Code Stream then triggers your pipeline every time you commit changes to your code.

The Code Stream pipeline workspace supports Docker and Kubernetes for continuous integration tasks and custom tasks.

For more information about configuring the workspace, see Configuring the Pipeline Workspace.

The following flowchart shows the workflow that you can take if you use a smart pipeline template to create your pipeline, or build the pipeline manually.

Figure 1. Workflow that uses a smart pipeline template or creates a pipeline manually
The workflow helps you decide your path through the process that continuously integrates your code by using a continuous integration pipeline.

The following example uses a Docker workspace.

To build your code, you use a Docker host. You use JUnit and JaCoCo as your test framework tools, which run unit tests and code coverage, and you include them in your pipeline.

Then you can use the continuous integration smart pipeline template that creates a continuous integration pipeline that builds, tests, and deploys your code to your project team Kubernetes cluster on AWS. To store the code dependency artifacts for your continuous integration task, which can save time in code builds, you can use a cache.

In the pipeline task that builds and tests your code, you can include several continuous integration steps. These steps can reside in the same working directory where Code Stream clones the source code when the pipeline triggers.

To deploy your code to the Kubernetes cluster, you can use a Kubernetes task in your pipeline. You must then enable and run your pipeline. Then, make a change to your code in the repository, and watch the pipeline trigger. To monitor and report on your pipeline trends after your pipeline runs, use the dashboards.

In the following example, to create a continuous integration pipeline that continuously integrates your code into your pipeline, you use the continuous integration smart pipeline template. This example uses a Docker workspace.

Optionally, you can manually create the pipeline, and add stages and tasks to it. For more information about planning a continuous integration build and manually creating the pipeline, see Planning a CICD native build in Code Stream before manually adding tasks.

Prerequisites

Procedure

  1. Follow the prerequisites.
  2. To create the pipeline by using the smart pipeline template, open the continuous integration smart pipeline template and fill out the form.
    1. Click Pipelines > New Pipeline > Smart Template > Continuous Integration.
    2. Answer the questions in the template about your source code repository, build toolsets, publishing tool, and the build image workspace.
    3. Add Slack notifications or Email notifications for your team.
    4. To have the smart pipeline template create the pipeline, click Create.
    5. To make any further changes to the pipeline, click Edit, make your changes, and click Save.
    6. Enable the pipeline and run it.
  3. To create the pipeline manually, add stages and tasks to the canvas, and include your native continuous integration build information in the continuous integration task.
    1. Click Pipelines > New Pipeline > Blank Canvas.
    2. Click the stage, then drag the several continuous integration tasks from the navigation pane to the stage.
    3. To configure the continuous integration task, click it, and click the Task tab.
    4. Add the steps that continuously integrate your code.
    5. Include the paths to the dependency artifacts.
    6. Add the export location.
    7. Add the test framework tools that you'll use.
    8. Add the Docker host and build image.
    9. Add the container registry, working directory, and cache.
    10. Save the pipeline, then enable it.
  4. Make a change to your code in your GitHub repository or GitLab repository.
    The Git trigger activates your pipeline, which starts to run.
  5. To verify that the code change triggered the pipeline, click Triggers > Git > Activity.
  6. To view the execution for your pipeline, click Executions, and verify that the steps created and exported your build image.
    The pipeline execution displays the path of the preserved artifacts, and the value of the exported image.
  7. To monitor the pipeline dashboard so that you can track KPIs and trends, click Dashboards > Pipeline Dashboards.

Results

Congratulations! You created a pipeline that continuously integrates your code from a GitHub repository or GitLab repository into your pipeline, and deploys your build image.

What to do next

To learn more, see More resources for Code Stream Administrators and Developers.