Skip to content

Commit

Permalink
Remove Image Resources
Browse files Browse the repository at this point in the history
This commit removes the Image Resources support.
Removal of `pipelineResources`, as in #5967 has been broken up into removal of each resources packages for the `small PR` code standard.
This PR removes `github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1/image`
the imagedigestexporter and the docs for image resources.
  • Loading branch information
JeromeJu committed Jan 19, 2023
1 parent 7a6ab62 commit 37aeedd
Show file tree
Hide file tree
Showing 28 changed files with 82 additions and 1,546 deletions.
1 change: 0 additions & 1 deletion cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func main() {
flag.StringVar(&opts.Images.ShellImageWin, "shell-image-win", "", "The container image containing a windows shell")
flag.StringVar(&opts.Images.GsutilImage, "gsutil-image", "", "The container image containing gsutil")
flag.StringVar(&opts.Images.PRImage, "pr-image", "", "The container image containing our PR binary.")
flag.StringVar(&opts.Images.ImageDigestExporterImage, "imagedigest-exporter-image", "", "The container image containing our image digest exporter binary.")
flag.StringVar(&opts.Images.WorkingDirInitImage, "workingdirinit-image", "", "The container image containing our working dir init binary.")

// This parses flags.
Expand Down
18 changes: 0 additions & 18 deletions cmd/imagedigestexporter/digest.go

This file was deleted.

65 changes: 0 additions & 65 deletions cmd/imagedigestexporter/digest_test.go

This file was deleted.

1 change: 0 additions & 1 deletion cmd/imagedigestexporter/kodata/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/imagedigestexporter/kodata/third_party

This file was deleted.

83 changes: 0 additions & 83 deletions cmd/imagedigestexporter/main.go

This file was deleted.

1 change: 0 additions & 1 deletion config/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ spec:
"-entrypoint-image", "ko://github.com/tektoncd/pipeline/cmd/entrypoint",
"-nop-image", "ko://github.com/tektoncd/pipeline/cmd/nop",
"-sidecarlogresults-image", "ko://github.com/tektoncd/pipeline/cmd/sidecarlogresults",
"-imagedigest-exporter-image", "ko://github.com/tektoncd/pipeline/cmd/imagedigestexporter",
"-pr-image", "ko://github.com/tektoncd/pipeline/cmd/pullrequest-init",
"-workingdirinit-image", "ko://github.com/tektoncd/pipeline/cmd/workingdirinit",

Expand Down
2 changes: 0 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,6 @@ list of image references with their digest as part of the `args`:
"gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint:v0.28.1@sha256:2fa7f7c3408f52ff21b2d8c4271374dac4f5b113b1c4dbc7d5189131e71ce721",
"-nop-image",
"gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.28.1@sha256:59b5304bcfdd9834150a2701720cf66e3ebe6d6e4d361ae1612d9430089591f8",
"-imagedigest-exporter-image",
"gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/imagedigestexporter:v0.28.1@sha256:e4d77b5b8902270f37812f85feb70d57d6d0e1fed2f3b46f86baf534f19cd9c0",
"-pr-image",
"gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/pullrequest-init:v0.28.1@sha256:4992491b2714a73c0a84553030e6056e6495b3d9d5cc6b20cf7bc8c51be779bb",
```
Expand Down
86 changes: 0 additions & 86 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ For example:
- [Resource types](#resource-types)
- [Git Resource](#git-resource)
- [Pull Request Resource](#pull-request-resource)
- [Image Resource](#image-resource)
- [Cluster Resource](#cluster-resource)
- [Storage Resource](#storage-resource)
- [GCS Storage Resource](#gcs-storage-resource)
Expand Down Expand Up @@ -581,91 +580,6 @@ spec:
value: github
```

### Image Resource

An `image` resource represents an image that lives in a remote repository. It is
usually used as [a `Task` `output`](tasks.md#outputs) for `Tasks` that build
images. This allows the same `Tasks` to be used to generically push to any
registry.

Params that can be added are the following:

1. `url`: The complete path to the image, including the registry and the image
tag
1. `digest`: The
[image digest](https://success.docker.com/article/images-tagging-vs-digests)
which uniquely identifies a particular build of an image with a particular
tag. _While this can be provided as a parameter, there is not yet a way to
update this value after an image is built, but this is planned in
[#216](https://github.com/tektoncd/pipeline/issues/216)._

For example:

```yaml
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: kritis-resources-image
namespace: default
spec:
type: image
params:
- name: url
value: gcr.io/staging-images/kritis
```

#### Surfacing the image digest built in a task

To surface the image digest in the output of the `taskRun` the builder tool
should produce this information in a
[OCI Image Layout](https://github.com/opencontainers/image-spec/blob/master/image-layout.md)
`index.json` file. This file should be placed on a location as specified in the
task definition under the default resource directory, or the specified
`targetPath`. If there is only one image in the `index.json` file, the digest of
that image is exported; otherwise, the digest of the whole image index would be
exported. For example this build-push task defines the `outputImageDir` for the
`builtImage` resource in `/workspace/buildImage`

```yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: build-push
spec:
resources:
inputs:
- name: workspace
type: git
outputs:
- name: builtImage
type: image
targetPath: /workspace/builtImage
steps: ...
```

If no value is specified for `targetPath`, it will default to
`/workspace/output/{resource-name}`.

_Please check the builder tool used on how to pass this path to create the
output file._

The `taskRun` will include the image digest and URL in the `resourcesResult` field that
is part of the `taskRun.Status`

for example:

```yaml
status:
# ...
resourcesResult:
- key: "digest"
value: "sha256:eed29cd0b6feeb1a92bc3c4f977fd203c63b376a638731c88cacefe3adb1c660"
resourceName: skaffold-image-leeroy-web
# ...
```

If the `index.json` file is not produced, the image digest will not be included
in the `taskRun` output.

### Cluster Resource

Expand Down
1 change: 0 additions & 1 deletion pkg/apis/pipeline/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func (i Images) Validate() error {
{i.ShellImageWin, "shell-image-win"},
{i.GsutilImage, "gsutil-image"},
{i.PRImage, "pr-image"},
{i.ImageDigestExporterImage, "imagedigest-exporter-image"},
{i.WorkingDirInitImage, "workingdirinit-image"},
} {
if f.v == "" {
Expand Down
Loading

0 comments on commit 37aeedd

Please sign in to comment.