Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the git resource ref to the ResourceResult for git resources. #2238

Merged
merged 1 commit into from
Mar 23, 2020
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
6 changes: 6 additions & 0 deletions cmd/git-init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ package main

import (
"flag"
"os"

v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/pipeline/pkg/git"
"github.com/tektoncd/pipeline/pkg/termination"
"go.uber.org/zap"
Expand Down Expand Up @@ -61,10 +63,14 @@ func main() {
if err != nil {
logger.Fatalf("Error parsing commit of git repository: %s", err)
}
resourceName := os.Getenv("TEKTON_RESOURCE_NAME")
output := []v1alpha1.PipelineResourceResult{
{
Key: "commit",
Value: commit,
ResourceRef: v1beta1.PipelineResourceRef{
Name: resourceName,
},
},
}

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.13

require (
cloud.google.com/go v0.47.0 // indirect
cloud.google.com/go/storage v1.0.0
contrib.go.opencensus.io/exporter/stackdriver v0.12.8 // indirect
github.com/GoogleCloudPlatform/cloud-builders/gcs-fetcher v0.0.0-20191203181535-308b93ad1f39
github.com/cloudevents/sdk-go v1.0.0
Expand Down Expand Up @@ -42,6 +43,7 @@ require (
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
golang.org/x/tools v0.0.0-20200214144324-88be01311a71 // indirect
gomodules.xyz/jsonpatch/v2 v2.1.0 // indirect
google.golang.org/api v0.15.0
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
k8s.io/api v0.17.3
Expand Down
4 changes: 4 additions & 0 deletions test/kaniko_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ func TestKanikoTaskRun(t *testing.T) {
case "commit":
commit = rr.Value
}
// Every resource should have a ref with a name
if rr.ResourceRef.Name == "" {
t.Errorf("Resource ref not set for %v in TaskRun: %v", rr, tr)
}
}
if digest == "" {
t.Errorf("Digest not found in TaskRun.Status: %v", tr.Status)
Expand Down