Repository: openshift-pipelines/pipelines-as-code
Pull request #3 (2021-04-27 19:26:47)

fix resolve pipelinespec
- Fix linting error  in payload Replace
- Resolve pipelinespec embedded in PipelineRun too
- Fix others \r\n from triggers/github



Patch:
diff --git a/pkg/cmd/pipelineascode/pipelineascode.go b/pkg/cmd/pipelineascode/pipelineascode.go
index 9d76cda3..b10820e6 100644
--- a/pkg/cmd/pipelineascode/pipelineascode.go
+++ b/pkg/cmd/pipelineascode/pipelineascode.go
@@ -60,7 +60,7 @@ func runWrap(p cli.Params, opts *pacpkg.Options) error {
 	}
 
 	err = pacpkg.Run(cs, runInfo)
-	if err != nil {
+	if err != nil && !strings.Contains(err.Error(), "403 Resource not accessible by integration") {
 		_, _ = cs.GithubClient.CreateStatus(runInfo, "completed", "failure",
 			fmt.Sprintf("There was an issue validating the commit: %q", err),
 			"https://tenor.com/search/sad-cat-gifs")
diff --git a/pkg/pipelineascode/pipelineascode.go b/pkg/pipelineascode/pipelineascode.go
index b384beee..2ef0fd2c 100644
--- a/pkg/pipelineascode/pipelineascode.go
+++ b/pkg/pipelineascode/pipelineascode.go
@@ -107,7 +107,7 @@ func Run(cs *cli.Clients, runinfo *webvcs.RunInfo) error {
 	if yamlConfig.RemoteTasks != "" {
 		allTemplates += yamlConfig.RemoteTasks
 	}
-	prun, err := resolve.Resolve(allTemplates, true)
+	prun, err := resolve.Resolve(cs, allTemplates, true)
 	if err != nil {
 		return err
 	}
diff --git a/pkg/resolve/resolve.go b/pkg/resolve/resolve.go
index 1ed143a3..bcb09814 100644
--- a/pkg/resolve/resolve.go
+++ b/pkg/resolve/resolve.go
@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"strings"
 
+	"github.com/openshift-pipelines/pipelines-as-code/pkg/cli"
 	"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
 	tektonv1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
 	"k8s.io/client-go/kubernetes/scheme"
@@ -18,7 +19,7 @@ type Types struct {
 	Tasks        []*v1beta1.Task
 }
 
-func readTypes(data []byte) (Types, error) {
+func readTypes(cs *cli.Clients, data []byte) (Types, error) {
 	var types = Types{}
 	decoder := scheme.Codecs.UniversalDeserializer()
 
@@ -29,7 +30,8 @@ func readTypes(data []byte) (Types, error) {
 
 		obj, _, err := decoder.Decode([]byte(doc), nil, nil)
 		if err != nil {
-			return types, err
+			cs.Log.Info("Skipping document not looking like a kubernetes resources")
+			continue
 		}
 		switch o := obj.(type) {
 		case *v1beta1.Pipeline:
@@ -38,6 +40,8 @@ func readTypes(data []byte) (Types, error) {
 			types.PipelineRuns = append(types.PipelineRuns, o)
 		case *v1beta1.Task:
 			types.Tasks = append(types.Tasks, o)
+		default:
+			cs.Log.Info("Skipping document not looking like a tekton resource we can Resolve.")
 		}
 	}
 
@@ -62,8 +66,8 @@ func getPipelineByName(name string, tasks []*v1beta1.Pipeline) (*v1beta1.Pipelin
 	return &v1beta1.Pipeline{}, fmt.Errorf("Cannot find pipeline %s in input", name)
 }
 
-func resolve(data []byte, generateName bool) ([]*v1beta1.PipelineRun, error) {
-	types, err := readTypes(data)
+func resolve(cs *cli.Clients, data []byte, generateName bool) ([]*v1beta1.PipelineRun, error) {
+	types, err := readTypes(cs, data)
 	if err != nil {
 		return []*v1beta1.PipelineRun{}, err
 	}
@@ -71,6 +75,7 @@ func resolve(data []byte, generateName bool) ([]*v1beta1.PipelineRun, error) {
 		return []*v1beta1.PipelineRun{}, errors.New("We need at least one pipelinerun to start with")
 	}
 
+	// Resolve TaskRef inside Pipeline
 	for _, pipeline := range types.Pipelines {
 		pipelineTasks := []v1beta1.PipelineTask{}
 		for _, task := range pipeline.Spec.Tasks {
@@ -88,6 +93,24 @@ func resolve(data []byte, generateName bool) ([]*v1beta1.PipelineRun, error) {
 	}
 
 	for _, pipelinerun := range types.PipelineRuns {
+		// Resolve taskRef inside PipelineSpec inside PipelineRun
+		if pipelinerun.Spec.PipelineSpec != nil {
+			pipelineTasksResolve := []v1beta1.PipelineTask{}
+			for _, task := range pipelinerun.Spec.PipelineSpec.Tasks {
+				if task.TaskRef != nil {
+					taskResolved, err := getTaskByName(task.TaskRef.Name, types.Tasks)
+					if err != nil {
+						return []*v1beta1.PipelineRun{}, err
+					}
+					task.TaskRef = nil
+					task.TaskSpec = &v1beta1.EmbeddedTask{TaskSpec: taskResolved.Spec}
+				}
+				pipelineTasksResolve = append(pipelineTasksResolve, task)
+			}
+			pipelinerun.Spec.PipelineSpec.Tasks = pipelineTasksResolve
+
+		}
+		// Resolve PipelineRef inside PipelineRef
 		if pipelinerun.Spec.PipelineRef != nil {
 			pipelineResolved, err := getPipelineByName(pipelinerun.Spec.PipelineRef.Name, types.Pipelines)
 			if err != nil {
@@ -97,6 +120,7 @@ func resolve(data []byte, generateName bool) ([]*v1beta1.PipelineRun, error) {
 			pipelinerun.Spec.PipelineSpec = &pipelineResolved.Spec
 
 		}
+		// Add a generateName based on name if we want it
 		if generateName && pipelinerun.ObjectMeta.GenerateName == "" {
 			pipelinerun.ObjectMeta.GenerateName = pipelinerun.ObjectMeta.Name + "-"
 			pipelinerun.ObjectMeta.Name = ""
@@ -109,10 +133,10 @@ func resolve(data []byte, generateName bool) ([]*v1beta1.PipelineRun, error) {
 // Pipeline/PipelineRuns/Tasks and resolve them inline as a single PipelineRun
 // generateName can be set as True to set the name as a generateName + "-" for
 // unique pipelinerun
-func Resolve(allTemplates string, generateName bool) ([]*v1beta1.PipelineRun, error) {
+func Resolve(cs *cli.Clients, allTemplates string, generateName bool) ([]*v1beta1.PipelineRun, error) {
 	s := k8scheme.Scheme
 	if err := tektonv1beta1.AddToScheme(s); err != nil {
 		return []*v1beta1.PipelineRun{}, err
 	}
-	return resolve([]byte(allTemplates), generateName)
+	return resolve(cs, []byte(allTemplates), generateName)
 }
diff --git a/pkg/webvcs/github.go b/pkg/webvcs/github.go
index 45d46e9b..8c8f1b9b 100644
--- a/pkg/webvcs/github.go
+++ b/pkg/webvcs/github.go
@@ -41,10 +41,25 @@ func NewGithubVCS(token string) GithubVCS {
 	}
 }
 
-func (v GithubVCS) ParsePayload(payload string) (*RunInfo, error) {
-	// Triggers send some \r\n which can't get parsed 🤷
-	payload = strings.Replace(payload, "\r\n", "", -1)
+// We got a bunch of \r\n or \n and others from triggers/github, so let just
+// workaround it. Originally from https://stackoverflow.com/a/52600147
+func payloadFix(payload string) string {
+	var replacement = " "
+	var replacer = strings.NewReplacer(
+		"\r\n", replacement,
+		"\r", replacement,
+		"\n", replacement,
+		"\v", replacement,
+		"\f", replacement,
+		"\u0085", replacement,
+		"\u2028", replacement,
+		"\u2029", replacement,
+	)
+	return replacer.Replace(payload)
+}
 
+func (v GithubVCS) ParsePayload(payload string) (*RunInfo, error) {
+	payload = payloadFix(payload)
 	prMap := &github.PullRequestEvent{}
 	err := json.Unmarshal([]byte(payload), prMap)
 	if err != nil {


Test patch:
diff --git a/pkg/resolve/resolve_test.go b/pkg/resolve/resolve_test.go
index 3b0ab6bb..755b6234 100644
--- a/pkg/resolve/resolve_test.go
+++ b/pkg/resolve/resolve_test.go
@@ -4,10 +4,14 @@ import (
 	"io/ioutil"
 	"log"
 	"os"
+	"strings"
 	"testing"
 
+	"github.com/openshift-pipelines/pipelines-as-code/pkg/cli"
 	"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
 	tektonv1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
+	"go.uber.org/zap"
+	zapobserver "go.uber.org/zap/zaptest/observer"
 	"gotest.tools/assert"
 	k8scheme "k8s.io/client-go/kubernetes/scheme"
 )
@@ -27,24 +31,26 @@ func setup() {
 }
 
 // Not sure how to get testParams fixtures working
-func readTDfile(testname string, generateName bool) (*v1beta1.PipelineRun, error) {
+func readTDfile(testname string, generateName bool) (*v1beta1.PipelineRun, *zapobserver.ObservedLogs, error) {
 	data, err := ioutil.ReadFile("testdata/" + testname + ".yaml")
 	if err != nil {
-		return &v1beta1.PipelineRun{}, err
+		return &v1beta1.PipelineRun{}, nil, err
 	}
-	resolved, err := resolve(data, generateName)
+	observer, log := zapobserver.New(zap.InfoLevel)
+	logger := zap.New(observer).Sugar()
+	cs := &cli.Clients{
+		Log: logger,
+	}
+	resolved, err := resolve(cs, data, generateName)
 	if err != nil {
-		return &v1beta1.PipelineRun{}, err
+		return &v1beta1.PipelineRun{}, nil, err
 	}
-	return resolved[0], nil
+	return resolved[0], log, nil
 }
 
 func TestPipelineRunPipelineTask(t *testing.T) {
-	resolved, err := readTDfile("pipelinerun-pipeline-task", false)
-	if err != nil {
-		t.Fatal(err)
-	}
-
+	resolved, _, err := readTDfile("pipelinerun-pipeline-task", false)
+	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskSpec.Steps[0].Name, "first-step")
 
 	//TODO: we should do templates substitions for those values here?
@@ -52,61 +58,62 @@ func TestPipelineRunPipelineTask(t *testing.T) {
 }
 
 func TestGenerateName(t *testing.T) {
-	resolved, err := readTDfile("pipelinerun-pipeline-task", true)
-	if err != nil {
-		t.Fatal(err)
-	}
-
+	resolved, _, err := readTDfile("pipelinerun-pipeline-task", true)
+	assert.NilError(t, err)
 	assert.Assert(t, resolved.ObjectMeta.GenerateName != "")
 
-	resolved, err = readTDfile("with-generatename", true)
-	if err != nil {
-		t.Fatal(err)
-	}
+	resolved, _, err = readTDfile("with-generatename", true)
+	assert.NilError(t, err)
 	assert.Assert(t, resolved.ObjectMeta.GenerateName != "")
 }
 
 func TestPipelineRunPipelineSpecTaskSpec(t *testing.T) {
-	resolved, err := readTDfile("pipelinerun-pipelinespec-taskspec", false)
-	if err != nil {
-		t.Fatal(err)
-	}
+	resolved, _, err := readTDfile("pipelinerun-pipelinespec-taskspec", false)
+	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskSpec.Steps[0].Name, "hello-moto")
 }
 
 func TestPipelineRunPipelineSpecTaskRef(t *testing.T) {
-	t.Skip("TODO") // TODO: Not working ATM
-	resolved, err := readTDfile("pipelinerun-pipelinespec-taskref", false)
-	if err != nil {
-		t.Fatal(err)
-	}
+	resolved, _, err := readTDfile("pipelinerun-pipelinespec-taskref", false)
+	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskSpec.Steps[0].Name, "task1")
 }
 
-func TestPipelineRunPipelineRefTaskSpec(t *testing.T) {
-	resolved, err := readTDfile("pipelinerun-pipelineref-taskspec", false)
-	if err != nil {
-		t.Fatal(err)
-	}
-	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskSpec.Steps[0].Name, "first-step")
+func TestNotTektonDocumentIgnore(t *testing.T) {
+	resolved, log, err := readTDfile("not-a-tekton-document", false)
+	assert.NilError(t, err)
+	logs := log.TakeAll()
+	assert.Assert(t, len(logs) > 0)
+	assert.Assert(t, strings.HasPrefix(logs[0].Message, "Skipping"))
+	assert.Assert(t, resolved.Spec.PipelineSpec != nil)
+}
+
+func TestNotKubernetesDocumentIgnore(t *testing.T) {
+	resolved, log, err := readTDfile("not-a-kubernetes-yaml", false)
+	logs := log.TakeAll()
+	assert.Assert(t, len(logs) > 0)
+	assert.Assert(t, strings.HasPrefix(logs[0].Message, "Skipping"))
+	assert.Assert(t, resolved.Spec.PipelineSpec != nil)
+	assert.NilError(t, err)
+	assert.Assert(t, resolved.Spec.PipelineSpec != nil)
 }
 
 func TestNoPipelineRuns(t *testing.T) {
-	_, err := readTDfile("no-pipelinerun", false)
+	_, _, err := readTDfile("no-pipelinerun", false)
 	assert.Error(t, err, "We need at least one pipelinerun to start with")
 }
 
 func TestReferencedTaskNotInRepo(t *testing.T) {
-	_, err := readTDfile("referenced-task-not-in-repo", false)
+	_, _, err := readTDfile("referenced-task-not-in-repo", false)
 	assert.Error(t, err, "Cannot find task nothere in input")
 }
 
 func TestReferencedPipelineNotInRepo(t *testing.T) {
-	_, err := readTDfile("referenced-pipeline-not-in-repo", false)
+	_, _, err := readTDfile("referenced-pipeline-not-in-repo", false)
 	assert.Error(t, err, "Cannot find pipeline pipeline-test1 in input")
 }
 
 func TestIgnoreDocSpace(t *testing.T) {
-	_, err := readTDfile("empty-spaces", false)
+	_, _, err := readTDfile("empty-spaces", false)
 	assert.NilError(t, err)
 }
diff --git a/pkg/webvcs/github_test.go b/pkg/webvcs/github_test.go
index d6ac78e5..27dea083 100644
--- a/pkg/webvcs/github_test.go
+++ b/pkg/webvcs/github_test.go
@@ -13,6 +13,16 @@ import (
 	"gotest.tools/assert"
 )
 
+func TestPayLoadFix(t *testing.T) {
+	b, err := ioutil.ReadFile("testdata/pull_request_with_newlines.json")
+	assert.NilError(t, err)
+	gvcs := NewGithubVCS("none")
+	_, err = gvcs.ParsePayload(payloadFix(string(b)))
+	// would bomb out on "assertion failed: error is not nil: invalid character
+	// '\n' in string literal" if we don't payloadfix
+	assert.NilError(t, err)
+}
+
 func TestParsePayload(t *testing.T) {
 	b, err := ioutil.ReadFile("testdata/pull_request.json")
 	assert.NilError(t, err)
diff --git a/pkg/webvcs/testdata/pull_request_with_newlines.json b/pkg/webvcs/testdata/pull_request_with_newlines.json
new file mode 100644
index 00000000..faa2e317
--- /dev/null
+++ b/pkg/webvcs/testdata/pull_request_with_newlines.json
@@ -0,0 +1,3 @@
+{"action":"opened","installation":{"id":16557439,"node_id":"MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMTY1NTc0Mzk="},"number":3,"organization":{"avatar_url":"https://avatars.githubusercontent.com/u/57996262?v=4","description":"","events_url":"https://api.github.com/orgs/openshift-pipelines/events","hooks_url":"https://api.github.com/orgs/openshift-pipelines/hooks","id":57996262,"issues_url":"https://api.github.com/orgs/openshift-pipelines/issues","login":"openshift-pipelines","members_url":"https://api.github.com/orgs/openshift-pipelines/members{/member}","node_id":"MDEyOk9yZ2FuaXphdGlvbjU3OTk2MjYy","public_members_url":"https://api.github.com/orgs/openshift-pipelines/public_members{/member}","repos_url":"https://api.github.com/orgs/openshift-pipelines/repos","url":"https://api.github.com/orgs/openshift-pipelines"},"pull_request":{"_links":{"comments":{"href":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues/3/comments"},"commits":{"href":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls/3/commits"},"html":{"href":"https://github.com/openshift-pipelines/pipelines-as-code/pull/3"},"issue":{"href":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues/3"},"review_comment":{"href":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls/comments{/number}"},"review_comments":{"href":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls/3/comments"},"self":{"href":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls/3"},"statuses":{"href":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/statuses/857cfa78d2f1f273013702e7151514f4f27d9291"}},"active_lock_reason":null,"additions":38,"assignee":null,"assignees":[],"author_association":"MEMBER","auto_merge":null,"base":{"label":"openshift-pipelines:main","ref":"main","repo":{"allow_merge_commit":true,"allow_rebase_merge":true,"allow_squash_merge":true,"archive_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/{archive_format}{/ref}","archived":false,"assignees_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/assignees{/user}","blobs_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/blobs{/sha}","branches_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/branches{/branch}","clone_url":"https://github.com/openshift-pipelines/pipelines-as-code.git","collaborators_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/collaborators{/collaborator}","comments_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/comments{/number}","commits_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/commits{/sha}","compare_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/compare/{base}...{head}","contents_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/contents/{+path}","contributors_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/contributors","created_at":"2021-04-06T13:26:01Z","default_branch":"main","delete_branch_on_merge":false,"deployments_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/deployments","description":"Pipelines as Code","disabled":false,"downloads_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/downloads","events_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/events","fork":false,"forks":3,"forks_count":3,"forks_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/forks","full_name":"openshift-pipelines/pipelines-as-code","git_commits_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/commits{/sha}","git_refs_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/refs{/sha}","git_tags_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/tags{/sha}","git_url":"git://github.com/openshift-pipelines/pipelines-as-code.git","has_downloads":true,"has_issues":true,"has_pages":false,"has_projects":true,"has_wiki":true,"homepage":null,"hooks_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/hooks","html_url":"https://github.com/openshift-pipelines/pipelines-as-code","id":355197825,"issue_comment_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues/comments{/number}","issue_events_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues/events{/number}","issues_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues{/number}","keys_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/keys{/key_id}","labels_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/labels{/name}","language":"Go","languages_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/languages","license":{"key":"apache-2.0","name":"Apache License 2.0","node_id":"MDc6TGljZW5zZTI=","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"merges_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/merges","milestones_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/milestones{/number}","mirror_url":null,"name":"pipelines-as-code","node_id":"MDEwOlJlcG9zaXRvcnkzNTUxOTc4MjU=","notifications_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/notifications{?since,all,participating}","open_issues":1,"open_issues_count":1,"owner":{"avatar_url":"https://avatars.githubusercontent.com/u/57996262?v=4","events_url":"https://api.github.com/users/openshift-pipelines/events{/privacy}","followers_url":"https://api.github.com/users/openshift-pipelines/followers","following_url":"https://api.github.com/users/openshift-pipelines/following{/other_user}","gists_url":"https://api.github.com/users/openshift-pipelines/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/openshift-pipelines","id":57996262,"login":"openshift-pipelines","node_id":"MDEyOk9yZ2FuaXphdGlvbjU3OTk2MjYy","organizations_url":"https://api.github.com/users/openshift-pipelines/orgs","received_events_url":"https://api.github.com/users/openshift-pipelines/received_events","repos_url":"https://api.github.com/users/openshift-pipelines/repos","site_admin":false,"starred_url":"https://api.github.com/users/openshift-pipelines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift-pipelines/subscriptions","type":"Organization","url":"https://api.github.com/users/openshift-pipelines"},"private":false,"pulls_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls{/number}","pushed_at":"2021-04-27T16:10:20Z","releases_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/releases{/id}","size":9122,"ssh_url":"git@github.com:openshift-pipelines/pipelines-as-code.git","stargazers_count":1,"stargazers_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/stargazers","statuses_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/statuses/{sha}","subscribers_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/subscribers","subscription_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/subscription","svn_url":"https://github.com/openshift-pipelines/pipelines-as-code","tags_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/tags","teams_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/teams","trees_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/trees{/sha}","updated_at":"2021-04-27T16:10:24Z","url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code","watchers":1,"watchers_count":1},"sha":"70e8fe5a8caa7c82239622090b5c141e63c033e6","user":{"avatar_url":"https://avatars.githubusercontent.com/u/57996262?v=4","events_url":"https://api.github.com/users/openshift-pipelines/events{/privacy}","followers_url":"https://api.github.com/users/openshift-pipelines/followers","following_url":"https://api.github.com/users/openshift-pipelines/following{/other_user}","gists_url":"https://api.github.com/users/openshift-pipelines/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/openshift-pipelines","id":57996262,"login":"openshift-pipelines","node_id":"MDEyOk9yZ2FuaXphdGlvbjU3OTk2MjYy","organizations_url":"https://api.github.com/users/openshift-pipelines/orgs","received_events_url":"https://api.github.com/users/openshift-pipelines/received_events","repos_url":"https://api.github.com/users/openshift-pipelines/repos","site_admin":false,"starred_url":"https://api.github.com/users/openshift-pipelines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift-pipelines/subscriptions","type":"Organization","url":"https://api.github.com/users/openshift-pipelines"}},"body":"- Fix linting error  in payload Replace
+- Resolve pipelinespec embedded in PipelineRun too
+","changed_files":3,"closed_at":null,"comments":0,"comments_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues/3/comments","commits":2,"commits_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls/3/commits","created_at":"2021-04-27T19:26:47Z","deletions":26,"diff_url":"https://github.com/openshift-pipelines/pipelines-as-code/pull/3.diff","draft":false,"head":{"label":"chmouel:fix-resolve-pipelinespec","ref":"fix-resolve-pipelinespec","repo":{"allow_merge_commit":true,"allow_rebase_merge":true,"allow_squash_merge":true,"archive_url":"https://api.github.com/repos/chmouel/pipelines-as-code/{archive_format}{/ref}","archived":false,"assignees_url":"https://api.github.com/repos/chmouel/pipelines-as-code/assignees{/user}","blobs_url":"https://api.github.com/repos/chmouel/pipelines-as-code/git/blobs{/sha}","branches_url":"https://api.github.com/repos/chmouel/pipelines-as-code/branches{/branch}","clone_url":"https://github.com/chmouel/pipelines-as-code.git","collaborators_url":"https://api.github.com/repos/chmouel/pipelines-as-code/collaborators{/collaborator}","comments_url":"https://api.github.com/repos/chmouel/pipelines-as-code/comments{/number}","commits_url":"https://api.github.com/repos/chmouel/pipelines-as-code/commits{/sha}","compare_url":"https://api.github.com/repos/chmouel/pipelines-as-code/compare/{base}...{head}","contents_url":"https://api.github.com/repos/chmouel/pipelines-as-code/contents/{+path}","contributors_url":"https://api.github.com/repos/chmouel/pipelines-as-code/contributors","created_at":"2021-04-06T13:26:51Z","default_branch":"main","delete_branch_on_merge":false,"deployments_url":"https://api.github.com/repos/chmouel/pipelines-as-code/deployments","description":"Pipelines as Code","disabled":false,"downloads_url":"https://api.github.com/repos/chmouel/pipelines-as-code/downloads","events_url":"https://api.github.com/repos/chmouel/pipelines-as-code/events","fork":true,"forks":0,"forks_count":0,"forks_url":"https://api.github.com/repos/chmouel/pipelines-as-code/forks","full_name":"chmouel/pipelines-as-code","git_commits_url":"https://api.github.com/repos/chmouel/pipelines-as-code/git/commits{/sha}","git_refs_url":"https://api.github.com/repos/chmouel/pipelines-as-code/git/refs{/sha}","git_tags_url":"https://api.github.com/repos/chmouel/pipelines-as-code/git/tags{/sha}","git_url":"git://github.com/chmouel/pipelines-as-code.git","has_downloads":true,"has_issues":false,"has_pages":false,"has_projects":true,"has_wiki":true,"homepage":null,"hooks_url":"https://api.github.com/repos/chmouel/pipelines-as-code/hooks","html_url":"https://github.com/chmouel/pipelines-as-code","id":355198074,"issue_comment_url":"https://api.github.com/repos/chmouel/pipelines-as-code/issues/comments{/number}","issue_events_url":"https://api.github.com/repos/chmouel/pipelines-as-code/issues/events{/number}","issues_url":"https://api.github.com/repos/chmouel/pipelines-as-code/issues{/number}","keys_url":"https://api.github.com/repos/chmouel/pipelines-as-code/keys{/key_id}","labels_url":"https://api.github.com/repos/chmouel/pipelines-as-code/labels{/name}","language":null,"languages_url":"https://api.github.com/repos/chmouel/pipelines-as-code/languages","license":{"key":"apache-2.0","name":"Apache License 2.0","node_id":"MDc6TGljZW5zZTI=","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"merges_url":"https://api.github.com/repos/chmouel/pipelines-as-code/merges","milestones_url":"https://api.github.com/repos/chmouel/pipelines-as-code/milestones{/number}","mirror_url":null,"name":"pipelines-as-code","node_id":"MDEwOlJlcG9zaXRvcnkzNTUxOTgwNzQ=","notifications_url":"https://api.github.com/repos/chmouel/pipelines-as-code/notifications{?since,all,participating}","open_issues":0,"open_issues_count":0,"owner":{"avatar_url":"https://avatars.githubusercontent.com/u/98980?v=4","events_url":"https://api.github.com/users/chmouel/events{/privacy}","followers_url":"https://api.github.com/users/chmouel/followers","following_url":"https://api.github.com/users/chmouel/following{/other_user}","gists_url":"https://api.github.com/users/chmouel/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/chmouel","id":98980,"login":"chmouel","node_id":"MDQ6VXNlcjk4OTgw","organizations_url":"https://api.github.com/users/chmouel/orgs","received_events_url":"https://api.github.com/users/chmouel/received_events","repos_url":"https://api.github.com/users/chmouel/repos","site_admin":false,"starred_url":"https://api.github.com/users/chmouel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chmouel/subscriptions","type":"User","url":"https://api.github.com/users/chmouel"},"private":false,"pulls_url":"https://api.github.com/repos/chmouel/pipelines-as-code/pulls{/number}","pushed_at":"2021-04-27T19:26:46Z","releases_url":"https://api.github.com/repos/chmouel/pipelines-as-code/releases{/id}","size":5,"ssh_url":"git@github.com:chmouel/pipelines-as-code.git","stargazers_count":0,"stargazers_url":"https://api.github.com/repos/chmouel/pipelines-as-code/stargazers","statuses_url":"https://api.github.com/repos/chmouel/pipelines-as-code/statuses/{sha}","subscribers_url":"https://api.github.com/repos/chmouel/pipelines-as-code/subscribers","subscription_url":"https://api.github.com/repos/chmouel/pipelines-as-code/subscription","svn_url":"https://github.com/chmouel/pipelines-as-code","tags_url":"https://api.github.com/repos/chmouel/pipelines-as-code/tags","teams_url":"https://api.github.com/repos/chmouel/pipelines-as-code/teams","trees_url":"https://api.github.com/repos/chmouel/pipelines-as-code/git/trees{/sha}","updated_at":"2021-04-06T15:19:15Z","url":"https://api.github.com/repos/chmouel/pipelines-as-code","watchers":0,"watchers_count":0},"sha":"857cfa78d2f1f273013702e7151514f4f27d9291","user":{"avatar_url":"https://avatars.githubusercontent.com/u/98980?v=4","events_url":"https://api.github.com/users/chmouel/events{/privacy}","followers_url":"https://api.github.com/users/chmouel/followers","following_url":"https://api.github.com/users/chmouel/following{/other_user}","gists_url":"https://api.github.com/users/chmouel/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/chmouel","id":98980,"login":"chmouel","node_id":"MDQ6VXNlcjk4OTgw","organizations_url":"https://api.github.com/users/chmouel/orgs","received_events_url":"https://api.github.com/users/chmouel/received_events","repos_url":"https://api.github.com/users/chmouel/repos","site_admin":false,"starred_url":"https://api.github.com/users/chmouel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chmouel/subscriptions","type":"User","url":"https://api.github.com/users/chmouel"}},"html_url":"https://github.com/openshift-pipelines/pipelines-as-code/pull/3","id":624596967,"issue_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues/3","labels":[],"locked":false,"maintainer_can_modify":true,"merge_commit_sha":null,"mergeable":null,"mergeable_state":"unknown","merged":false,"merged_at":null,"merged_by":null,"milestone":null,"node_id":"MDExOlB1bGxSZXF1ZXN0NjI0NTk2OTY3","number":3,"patch_url":"https://github.com/openshift-pipelines/pipelines-as-code/pull/3.patch","rebaseable":null,"requested_reviewers":[],"requested_teams":[],"review_comment_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls/comments{/number}","review_comments":0,"review_comments_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls/3/comments","state":"open","statuses_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/statuses/857cfa78d2f1f273013702e7151514f4f27d9291","title":"fix resolve pipelinespec","updated_at":"2021-04-27T19:26:47Z","url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls/3","user":{"avatar_url":"https://avatars.githubusercontent.com/u/98980?v=4","events_url":"https://api.github.com/users/chmouel/events{/privacy}","followers_url":"https://api.github.com/users/chmouel/followers","following_url":"https://api.github.com/users/chmouel/following{/other_user}","gists_url":"https://api.github.com/users/chmouel/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/chmouel","id":98980,"login":"chmouel","node_id":"MDQ6VXNlcjk4OTgw","organizations_url":"https://api.github.com/users/chmouel/orgs","received_events_url":"https://api.github.com/users/chmouel/received_events","repos_url":"https://api.github.com/users/chmouel/repos","site_admin":false,"starred_url":"https://api.github.com/users/chmouel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chmouel/subscriptions","type":"User","url":"https://api.github.com/users/chmouel"}},"repository":{"archive_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/{archive_format}{/ref}","archived":false,"assignees_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/assignees{/user}","blobs_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/blobs{/sha}","branches_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/branches{/branch}","clone_url":"https://github.com/openshift-pipelines/pipelines-as-code.git","collaborators_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/collaborators{/collaborator}","comments_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/comments{/number}","commits_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/commits{/sha}","compare_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/compare/{base}...{head}","contents_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/contents/{+path}","contributors_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/contributors","created_at":"2021-04-06T13:26:01Z","default_branch":"main","deployments_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/deployments","description":"Pipelines as Code","disabled":false,"downloads_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/downloads","events_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/events","fork":false,"forks":3,"forks_count":3,"forks_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/forks","full_name":"openshift-pipelines/pipelines-as-code","git_commits_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/commits{/sha}","git_refs_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/refs{/sha}","git_tags_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/tags{/sha}","git_url":"git://github.com/openshift-pipelines/pipelines-as-code.git","has_downloads":true,"has_issues":true,"has_pages":false,"has_projects":true,"has_wiki":true,"homepage":null,"hooks_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/hooks","html_url":"https://github.com/openshift-pipelines/pipelines-as-code","id":355197825,"issue_comment_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues/comments{/number}","issue_events_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues/events{/number}","issues_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/issues{/number}","keys_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/keys{/key_id}","labels_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/labels{/name}","language":"Go","languages_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/languages","license":{"key":"apache-2.0","name":"Apache License 2.0","node_id":"MDc6TGljZW5zZTI=","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"merges_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/merges","milestones_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/milestones{/number}","mirror_url":null,"name":"pipelines-as-code","node_id":"MDEwOlJlcG9zaXRvcnkzNTUxOTc4MjU=","notifications_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/notifications{?since,all,participating}","open_issues":1,"open_issues_count":1,"owner":{"avatar_url":"https://avatars.githubusercontent.com/u/57996262?v=4","events_url":"https://api.github.com/users/openshift-pipelines/events{/privacy}","followers_url":"https://api.github.com/users/openshift-pipelines/followers","following_url":"https://api.github.com/users/openshift-pipelines/following{/other_user}","gists_url":"https://api.github.com/users/openshift-pipelines/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/openshift-pipelines","id":57996262,"login":"openshift-pipelines","node_id":"MDEyOk9yZ2FuaXphdGlvbjU3OTk2MjYy","organizations_url":"https://api.github.com/users/openshift-pipelines/orgs","received_events_url":"https://api.github.com/users/openshift-pipelines/received_events","repos_url":"https://api.github.com/users/openshift-pipelines/repos","site_admin":false,"starred_url":"https://api.github.com/users/openshift-pipelines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift-pipelines/subscriptions","type":"Organization","url":"https://api.github.com/users/openshift-pipelines"},"private":false,"pulls_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/pulls{/number}","pushed_at":"2021-04-27T16:10:20Z","releases_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/releases{/id}","size":9122,"ssh_url":"git@github.com:openshift-pipelines/pipelines-as-code.git","stargazers_count":1,"stargazers_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/stargazers","statuses_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/statuses/{sha}","subscribers_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/subscribers","subscription_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/subscription","svn_url":"https://github.com/openshift-pipelines/pipelines-as-code","tags_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/tags","teams_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/teams","trees_url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code/git/trees{/sha}","updated_at":"2021-04-27T16:10:24Z","url":"https://api.github.com/repos/openshift-pipelines/pipelines-as-code","watchers":1,"watchers_count":1},"sender":{"avatar_url":"https://avatars.githubusercontent.com/u/98980?v=4","events_url":"https://api.github.com/users/chmouel/events{/privacy}","followers_url":"https://api.github.com/users/chmouel/followers","following_url":"https://api.github.com/users/chmouel/following{/other_user}","gists_url":"https://api.github.com/users/chmouel/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/chmouel","id":98980,"login":"chmouel","node_id":"MDQ6VXNlcjk4OTgw","organizations_url":"https://api.github.com/users/chmouel/orgs","received_events_url":"https://api.github.com/users/chmouel/received_events","repos_url":"https://api.github.com/users/chmouel/repos","site_admin":false,"starred_url":"https://api.github.com/users/chmouel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chmouel/subscriptions","type":"User","url":"https://api.github.com/users/chmouel"}}