Testing and Releasing a Single Component

By default, Konflux treats applications as a set of dependent components. A example would be frontend and backend components. A user may typically want to build, test, and release these components together to ensure there are compatible.

Applications may also consist of independent components. If a user wants to group components together in an application a failure in one component will normally prevent any components from releasing. In Single Component Mode, however, each component in an application is separated so that one component’s failing Enterprise Contract Policy will not prevent the other components from releasing.

Enabling Single Component Mode

Single component mode works by analyzing the Snapshot that is being used for Integration Tests and Releasing. A Snapshot created due to a single component being built is the only Snapshot type that may be used for this mode.

Enabling Single Component Mode for Enterprise Contract Integration Test Scenarios

Single Component Mode can be enabled either by making a change to the Integration Test Scenario custom resource or by using the UI.

  • Update the custom resource by adding the parameter SINGLE_COMPONENT with a value of true

integration-test-scenario.yaml
spec:
  params:
    - name: SINGLE_COMPONENT
      value: 'true'

You need to apply the change using kubectl

  • Alternatively, you may edit the Integration Test Scenario using the HAC UI as follows:

Editing your Integration Test Scenario

Enabling Single Component Mode for Releases

Single Component Mode can be enabled for Releases by making a change to the ReleasePlanAdmission custom resource.

  • Update the custom resource by adding the field singleComponentMode under .spec.data with a value of true

release-plan-admission.yaml
spec:
  data:
    singleComponentMode: true

You need to apply the change using kubectl

Verifying Test Results and Releases in Single Component Mode

  • Once your changes have been applied, you can verify that the mode is in fact activated.

Verifying Enterprise Contract Integration Test Scenario results

  • Navigate to the logs of your Enterprise Contract Integration Test Scenario pipeline.

  • Locate the reduce step in the log.

  • It should resemble the following output:

[reduce] Single Component mode? true
[reduce] SNAPSHOT_CREATION_TYPE: component
[reduce] SNAPSHOT_CREATION_COMPONENT: comp2
[reduce] Single Component mode is true and Snapshot type is component
[reduce] COMPONENT_COUNT: 1

Verifying Release pipeline logs

  • Navigate to the logs of your Release pipeline.

  • Locate the reduce-snapshot task in the logs.

  • It should resemble the following output:

reduce-snapshot

[prepare] 2024/09/18 14:54:30 Entrypoint initialization

[reduce] 2024/09/18 14:54:31 warning: unsuccessful cred copy: ".docker" from "/tekton/creds" to "/": unable to create destination directory: mkdir /.docker: permission denied
[reduce] Single Component mode? true
[reduce] SNAPSHOT_CREATION_TYPE: component
[reduce] SNAPSHOT_CREATION_COMPONENT: comp2
[reduce] Single Component mode is true and Snapshot type is component
[reduce] COMPONENT_COUNT: 1