Skip to content

Commit

Permalink
results path fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
chitrangpatel committed Nov 13, 2023
1 parent d0c55e0 commit 8a9cbbe
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions docs/stepactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ spec:

#### Fetching Emitted Results from StepActions

A `Task` can fetch `Results` produced by the `StepActions` using variable replacement syntax. We introduce a field to [`Task Results`](./tasks.md#emitting-results) called `Value` whose value can be set to the variable `$(steps.<stepName>.results.<resultName>)`.
A `Task` can fetch `Results` produced by the `StepActions` (i.e. only results emitted to `$(step.results.<resultName>.path)`, `NOT` $(results.<resultName>.path)) using variable replacement syntax. We introduce a field to [`Task Results`](./tasks.md#emitting-results) called `Value` whose value can be set to the variable `$(steps.<stepName>.results.<resultName>)`.

```yaml
apiVersion: tekton.dev/v1
Expand Down Expand Up @@ -195,8 +195,6 @@ spec:

However, in the above examples, if the `result` "url" was not resolved by the `Task` to "git-url" and "registry-url", and instead the `Task` just specified "url", the value surfaced to it could be either the "url" from the "kaniko-step-action" `StepAction` or "clone-step-action". **In case of name conflicts, always resolve the result produced by the underlying StepActions.**



### Declaring SecurityContext

You can declare `securityContext` in a `StepAction`:
Expand Down
2 changes: 1 addition & 1 deletion pkg/entrypoint/entrypointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (e Entrypointer) Go() error {
}()

if e.StepName != "" && e.StepResults != nil {
if err := os.MkdirAll(filepath.Join(pipeline.StepsDir, e.StepName, "results"), os.ModePerm); err != nil {
if err := os.MkdirAll(filepath.Join(pipeline.DefaultResultPath, e.StepName, "results"), os.ModePerm); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/pod/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ func stepResultArgument(results []v1.TaskResult, stepName string) ([]string, err
return nil, err
}
if stepName == sName {
res[r.Name] = filepath.Join(pipeline.StepsDir, stepName, "results", resultName)
res[r.Name] = filepath.Join(pipeline.DefaultResultPath, stepName, "results", resultName)
}
}
} else {
res[r.Name] = filepath.Join(pipeline.StepsDir, stepName, "results", r.Name)
res[r.Name] = filepath.Join(pipeline.DefaultResultPath, stepName, "results", r.Name)
}
}
resBytes, err := json.Marshal(res)
Expand Down
1 change: 1 addition & 0 deletions pkg/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ var (
}, {
Name: "tekton-internal-steps",
MountPath: pipeline.StepsDir,
ReadOnly: true,
}}
implicitVolumes = []corev1.Volume{{
Name: "tekton-internal-workspace",
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/taskrun/resources/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func applyStepActionParametersAndResults(step *v1.Step, spec *v1.TaskSpec, tr *v
// Overwrite step result path reference
for _, result := range stepActionSpec.Results {
for _, pattern := range stepActionResultPatterns {
stringReplacements[fmt.Sprintf(pattern, result.Name)] = filepath.Join(pipeline.StepsDir, stepName, "results", result.Name)
stringReplacements[fmt.Sprintf(pattern, result.Name)] = filepath.Join(pipeline.DefaultResultsPath, stepName, "results", result.Name)
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/taskrun/taskrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5127,6 +5127,7 @@ func podVolumeMounts(idx, totalSteps int) []corev1.VolumeMount {
mnts = append(mnts, corev1.VolumeMount{
Name: "tekton-internal-steps",
MountPath: "/tekton/steps",
ReadOnly: true,
})

return mnts
Expand Down

0 comments on commit 8a9cbbe

Please sign in to comment.