Working with Snapshots

In Konflux, the central resource which is created, tested and released as a single unit is called the Snapshot.

What is a Snapshot?

The Snapshot is a custom resource that contains the list of all Components of an Konflux Application with their Component Image digests and their sources. Once created, the list of Components with their images is immutable. The Integration service updates the status of the resource to reflect the testing outcome. The Release service releases the contents of the Snapshot via Release pipelines.

Example Snapshot resource contents
apiVersion: appstudio.redhat.com/v1alpha1
kind: Snapshot
metadata:
  name: snapshot-sample (1)
  namespace: ws-sample-tenant (2)
spec:
  application: application-sample (3)
  components:
    - name: component-sample (4)
      containerImage: quay.io/redhat-user-workloads/ws-sample-tenant/application-sample/component-sample@sha256:0db0a473a6abf5c15c424ab07cfbd5c40c06622fe648d4fe6a6b6abc224a0d0c (5)
      source: (6)
        git:
          url: https://github.com/sample-org/sample-repo
          revision: fa8b89274a61ef0f1c257b7a84c37aa2ec844109
1 The name of the Snapshot resource.
2 The namespace where the Snapshot exists. It should correspond to the user’s tenant namespace.
3 The Application that the Snapshot belongs to.
4 The name of the individual Component of the Application.
5 The full image pull specification for the container image. The images need to be referenced by digest.
6 The component source containing the git URL and revision that the component’s container image was built from.

Working with manual Snapshots

Aside from the Snapshots which are created and processed automatically by the Konflux services, it is also possible to create manual Snapshots which can then be tested and released if they conform to the users requirements.

Prerequisites

  • You have completed the steps listed in the Getting started in the CLI page.

  • You have an existing managed workspace such as ws-sample, an application such as application-sample and a component such as component-sample.

Procedures

To create a manual snapshot, complete the following steps:

  1. Identify the application and component images which you want tested and released.

  2. In your preferred IDE, create a snapshot definition in a .yaml file.

    1. For example contents, see the example Snapshot section above.

  3. Save the .yaml file and add the snapshot.yaml by running the following command:

    $ kubectl create -f snapshot.yaml -n ws-sample-tenant

    This command adds the Snapshot to your workspace and integration service will test and potentially trigger a release of the Snapshot if you have automatic Releases defined.

Verification

You may verify the status of your Snapshot with the following steps:

  1. Check if Snapshot passed all tests by getting the .Status.Conditions.AppStudioTestSucceeded condition with the following command:

    $ kubectl get snapshot snapshot-sample -n ws-sample-tenant -o yaml | yq '.status.conditions.[] | select(.type =="AppStudioTestSucceeded")'
    lastTransitionTime: "2025-01-21T09:18:00Z"
    message: All Integration Pipeline tests passed
    reason: Passed
    status: "True"
    type: AppStudioTestSucceeded
  2. You can check if Snapshot was auto-released getting the .Status.Conditions.AutoReleased condition with the following command:

    $ kubectl get snapshot snapshot-sample -n ws-sample-tenant -o yaml | yq '.status.conditions.[] | select(.type =="AutoReleased")'
    lastTransitionTime: "2025-01-21T09:18:01Z"
    message: The Snapshot was auto-released
    reason: AutoReleased
    status: "True"
    type: AutoReleased