Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ baseImageOverrides:
github.com/tektoncd/pipeline/cmd/git-init: gcr.io/tekton-nightly/github.com/tektoncd/pipeline/build-base:latest
# GCS fetcher needs root due to workspace permissions
github.com/tektoncd/pipeline/vendor/github.com/GoogleCloudPlatform/cloud-builders/gcs-fetcher/cmd/gcs-fetcher: gcr.io/distroless/static:latest
# PullRequest resource needs root because in output mode it needs to access pr.json
# which might have been copied or written with any level of permissions.
github.com/tektoncd/pipeline/cmd/pullrequest-init: gcr.io/distroless/static:latest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it true that this would apply to any container that needs to operate on any file written by a previous step? if so this feels like it might be a slightly larger problem since it feels like communicating b/w steps is a big part of our design 🤔 (maybe im over exaggerating that?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I do think that's a risk we might want to spend a bit more time analysing. Here I'm fixing the immediate issue we observed in dogfooding wrt the PR pipeline resource.


# Our entrypoint image does not need root, it simply needs to be able to 'cp' the binary into a shared location.
github.com/tektoncd/pipeline/cmd/entrypoint: gcr.io/distroless/base:debug-nonroot
47 changes: 47 additions & 0 deletions examples/v1beta1/taskruns/pullrequest_input_copystep_output.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This examples taskrun exercises the behaviour of the pullrequest
# resource when the output pullrequest resource matches exactly the
# input pullrequest resource.
#
# A step is used to copy the input resource's data directly to the
# output resource's workspace directory. The output resource should
# then read the copied data and skip sending any changes to GitHub.
#
# Importantly the output pullrequest should _not_ fail to read the
# data from its workspace directory, regardless of which user the
# copy step ran as and the ownership permissions attached to the
# pr.json file.
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
generateName: pr-test-copy-prjson-from-input-to-output
spec:
taskSpec:
resources:
inputs:
- name: pr
type: pullRequest
outputs:
- name: pr
type: pullRequest
steps:
- name: copy-pr-to-output
image: busybox
script: |
#!/bin/sh
mkdir -p $(outputs.resources.pr.path)
cp -r $(inputs.resources.pr.path)/* $(outputs.resources.pr.path)/
resources:
inputs:
- name: pr
resourceSpec:
type: pullRequest
params:
- name: url
value: https://github.com/tektoncd/pipeline/pull/100
outputs:
- name: pr
resourceSpec:
type: pullRequest
params:
- name: url
value: https://github.com/tektoncd/pipeline/pull/100
3 changes: 2 additions & 1 deletion tekton/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ spec:

# These match values configured in .ko.yaml
$(inputs.params.pathToProject)/$(outputs.resources.builtEntrypointImage.url): gcr.io/distroless/base:debug-nonroot
$(inputs.params.pathToPrjoect)/$(outputs.resources.builtGcsFetcherImage.url): gcr.io/distroless/static:latest
$(inputs.params.pathToProject)/$(outputs.resources.builtGcsFetcherImage.url): gcr.io/distroless/static:latest
$(inputs.params.pathToProject)/$(outputs.resources.builtPullRequestInitImage.url): gcr.io/distroless/static:latest
baseBuildOverrides:
$(inputs.params.pathToProject)/$(outputs.resources.builtControllerImage.url):
flags:
Expand Down