Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit 91d1dc5

Browse files
authored
docs(cas-backends): reference docs (#140)
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
1 parent ecac6d6 commit 91d1dc5

File tree

9 files changed

+160
-109
lines changed

9 files changed

+160
-109
lines changed

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ That said, there are [benefits](/reference/operator/contract#runner-context) for
2424

2525
#### Does Chainloop store my Artifacts and Attestation metadata?
2626

27-
No. They are stored in [your OCI Registry](/getting-started/setup#add-oci-repository).
27+
No. They are stored in [your Content-Addressable Storage (CAS)](/reference/operator/cas-backend).

docs/getting-started/setup.md

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -3,107 +3,4 @@ sidebar_position: 2
33
title: Account Setup
44
---
55

6-
import Tabs from "@theme/Tabs";
7-
import TabItem from "@theme/TabItem";
8-
import CodeBlock from "@theme/CodeBlock";
9-
10-
The attestation metadata and artifacts created by your workflows are **not stored in Chainloop but instead pushed to your [OCI registry](https://github.com/opencontainers/distribution-spec)**. That's why to have a fully functional Chainloop account, an OCI repository must be added.
11-
12-
## Add OCI repository
13-
14-
Setup your OCI repository by executing
15-
16-
```bash
17-
$ chainloop config set-oci-repo --repo [REPO_URI] \
18-
--username [USERNAME] \
19-
--password [PASS]
20-
```
21-
22-
Examples:
23-
24-
<Tabs>
25-
<TabItem value="gar" label="Google Artifact Registry" default>
26-
27-
```bash
28-
# Using json-based service account
29-
# https://console.cloud.google.com/iam-admin/serviceaccounts
30-
31-
$ chainloop config set-oci-repo \
32-
# i.e us-east1-docker.pkg.dev/my-project/chainloop-cas-devel
33-
--repo [region]-docker.pkg.dev/[my-project]/[my-repository] \
34-
--username _json_key \
35-
--password "$(cat service-account.json)"
36-
```
37-
38-
</TabItem>
39-
40-
<TabItem value="github" label="GitHub packages" default>
41-
42-
```bash
43-
# Using personal access token with write:packages permissions
44-
# https://github.com/settings/tokens
45-
46-
$ chainloop config set-oci-repo \
47-
# i.e ghcr.io/chainloop-dev/chainloop-cas
48-
--repo ghcr.io/[username or org]/[my-repository] \
49-
--username [username] \
50-
--password [personal access token]
51-
```
52-
53-
</TabItem>
54-
<TabItem value="dockerhub" label="DockerHub" default>
55-
56-
```bash
57-
# Create a personal access token at
58-
# https://hub.docker.com/settings/security
59-
60-
$ chainloop config set-oci-repo \
61-
--repo index.docker.io/[username] \
62-
--username [username] \
63-
--password [personal access token]
64-
```
65-
66-
</TabItem>
67-
<TabItem value="ecr" label="AWS Container Registry" default>
68-
69-
:::caution
70-
**AWS Container Registry is not supported yet**.
71-
:::
72-
73-
</TabItem>
74-
</Tabs>
75-
76-
### Give it a try
77-
78-
If everything went well, you should be able to upload and download artifact materials, let's give it a try
79-
80-
```bash title="Upload a file to your OCI repository"
81-
$ chainloop artifact upload -f myfile
82-
myfile@sha256:c5cc0a2c712497c29f29c3ba11e7fcc0c3cc725ab591720db595e5d6469f3f37 ... done! [1.03KB in 0s; 5.48KB/s]
83-
```
84-
85-
```bash title="Download by content digest (sha256)"
86-
$ chainloop artifact download -d sha256:c5cc0a2c712497c29f29c3ba11e7fcc0c3cc725ab591720db595e5d6469f3f37
87-
INF downloading file name=myfile to=/tmp/myfile
88-
INF file downloaded! path=/tmp/myfile
89-
```
90-
91-
## Review configuration
92-
93-
You can check your current context at any time by running
94-
95-
```bash
96-
$ chainloop org describe
97-
┌──────────────────────────────────────────────────────────────────────────────────────┐
98-
│ Current Context │
99-
├───────────────────┬──────────────────────────────────────────────────────────────────┤
100-
│ Logged in as │ miguel@chainloop.dev │
101-
├───────────────────┼──────────────────────────────────────────────────────────────────┤
102-
│ Organization ID │ fe1c7a81-089a-4473-8084-4f963395be0d │
103-
│ Organization name │ Miguel's main org │
104-
├───────────────────┼──────────────────────────────────────────────────────────────────┤
105-
│ OCI repository │ europe-west1-docker.pkg.dev/redacted**********6622/chainloop-cas │
106-
└───────────────────┴──────────────────────────────────────────────────────────────────┘
107-
```
108-
109-
Everything looks good, we are all set!
6+
Your Chainloop organization is now ready, let's [define our first Workflow](/getting-started/workflow-definition).

docs/getting-started/workflow-definition.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,19 @@ Save the following token since it will not printed again:
176176
177177
We have everything we need to integrate our CI with Chainloop!
178178
179-
## Third-Party integrations
179+
## Optional setup
180+
181+
### CAS Backend
182+
183+
As part of an attestation process, you might want to collect different pieces of evidence such as Software Bill Of Materials (SBOMs), test results, runner logs, etc and then attach them to the final in-toto attestation.
184+
185+
By default, Chainloop comes pre-configured with what we call an `inline` backend. The inline backend **embeds** the pieces of evidence in the resulting attestations.
186+
This is useful to get started quickly but since the metadata is embedded in the attestation, their size is limited.
187+
188+
We recommend that once you get closer to a production-ready setup, you [switch to a more robust backend](/reference/operator/cas-backend#oci-registry).
189+
190+
Refer to [CAS Backends section](/reference/operator/cas-backend) for more information.
191+
192+
### Third-Party integrations
180193
181194
Optionally you can enable third-party integrations such as [DependencyTrack](/guides/dependency-track) so the received Software Bill Of Materials (SBOMs) are forwarded there for analysis.

docs/guides/dependency-track/dependency-track.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Chainloop can be configured to **automatically send any [CycloneDX Software Bill
1616

1717
<Image img={require("./overview-dark.png")} className="dark-mode-only" />
1818

19-
If you have defined in your [Workflow Contract](/reference/operator/contract) a material of type `SBOM_CYCLONEDX_JSON`. This SBOM file, **in addition to being stored in your OCI registry, will be sent to Dependency-Track**.
19+
If you have defined in your [Workflow Contract](/reference/operator/contract) a material of type `SBOM_CYCLONEDX_JSON`. This SBOM file, **in addition to being stored in your [CAS Backend](/reference/operator/cas-backend), will be sent to Dependency-Track**.
2020

2121
<CodeBlock language="yaml" title="skynet.contract.yaml">
2222
{ContractYAML}

docs/guides/sbom-management/sbom-management.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ And shortly after, add it to the previously initialized attestation process.
9292
chainloop att add --name sbom-cdx --value sbom.cyclonedx.json
9393
```
9494

95-
When you execute this command, it will perform two actions. Firstly, it will upload the SBOMS to a Content Addressable Storage in OCI repository that you added during the account setup. Secondly, it will verify that the content is indeed a CycloneDX.
95+
When you execute this command, it will perform two actions. Firstly, it will upload the SBOMS to a [Content Addressable Storage backend](../../reference/operator/cas-backend) that you added during the account setup. Secondly, it will verify that the content is indeed a CycloneDX.
9696

9797
### Attest and send the SBOM to Chainloop
9898
We send SBOMs to Chainloop for storage and additional analysis whenever we release a new version of our docs.
53.6 KB
Loading
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
sidebar_position: 2
3+
title: Content Addressable Storage (CAS) backend
4+
---
5+
6+
import Image from "@theme/IdealImage";
7+
import Tabs from "@theme/Tabs";
8+
import TabItem from "@theme/TabItem";
9+
import CodeBlock from "@theme/CodeBlock";
10+
11+
As part of an attestation process, you might want to collect different pieces of evidence such as Software Bill Of Materials (SBOMs), test results, runner logs, etc and then attach them to the final in-toto attestation.
12+
13+
Chainloop helps with this process by providing a Content Addressable Storage API proxy that:
14+
15+
- **Abstracts away the underlying storage backend**. Currently, we support OCI registries as storage backends but you can expect blob storage, Artifactory and other storage backends to be supported in the future.
16+
- Makes sure that the pieces of evidence are stored **in a tamper-proof manner**. This is achieved by storing the evidences named after their SHA256 content digest, which is calculated by the client, verified by the CAS server.
17+
- **Enables support of large pieces of evidence** since the content digest reference is what will be stored in the attestation.
18+
19+
<Image img={require("./cas-backend.png")} className="light-mode-only" />
20+
<Image img={require("./cas-backend-dark.png")} className="dark-mode-only" />
21+
22+
23+
## Manage backends
24+
25+
You can setup as many CAS backends as you want, but you can only have **one enabled as default at the time**. This **default backend will be used** during the attestation process **to store the pieces of evidence**.
26+
27+
In Chainloop, CAS backends can be managed with the `chainloop cas-backend` command.
28+
29+
30+
```bash
31+
$ chainloop cas-backend ls
32+
┌─────────────────────────────────┬──────────┬─────────────────────────────────────┬───────────────┬─────────┐
33+
│ LOCATION │ PROVIDER │ DESCRIPTION │ LIMITS │ DEFAULT │
34+
├─────────────────────────────────┼──────────┼─────────────────────────────────────┼───────────────┼─────────┤
35+
│ │ INLINE │ Embed artifacts content in the atte │ MaxSize: 500K │ false
36+
│ │ │ station (fallback) │ │ │
37+
├─────────────────────────────────┼──────────┼─────────────────────────────────────┼───────────────┼─────────┤
38+
│ ghcr.io/cyberdyne/chainloop-lab │ OCI │ │ MaxSize: 100M │ true
39+
└─────────────────────────────────┴──────────┴─────────────────────────────────────┴───────────────┴─────────┘
40+
```
41+
42+
## Backend providers
43+
44+
:::info
45+
New CAS Backends will be added over time. If yours is not implemented yet, please [let us know](https://chainloop.dev/contact)
46+
:::
47+
48+
### Inline (fallback)
49+
50+
Chainloop comes pre-configured with what we call an `inline` backend.
51+
52+
The inline backend **embeds** the pieces of evidence in the resulting attestations. This is useful to get started quickly but since the metadata is embedded in the attestation, its max size is limited.
53+
54+
We recommend that once you get closer to a production-ready setup, you switch to a more robust backend such as an OCI registry.
55+
56+
57+
### OCI registry
58+
59+
#### Add a new OCI registry backend
60+
61+
<Tabs>
62+
<TabItem value="gar" label="Google Artifact Registry" default>
63+
64+
```bash
65+
# Using json-based service account
66+
# https://console.cloud.google.com/iam-admin/serviceaccounts
67+
68+
$ chainloop cas-backend add oci \
69+
# i.e us-east1-docker.pkg.dev/my-project/chainloop-cas-devel
70+
--repo [region]-docker.pkg.dev/[my-project]/[my-repository] \
71+
--username _json_key \
72+
--password "$(cat service-account.json)" \
73+
--default
74+
```
75+
76+
</TabItem>
77+
78+
<TabItem value="github" label="GitHub packages" default>
79+
80+
```bash
81+
# Using personal access token with write:packages permissions
82+
# https://github.com/settings/tokens
83+
84+
$ chainloop cas-backend add oci \
85+
# i.e ghcr.io/chainloop-dev/chainloop-cas
86+
--repo ghcr.io/[username or org]/[my-repository] \
87+
--username [username] \
88+
--password [personal access token] \
89+
--default
90+
```
91+
92+
</TabItem>
93+
<TabItem value="dockerhub" label="DockerHub" default>
94+
95+
```bash
96+
# Create a personal access token at
97+
# https://hub.docker.com/settings/security
98+
99+
$ chainloop cas-backend add oci \
100+
--repo index.docker.io/[username] \
101+
--username [username] \
102+
--password [personal access token] \
103+
--default
104+
```
105+
106+
</TabItem>
107+
<TabItem value="ecr" label="AWS Container Registry" default>
108+
109+
:::caution
110+
**AWS Container Registry is not supported yet**.
111+
:::
112+
113+
</TabItem>
114+
</Tabs>
115+
116+
#### Rotate credentials
117+
118+
```bash
119+
chainloop cas-backend update oci --id [BACKEND_ID] --username [NEW_USERNAME] --password [NEW_PASSWORD]
120+
```
121+
122+
#### Set as default
123+
124+
```bash
125+
chainloop cas-backend update oci --id [BACKEND_ID] --default=true
126+
```
127+
128+
## Give it a try
129+
130+
If everything went well, you should be able to upload and download artifact materials, let's give it a try
131+
132+
```bash title="Upload a file to your OCI repository"
133+
$ chainloop artifact upload -f myfile
134+
myfile@sha256:c5cc0a2c712497c29f29c3ba11e7fcc0c3cc725ab591720db595e5d6469f3f37 ... done! [1.03KB in 0s; 5.48KB/s]
135+
```
136+
137+
```bash title="Download by content digest (sha256)"
138+
$ chainloop artifact download -d sha256:c5cc0a2c712497c29f29c3ba11e7fcc0c3cc725ab591720db595e5d6469f3f37
139+
INF downloading file name=myfile to=/tmp/myfile
140+
INF file downloaded! path=/tmp/myfile
141+
```
47.7 KB
Loading

examples/contracts/sbom/cyclonedx.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
schemaVersion: v1
22
materials:
3-
# SBOMs will be uploaded to your OCI registry and referenced in the attestation
3+
# SBOMs will be uploaded to the CAS Backend of your choice, such as an OCI registry and referenced in the attestation
44
# Additionally they can be sent to any downstream integration for analysis
55
# i.e https://docs.chainloop.dev/guides/dependency-track/
66
- type: SBOM_CYCLONEDX_JSON

0 commit comments

Comments
 (0)