Skip to main content

Build images from application source

info

Harbor needs to be activated for this lab.

When your team is using Harbor for private image registries, you can build images from source using pre-configured Tekton pipelines using the paketo task or the Kaniko task to build images from application source.

Build the blue image

  1. In the left menu, click on Builds
  2. Click on Create Build
  3. Fill in the name blue for your build and a tag (default tag is latest)
  4. Choose Docker and fill in the repo URL for the blue repo created in the previous lab
  5. Click Submit

Otomi will now create a Tekton Pipeline and PipelineRun resource to build the image. This will take around 15-20 seconds. Then the PipelineRun will start building the image. During this time the status will show in progress:

build status

When the build is finished, the status will show healthy:

build status

To see the full PipelineRun of the build, go to the list of Builds and click on PipelineRun of the blue build. This will open the Tekton Dashboard and show the status of the PipelineRun of the build:

build status

When the build is ready you can see the image in Harbor:

  1. Open Harbor
  2. Click on the project of your team. Here you will see all the registries of the team, including the registry of the new build image

build status

Re-run the build (optional)

To run the build again using Otomi Console, follow these steps:

  1. Change the tag of the build for example to v1.0.0
  2. Submit changes

To re-build the image using the same tag, restart the build pipeline using the Tekton cli in the Shell:

  1. Start a shell in Otomi Console

  2. Get the name of the pipeline

kubectl get pipelines
NAME AGE
docker-build-blue 41h
  1. Get the name of the pipelinerun:
kubectl get pipelineruns
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
docker-build-blue-latest True Succeeded 41h 41h
  1. Start the pipeline using the pipelinerun:
tkn pipeline start docker-build-blue --use-pipelinerun docker-build-blue-latest
PipelineRun started: docker-build-blue-latest-j5mmt
  1. In order to track the PipelineRun progress run:
tkn pipelinerun logs docker-build-blue-latest-j5mmt -f

But it's easier to just open the Tekton dashboard and Click on PipelineRuns.