Skip to content

Commit

Permalink
Rename PipelineResourceResult to PipelineInternalResult
Browse files Browse the repository at this point in the history
This commit renames PipelineResourceResult to PipelineInternalResult.
No functional changes.
  • Loading branch information
JeromeJu committed Mar 27, 2023
1 parent 40763d8 commit b2ef1cc
Show file tree
Hide file tree
Showing 31 changed files with 820 additions and 820 deletions.
90 changes: 45 additions & 45 deletions docs/pipeline-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3238,7 +3238,7 @@ string
<p>ResultsType indicates the type of a result;
Used to distinguish between a single string and an array of strings.
Note that there is ResultType used to find out whether a
PipelineResourceResult is from a task result or not, which is different from
PipelineInternalResult is from a task result or not, which is different from
this ResultsType.</p>
</div>
<table>
Expand Down Expand Up @@ -8921,18 +8921,17 @@ map[string]string
<div>
<p>Params is a list of Param</p>
</div>
<h3 id="tekton.dev/v1beta1.PipelineObject">PipelineObject
</h3>
<div>
<p>PipelineObject is implemented by Pipeline and ClusterPipeline</p>
</div>
<h3 id="tekton.dev/v1beta1.PipelineRef">PipelineRef
<h3 id="tekton.dev/v1beta1.PipelineInternalResult">PipelineInternalResult
</h3>
<p>
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.PipelineRunSpec">PipelineRunSpec</a>)
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.TaskRunStatusFields">TaskRunStatusFields</a>)
</p>
<div>
<p>PipelineRef can be used to refer to a specific instance of a Pipeline.</p>
<p>PipelineInternalResult is used to write key/value pairs to TaskRun pod termination messages.
The key/value pairs may come from the entrypoint binary, or represent a TaskRunResult.
If they represent a TaskRunResult, the key is the name of the result and the value is the
JSON-serialized value of the result.
#6434 Renamed from PipelineResourceResult</p>
</div>
<table>
<thead>
Expand All @@ -8944,69 +8943,62 @@ map[string]string
<tbody>
<tr>
<td>
<code>name</code><br/>
<code>key</code><br/>
<em>
string
</em>
</td>
<td>
<p>Name of the referent; More info: <a href="http://kubernetes.io/docs/user-guide/identifiers#names">http://kubernetes.io/docs/user-guide/identifiers#names</a></p>
</td>
</tr>
<tr>
<td>
<code>apiVersion</code><br/>
<code>value</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>API version of the referent</p>
</td>
</tr>
<tr>
<td>
<code>bundle</code><br/>
<code>resourceName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Bundle url reference to a Tekton Bundle.</p>
<p>Deprecated: Please use ResolverRef with the bundles resolver instead.</p>
<p>ResourceName may be used in tests, but it is not populated in termination messages.
It is preserved here for backwards compatibility and will not be ported to v1.</p>
</td>
</tr>
<tr>
<td>
<code>ResolverRef</code><br/>
<code>type</code><br/>
<em>
<a href="#tekton.dev/v1beta1.ResolverRef">
ResolverRef
<a href="#tekton.dev/v1beta1.ResultType">
ResultType
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ResolverRef allows referencing a Pipeline in a remote location
like a git repo. This field is only supported when the alpha
feature gate is enabled.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="tekton.dev/v1beta1.PipelineResourceResult">PipelineResourceResult
<h3 id="tekton.dev/v1beta1.PipelineObject">PipelineObject
</h3>
<div>
<p>PipelineObject is implemented by Pipeline and ClusterPipeline</p>
</div>
<h3 id="tekton.dev/v1beta1.PipelineRef">PipelineRef
</h3>
<p>
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.TaskRunStatusFields">TaskRunStatusFields</a>)
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.PipelineRunSpec">PipelineRunSpec</a>)
</p>
<div>
<p>PipelineResourceResult is used to write key/value pairs to TaskRun pod termination messages.
The key/value pairs may come from the entrypoint binary, or represent a TaskRunResult.
If they represent a TaskRunResult, the key is the name of the result and the value is the
JSON-serialized value of the result.
TODO(#6197): Rename this struct</p>
<p>PipelineRef can be used to refer to a specific instance of a Pipeline.</p>
</div>
<table>
<thead>
Expand All @@ -9018,46 +9010,54 @@ TODO(#6197): Rename this struct</p>
<tbody>
<tr>
<td>
<code>key</code><br/>
<code>name</code><br/>
<em>
string
</em>
</td>
<td>
<p>Name of the referent; More info: <a href="http://kubernetes.io/docs/user-guide/identifiers#names">http://kubernetes.io/docs/user-guide/identifiers#names</a></p>
</td>
</tr>
<tr>
<td>
<code>value</code><br/>
<code>apiVersion</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>API version of the referent</p>
</td>
</tr>
<tr>
<td>
<code>resourceName</code><br/>
<code>bundle</code><br/>
<em>
string
</em>
</td>
<td>
<p>ResourceName may be used in tests, but it is not populated in termination messages.
It is preserved here for backwards compatibility and will not be ported to v1.</p>
<em>(Optional)</em>
<p>Bundle url reference to a Tekton Bundle.</p>
<p>Deprecated: Please use ResolverRef with the bundles resolver instead.</p>
</td>
</tr>
<tr>
<td>
<code>type</code><br/>
<code>ResolverRef</code><br/>
<em>
<a href="#tekton.dev/v1beta1.ResultType">
ResultType
<a href="#tekton.dev/v1beta1.ResolverRef">
ResolverRef
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ResolverRef allows referencing a Pipeline in a remote location
like a git repo. This field is only supported when the alpha
feature gate is enabled.</p>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -10396,10 +10396,10 @@ string
<h3 id="tekton.dev/v1beta1.ResultType">ResultType
(<code>int</code> alias)</h3>
<p>
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.PipelineResourceResult">PipelineResourceResult</a>)
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.PipelineInternalResult">PipelineInternalResult</a>)
</p>
<div>
<p>ResultType used to find out whether a PipelineResourceResult is from a task result or not
<p>ResultType used to find out whether a PipelineInternalResult is from a task result or not
Note that ResultsType is another type which is used to define the data type
(e.g. string, array, etc) we used for Results</p>
</div>
Expand All @@ -10412,7 +10412,7 @@ Note that ResultsType is another type which is used to define the data type
<p>ResultsType indicates the type of a result;
Used to distinguish between a single string and an array of strings.
Note that there is ResultType used to find out whether a
PipelineResourceResult is from a task result or not, which is different from
PipelineInternalResult is from a task result or not, which is different from
this ResultsType.</p>
</div>
<h3 id="tekton.dev/v1beta1.RunObject">RunObject
Expand Down Expand Up @@ -12591,8 +12591,8 @@ All TaskRunStatus stored in RetriesStatus will have no date within the RetriesSt
<td>
<code>resourcesResult</code><br/>
<em>
<a href="#tekton.dev/v1beta1.PipelineResourceResult">
[]PipelineResourceResult
<a href="#tekton.dev/v1beta1.PipelineInternalResult">
[]PipelineInternalResult
</a>
</em>
</td>
Expand Down
2 changes: 1 addition & 1 deletion hack/ignored-openapi-violations.list
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# They are in the specific order they are printed out by k8s.io/kube-openapi/cmd/openapi-gen.
# No additional violations should be added to this ignored list.
API rule violation: names_match,github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1,CloudEventDeliveryState,Error
API rule violation: names_match,github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1,PipelineResourceResult,ResultType
API rule violation: names_match,github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1,PipelineInternalResult,ResultType
API rule violation: names_match,github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1,PipelineTask,WhenExpressions
API rule violation: names_match,github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1,SidecarState,ContainerName
API rule violation: names_match,github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1,StepState,ContainerName
Expand Down
12 changes: 6 additions & 6 deletions internal/sidecarlogresults/sidecarlogresults.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ func LookForResults(w io.Writer, runDir string, resultsDir string, resultNames [
}

// GetResultsFromSidecarLogs extracts results from the logs of the results sidecar
func GetResultsFromSidecarLogs(ctx context.Context, clientset kubernetes.Interface, namespace string, name string, container string, podPhase corev1.PodPhase) ([]v1beta1.PipelineResourceResult, error) {
sidecarLogResults := []v1beta1.PipelineResourceResult{}
func GetResultsFromSidecarLogs(ctx context.Context, clientset kubernetes.Interface, namespace string, name string, container string, podPhase corev1.PodPhase) ([]v1beta1.PipelineInternalResult, error) {
sidecarLogResults := []v1beta1.PipelineInternalResult{}
if podPhase == corev1.PodPending {
return sidecarLogResults, nil
}
Expand All @@ -153,7 +153,7 @@ func GetResultsFromSidecarLogs(ctx context.Context, clientset kubernetes.Interfa
return extractResultsFromLogs(sidecarLogs, sidecarLogResults, maxResultLimit)
}

func extractResultsFromLogs(logs io.Reader, sidecarLogResults []v1beta1.PipelineResourceResult, maxResultLimit int) ([]v1beta1.PipelineResourceResult, error) {
func extractResultsFromLogs(logs io.Reader, sidecarLogResults []v1beta1.PipelineInternalResult, maxResultLimit int) ([]v1beta1.PipelineInternalResult, error) {
scanner := bufio.NewScanner(logs)
buf := make([]byte, maxResultLimit)
scanner.Buffer(buf, maxResultLimit)
Expand All @@ -174,8 +174,8 @@ func extractResultsFromLogs(logs io.Reader, sidecarLogResults []v1beta1.Pipeline
return sidecarLogResults, nil
}

func parseResults(resultBytes []byte, maxResultLimit int) (v1beta1.PipelineResourceResult, error) {
result := v1beta1.PipelineResourceResult{}
func parseResults(resultBytes []byte, maxResultLimit int) (v1beta1.PipelineInternalResult, error) {
result := v1beta1.PipelineInternalResult{}
if len(resultBytes) > maxResultLimit {
return result, ErrSizeExceeded
}
Expand All @@ -184,7 +184,7 @@ func parseResults(resultBytes []byte, maxResultLimit int) (v1beta1.PipelineResou
if err := json.Unmarshal(resultBytes, &res); err != nil {
return result, fmt.Errorf("Invalid result %w", err)
}
result = v1beta1.PipelineResourceResult{
result = v1beta1.PipelineInternalResult{
Key: res.Name,
Value: res.Value,
ResultType: v1beta1.TaskRunResultType,
Expand Down
10 changes: 5 additions & 5 deletions internal/sidecarlogresults/sidecarlogresults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ func TestExtractResultsFromLogs(t *testing.T) {
}
logs := strings.NewReader(podLogs)

results, err := extractResultsFromLogs(logs, []v1beta1.PipelineResourceResult{}, 4096)
results, err := extractResultsFromLogs(logs, []v1beta1.PipelineInternalResult{}, 4096)
if err != nil {
t.Error(err)
}
want := []v1beta1.PipelineResourceResult{
want := []v1beta1.PipelineInternalResult{
{
Key: "result1",
Value: "foo",
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestExtractResultsFromLogs_Failure(t *testing.T) {
}
logs := strings.NewReader(podLogs)

_, err := extractResultsFromLogs(logs, []v1beta1.PipelineResourceResult{}, 4096)
_, err := extractResultsFromLogs(logs, []v1beta1.PipelineInternalResult{}, 4096)
if err != ErrSizeExceeded {
t.Fatalf("Expected error %v but got %v", ErrSizeExceeded, err)
}
Expand All @@ -204,7 +204,7 @@ func TestParseResults(t *testing.T) {
res, _ := json.Marshal(&r)
podLogs = append(podLogs, string(res))
}
want := []v1beta1.PipelineResourceResult{{
want := []v1beta1.PipelineInternalResult{{
Key: "result1",
Value: "foo",
ResultType: v1beta1.TaskRunResultType,
Expand All @@ -217,7 +217,7 @@ func TestParseResults(t *testing.T) {
Value: `["hello","world"]`,
ResultType: v1beta1.TaskRunResultType,
}}
stepResults := []v1beta1.PipelineResourceResult{}
stepResults := []v1beta1.PipelineInternalResult{}
for _, plog := range podLogs {
res, err := parseResults([]byte(plog), 4096)
if err != nil {
Expand Down
Loading

0 comments on commit b2ef1cc

Please sign in to comment.