Skip to content

Commit

Permalink
chore: update artifacts.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzzzzzzz committed Mar 21, 2024
1 parent f70eb31 commit 07836a5
Showing 1 changed file with 61 additions and 13 deletions.
74 changes: 61 additions & 13 deletions docs/artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ Artifacts provide a way to track the origin of data produced and consumed within
## Artifact Provenance Data
Artifacts fall into two categories:

- Inputs: Artifacts downloaded and used by a Task.
- Outputs: Artifacts created and uploaded by a Task.
- Inputs: Artifacts downloaded and used by the Step/Task.
- Outputs: Artifacts created and uploaded by the Step/Task.
Example Structure:
```json
{
"inputs":[
{
"name": "source code", // Category name
"name": "source", // Category name
"values": [
{
"uri": "git:jjjsss",
"uri": "pkg:github/package-url/purl-spec@244fd47e07d1004f0aed9c", // purl format is recommended https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst
"digest": { "sha256": "b35caccc..." }
}
]
}
],
"outputs": [
{
"name": "build-result", // Category name
"name": "image", // Category name
"values": [
{
"uri": "pkg:balba",
"uri": "pkg:oci/nginx:stable-alpine3.17-slim?repository_url=docker.io/library",
"digest": {
"sha256": "df85b9e3...",
"sha1": "95588b8f..."
Expand All @@ -55,6 +55,54 @@ Example Structure:
}
```

The content is written by the `Step` to a file `$(step.artifacts.path)`:

```yaml
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
generateName: step-artifacts-
spec:
taskSpec:
description: |
A simple task that populates artifacts to TaskRun stepState
steps:
- name: artifacts-producer
image: bash:latest
script: |
cat > $(step.artifacts.path) << EOF
{
"inputs":[
{
"name":"source",
"values":[
{
"uri":"pkg:github/package-url/purl-spec@244fd47e07d1004f0aed9c",
"digest":{
"sha256":"b35cacccfdb1e24dc497d15d553891345fd155713ffe647c281c583269eaaae0"
}
}
]
}
],
"outputs":[
{
"name":"image",
"values":[
{
"uri":"pkg:oci/nginx:stable-alpine3.17-slim?repository_url=docker.io/library",
"digest":{
"sha256":"df85b9e3983fe2ce20ef76ad675ecf435cc99fc9350adc54fa230bae8c32ce48",
"sha1":"95588b8f34c31eb7d62c92aaa4e6506639b06ef2"
}
}
]
}
]
}
EOF
```
### Passing Artifacts between Steps
You can pass artifacts from one step to the next using:
Expand All @@ -80,10 +128,10 @@ spec:
{
"inputs":[
{
"name":"input-artifacts",
"name":"source",
"values":[
{
"uri":"git:jjjsss",
"uri":"pkg:github/package-url/purl-spec@244fd47e07d1004f0aed9c",
"digest":{
"sha256":"b35cacccfdb1e24dc497d15d553891345fd155713ffe647c281c583269eaaae0"
}
Expand All @@ -93,10 +141,10 @@ spec:
],
"outputs":[
{
"name":"build-result",
"name":"image",
"values":[
{
"uri":"pkg:balba",
"uri":"pkg:oci/nginx:stable-alpine3.17-slim?repository_url=docker.io/library",
"digest":{
"sha256":"df85b9e3983fe2ce20ef76ad675ecf435cc99fc9350adc54fa230bae8c32ce48",
"sha1":"95588b8f34c31eb7d62c92aaa4e6506639b06ef2"
Expand All @@ -121,13 +169,13 @@ Upon resolution and execution of the `TaskRun`, the `Status` will look something
"imageID": "docker.io/library/bash@sha256:5353512b79d2963e92a2b97d9cb52df72d32f94661aa825fcfa0aede73304743",
"inputs": [
{
"name": "input-artifacts",
"name": "source",
"values": [
{
"digest": {
"sha256": "b35cacccfdb1e24dc497d15d553891345fd155713ffe647c281c583269eaaae0"
},
"uri": "git:jjjsss"
"uri":"pkg:github/package-url/purl-spec@244fd47e07d1004f0aed9c",
}
]
}
Expand All @@ -142,7 +190,7 @@ Upon resolution and execution of the `TaskRun`, the `Status` will look something
"sha1": "95588b8f34c31eb7d62c92aaa4e6506639b06ef2",
"sha256": "df85b9e3983fe2ce20ef76ad675ecf435cc99fc9350adc54fa230bae8c32ce48"
},
"uri": "pkg:balba"
"uri":"pkg:oci/nginx:stable-alpine3.17-slim?repository_url=docker.io/library",
}
]
}
Expand Down

0 comments on commit 07836a5

Please sign in to comment.