|
| 1 | += Working with Snapshots |
| 2 | + |
| 3 | +In {ProductName}, the central resource which is created, tested and released as a single unit is called the Snapshot. |
| 4 | + |
| 5 | +== What is a Snapshot? |
| 6 | +The Snapshot is a custom resource that contains the list of all Components of an {ProductName} 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. |
| 7 | + |
| 8 | +Example Snapshot resource contents:: |
| 9 | +[source] |
| 10 | +---- |
| 11 | +apiVersion: appstudio.redhat.com/v1alpha1 |
| 12 | +kind: Snapshot |
| 13 | +metadata: |
| 14 | + name: snapshot-sample <.> |
| 15 | + namespace: ws-sample-tenant <.> |
| 16 | +spec: |
| 17 | + application: application-sample <.> |
| 18 | + components: |
| 19 | + - name: component-sample <.> |
| 20 | + containerImage: quay.io/redhat-user-workloads/ws-sample-tenant/application-sample/component-sample@sha256:0db0a473a6abf5c15c424ab07cfbd5c40c06622fe648d4fe6a6b6abc224a0d0c <.> |
| 21 | + source: <.> |
| 22 | + git: |
| 23 | + url: https://github.com/sample-org/sample-repo |
| 24 | + revision: fa8b89274a61ef0f1c257b7a84c37aa2ec844109 |
| 25 | +---- |
| 26 | +<.> The name of the Snapshot resource. |
| 27 | +<.> The namespace where the Snapshot exists. It should correspond to the user's tenant namespace. |
| 28 | +<.> The Application that the Snapshot belongs to. |
| 29 | +<.> The name of the individual Component of the Application. |
| 30 | +<.> The full image pull specification for the container image. The images need to be referenced by digest. |
| 31 | +<.> The component source containing the git URL and revision that the component's container image was built from. |
| 32 | + |
| 33 | +== Working with manual Snapshots |
| 34 | + |
| 35 | +Aside from the Snapshots which are created and processed automatically by the {ProductName} services, it is also possible to create manual Snapshots which can then be tested and released if they conform to the users requirements. |
| 36 | + |
| 37 | +== Prerequisites |
| 38 | +- You have completed the steps listed in the xref:/getting-started/cli.adoc[Getting started in the CLI] page. |
| 39 | +- You have an existing managed workspace such as `ws-sample`, an application such as `application-sample` and a component such as `component-sample`. |
| 40 | + |
| 41 | +== Procedures |
| 42 | +To create a manual snapshot, complete the following steps: |
| 43 | + |
| 44 | +. Identify the application and component images which you want tested and released. |
| 45 | +. In your preferred IDE, create a snapshot definition in a `.yaml` file. |
| 46 | +.. For example contents, see the example Snapshot section above. |
| 47 | +. Save the .yaml file and add the snapshot.yaml by running the following command: |
| 48 | ++ |
| 49 | +[source,terminal] |
| 50 | +---- |
| 51 | +$ kubectl create -f snapshot.yaml -n ws-sample-tenant |
| 52 | +---- |
| 53 | +This command adds the Snapshot to your workspace and integration service will test and potentially trigger a release of the Snapshot. |
| 54 | + |
| 55 | +== Verification |
| 56 | +After integration service processes the created manual snapshot, you may verify snapshot and component by the following steps: |
| 57 | + |
| 58 | +. Check if Snapshot passed all tests by getting the `.Status.Conditions.AppStudioTestSucceeded` condition with the following command: |
| 59 | ++ |
| 60 | +[source,terminal] |
| 61 | +---- |
| 62 | +$ kubectl get snapshot snapshot-sample -n ws-sample-tenant -o yaml | yq '.status.conditions.[] | select(.type =="AppStudioTestSucceeded")' |
| 63 | +lastTransitionTime: "2025-01-21T09:18:00Z" |
| 64 | +message: All Integration Pipeline tests passed |
| 65 | +reason: Passed |
| 66 | +status: "True" |
| 67 | +type: AppStudioTestSucceeded |
| 68 | +---- |
| 69 | +. If you have xref:/advanced-how-tos/releasing/create-release-plan.adoc[automatic Releases defined], you can check if Snapshot was auto-released getting the `.Status.Conditions.AutoReleased` condition with the following command: |
| 70 | ++ |
| 71 | +[source,terminal] |
| 72 | +---- |
| 73 | +$ kubectl get snapshot snapshot-sample -n ws-sample-tenant -o yaml | yq '.status.conditions.[] | select(.type =="AutoReleased")' |
| 74 | +lastTransitionTime: "2025-01-21T09:18:01Z" |
| 75 | +message: The Snapshot was auto-released |
| 76 | +reason: AutoReleased |
| 77 | +status: "True" |
| 78 | +type: AutoReleased |
| 79 | +---- |
0 commit comments