Repository: openshift-pipelines/pipelines-as-code
Pull request #354 (2021-11-05 12:00:52)

Hub and Remote tasks settings
* let user change the tekton hub base url via configmap setting
* let user be able to disable all remote tasks via configmap setting

Part of https://issues.redhat.com/browse/SRVKP-1748


Patch:
diff --git a/config/302-pac-configmap.yaml b/config/302-pac-configmap.yaml
index d4eb306b..ebd48b50 100644
--- a/config/302-pac-configmap.yaml
+++ b/config/302-pac-configmap.yaml
@@ -23,6 +23,12 @@ data:
   # Wether to automatically create a secret with the token to be use by git-clone
   secret-auto-create: "true"
 
+  # Tekton HUB API urls
+  hub-url: "https://api.hub.tekton.dev/v1"
+
+  # Wether to allow fetching remote tasks
+  remote-tasks: "true"
+
   # Since public bitbucket doesn't have the concept of Secret, we need to be
   # able to secure the request by querying https://ip-ranges.atlassian.com/,
   # this only happen for public bitbucket (ie: when provider.url is not set in
diff --git a/docs/install.md b/docs/install.md
index 0079578b..6c003be7 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -454,6 +454,18 @@ the `pipelines-as-code` namespace.
   application to be used with private repositories. This feature is enabled by
   default.
 
+- `remote-tasks`
+
+  Let allows remote tasks from pipelinerun annotations. This feature is enabled by
+  default.
+
+- `hub-url`
+
+  The base url for the [tekton hub](https://github.com/tektoncd/hub/)
+  API. default to the [public hub](https://hub.tekton.dev/):
+
+  <https://api.hub.tekton.dev/v1>
+
 ## Kubernetes
 
 Pipelines as Code should work directly on kubernetes/minikube/kind. You just need to install the release.yaml
diff --git a/pkg/cmd/tknpac/repository/describe.go b/pkg/cmd/tknpac/repository/describe.go
index c4cb1cbe..98e616ff 100644
--- a/pkg/cmd/tknpac/repository/describe.go
+++ b/pkg/cmd/tknpac/repository/describe.go
@@ -3,7 +3,6 @@ package repository
 import (
 	"context"
 	"fmt"
-	"os"
 	"strings"
 	"text/tabwriter"
 	"text/template"
@@ -16,7 +15,6 @@ import (
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/cli"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/cli/prompt"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/completion"
-	"github.com/openshift-pipelines/pipelines-as-code/pkg/consoleui"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/formatting"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/params"
 	sortrepostatus "github.com/openshift-pipelines/pipelines-as-code/pkg/sort"
@@ -29,34 +27,30 @@ const (
 	describeTemplate = `{{ $.ColorScheme.Bold "Name" }}:	{{.Repository.Name}}
 {{ $.ColorScheme.Bold "Namespace" }}:	{{.Repository.Namespace}}
 {{ $.ColorScheme.Bold "URL" }}:	{{.Repository.Spec.URL}}
-{{- if eq (len .Statuses) 0 }}
-
+{{- if eq (len .Repository.Status) 0 }}
 {{ $.ColorScheme.Dimmed "No runs has started."}}
 {{- else }}
 {{- $status := (index .Statuses 0) }}
 
-{{- if (gt (len .Statuses) 1) }}
-
-{{ $.ColorScheme.Underline "Last Run:" }} 
-{{ end }}
-{{ $.ColorScheme.Bold "Status:" }}	{{ $.ColorScheme.ColorStatus (index $status.Status.Conditions 0).Reason  }}
-{{ $.ColorScheme.Bold "Log:"  }}	{{ $status.LogURL}}
-{{ $.ColorScheme.Bold "PipelineRun:" }}	{{ $.ColorScheme.HyperLink $status.PipelineRunName $status.LogURL }}
-{{ $.ColorScheme.Bold "Event:" }}	{{ $status.EventType }}
-{{ $.ColorScheme.Bold "Branch:" }}	{{ sanitizeBranch $status.TargetBranch }}
-{{ $.ColorScheme.Bold "Commit URL:" }}	{{ $status.SHAURL }}
-{{ $.ColorScheme.Bold "Commit Title:" }}	{{ $status.Title }}
-{{ $.ColorScheme.Bold "StartTime:" }}	{{ formatTime $status.StartTime $.Clock }}
+{{ $.ColorScheme.Bold "Last Run:" }} 
+
+Status:	{{ $.ColorScheme.ColorStatus (index $status.Status.Conditions 0).Reason  }}
+PipelineRun:	{{ $.ColorScheme.HyperLink $status.PipelineRunName $status.LogURL }}
+Event:	{{ $status.EventType }}
+Branch:	{{ sanitizeBranch $status.TargetBranch }}
+Commit URL:	{{ $status.SHAURL }}
+Commit Title:	{{ $status.Title }}
+StartTime:	{{ formatTime $status.StartTime $.Clock }}
 {{- if $status.CompletionTime }}
-{{ $.ColorScheme.Bold "Duration:" }}	{{ formatDuration $status.StartTime $status.CompletionTime }}
+Duration:	{{ formatDuration $status.StartTime $status.CompletionTime }}
 {{- end }}
-{{- if (gt (len .Statuses) 1) }}
+{{- if gt (len .Repository.Status) 1 }}
 
-{{ $.ColorScheme.Underline "Other Runs:" }}
+{{ $.ColorScheme.Bold "Other Runs:" }}
 
 STATUS	Event	Branch	 SHA	 STARTED TIME	DURATION	PIPELINERUN
 ――――――	―――――	――――――	 ―――	 ――――――――――――	――――――――	―――――――――――
-{{- range $i, $st := (slice .Statuses 1 (len .Statuses)) }}
+{{- range $i, $st := (slice .Statuses 1 (len .Repository.Status)) }}
 {{ formatStatus $st $.ColorScheme $.Clock }}
 {{- end }}
 {{- end }}
@@ -151,13 +145,6 @@ func DescribeCommand(run *params.Run, ioStreams *cli.IOStreams) *cobra.Command {
 			if err != nil {
 				return err
 			}
-
-			// The only way to know the tekton dashboard url is if the user specify it because we are not supposed to have access to the configmap.
-			// so let the user specify a env variable to implicitly set tekton dashboard
-			if os.Getenv("TEKTON_DASHBOARD_URL") != "" {
-				run.Clients.ConsoleUI = &consoleui.TektonDashboard{BaseURL: os.Getenv("TEKTON_DASHBOARD_URL")}
-			}
-
 			return describe(ctx, run, clock, opts, ioStreams, repoName)
 		},
 	}
@@ -239,21 +226,19 @@ func getLivePRAndRepostatus(ctx context.Context, cs *params.Run, repository *v1a
 	}
 
 	for _, pr := range prs.Items {
-		logurl := cs.Clients.ConsoleUI.DetailURL(pr.GetNamespace(), pr.GetName())
 		if pr.Status.Conditions == nil || len(pr.Status.Conditions) == 0 {
-			repositorystatus = convertPrStatusToRepositoryStatus(repositorystatus, pr, logurl)
+			repositorystatus = convertPrStatusToRepositoryStatus(repositorystatus, pr)
 		} else if pr.Status.Conditions[0].Reason == tektonv1beta1.PipelineRunReasonRunning.String() {
-			repositorystatus = convertPrStatusToRepositoryStatus(repositorystatus, pr, logurl)
+			repositorystatus = convertPrStatusToRepositoryStatus(repositorystatus, pr)
 		}
 	}
-
 	return sortrepostatus.RepositorySortRunStatus(repositorystatus)
 }
 
-func convertPrStatusToRepositoryStatus(repositorystatus []v1alpha1.RepositoryRunStatus, pr tektonv1beta1.PipelineRun, logurl string) []v1alpha1.RepositoryRunStatus {
+func convertPrStatusToRepositoryStatus(repositorystatus []v1alpha1.RepositoryRunStatus, pr tektonv1beta1.PipelineRun) []v1alpha1.RepositoryRunStatus {
 	return append(repositorystatus, v1alpha1.RepositoryRunStatus{
 		Status:          pr.Status.Status,
-		LogURL:          &logurl,
+		LogURL:          new(string),
 		PipelineRunName: pr.GetName(),
 		StartTime:       pr.Status.StartTime,
 		SHA:             github.String(pr.GetLabels()["pipelinesascode.tekton.dev/sha"]),
diff --git a/pkg/hub/get.go b/pkg/hub/get.go
index 87d98f12..53afffdb 100644
--- a/pkg/hub/get.go
+++ b/pkg/hub/get.go
@@ -9,18 +9,15 @@ import (
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/params"
 )
 
-var (
-	tektonCatalogHubName = `tekton`
-	hubBaseURL           = `https://api.hub.tekton.dev/v1`
-)
+var tektonCatalogHubName = `tekton`
 
-func getSpecificVersion(ctx context.Context, cli *params.Run, task string) (string, error) {
+func getSpecificVersion(ctx context.Context, cs *params.Run, task string) (string, error) {
 	split := strings.Split(task, ":")
 	version := split[len(split)-1]
 	taskName := split[0]
 	hr := hubResourceVersion{}
-	data, err := cli.Clients.GetURL(ctx,
-		fmt.Sprintf("%s/resource/%s/task/%s/%s", hubBaseURL, tektonCatalogHubName, taskName, version))
+	data, err := cs.Clients.GetURL(ctx,
+		fmt.Sprintf("%s/resource/%s/task/%s/%s", cs.Info.Pac.HubURL, tektonCatalogHubName, taskName, version))
 	if err != nil {
 		return "", fmt.Errorf("could not fetch specific task version from the hub %s:%s: %w", task, version, err)
 	}
@@ -31,9 +28,9 @@ func getSpecificVersion(ctx context.Context, cli *params.Run, task string) (stri
 	return *hr.Data.RawURL, nil
 }
 
-func getLatestVersion(ctx context.Context, cli *params.Run, task string) (string, error) {
+func getLatestVersion(ctx context.Context, cs *params.Run, task string) (string, error) {
 	hr := new(hubResource)
-	data, err := cli.Clients.GetURL(ctx, fmt.Sprintf("%s/resource/%s/task/%s", hubBaseURL, tektonCatalogHubName, task))
+	data, err := cs.Clients.GetURL(ctx, fmt.Sprintf("%s/resource/%s/task/%s", cs.Info.Pac.HubURL, tektonCatalogHubName, task))
 	if err != nil {
 		return "", err
 	}
diff --git a/pkg/params/info/defaults.go b/pkg/params/info/defaults.go
index 21c106d7..1bac2f00 100644
--- a/pkg/params/info/defaults.go
+++ b/pkg/params/info/defaults.go
@@ -4,4 +4,5 @@ const (
 	PACInstallNS       = "pipelines-as-code"
 	PACConfigmapNS     = "pipelines-as-code"
 	PACApplicationName = "Pipelines as Code CI"
+	HubURL             = "https://api.hub.tekton.dev/v1"
 )
diff --git a/pkg/params/info/pac.go b/pkg/params/info/pac.go
index 1dcd42f2..79708d32 100644
--- a/pkg/params/info/pac.go
+++ b/pkg/params/info/pac.go
@@ -19,6 +19,8 @@ type PacOpts struct {
 	WebhookType          string
 	PayloadFile          string
 	TektonDashboardURL   string
+	HubURL               string
+	RemoteTasks          bool
 }
 
 func (p *PacOpts) AddFlags(cmd *cobra.Command) error {
diff --git a/pkg/params/run.go b/pkg/params/run.go
index 559b0b37..1e1a27de 100644
--- a/pkg/params/run.go
+++ b/pkg/params/run.go
@@ -16,6 +16,14 @@ type Run struct {
 	Info    info.Info
 }
 
+func StringToBool(s string) bool {
+	if strings.ToLower(s) == "true" ||
+		strings.ToLower(s) == "yes" || s == "1" {
+		return true
+	}
+	return false
+}
+
 // GetConfigFromConfigMap get config from configmap, we should remove all the
 // logics from cobra flags and just support configmap config and env config in the future.
 func (r *Run) GetConfigFromConfigMap(ctx context.Context) error {
@@ -33,13 +41,7 @@ func (r *Run) GetConfigFromConfigMap(ctx context.Context) error {
 	}
 
 	if secretAutoCreation, ok := cfg.Data["secret-auto-create"]; ok {
-		sv := false
-
-		if strings.ToLower(secretAutoCreation) == "true" ||
-			strings.ToLower(secretAutoCreation) == "yes" || secretAutoCreation == "1" {
-			sv = true
-		}
-		r.Info.Pac.SecretAutoCreation = sv
+		r.Info.Pac.SecretAutoCreation = StringToBool(secretAutoCreation)
 	}
 
 	if tektonDashboardURL, ok := cfg.Data["tekton-dashboard-url"]; ok {
@@ -50,6 +52,17 @@ func (r *Run) GetConfigFromConfigMap(ctx context.Context) error {
 		r.Clients.Log.Infof("using tekton dashboard url on: %s", os.Getenv("PAC_TEKTON_DASHBOARD_URL"))
 		r.Clients.ConsoleUI = &consoleui.TektonDashboard{BaseURL: os.Getenv("PAC_TEKTON_DASHBOARD_URL")}
 	}
+
+	if hubURL, ok := cfg.Data["hub-url"]; ok {
+		r.Info.Pac.HubURL = hubURL
+	} else {
+		r.Info.Pac.HubURL = info.HubURL
+	}
+
+	if remoteTask, ok := cfg.Data["remote-tasks"]; ok {
+		r.Info.Pac.RemoteTasks = StringToBool(remoteTask)
+	}
+
 	return nil
 }
 
diff --git a/pkg/pipelineascode/pipelineascode.go b/pkg/pipelineascode/pipelineascode.go
index badc2b61..c1e8f90c 100644
--- a/pkg/pipelineascode/pipelineascode.go
+++ b/pkg/pipelineascode/pipelineascode.go
@@ -207,6 +207,6 @@ func getAllPipelineRuns(ctx context.Context, cs *params.Run, providerintf provid
 	// Merge everything (i.e: tasks/pipeline etc..) as a single pipelinerun
 	return resolve.Resolve(ctx, cs, providerintf, allTemplates, &resolve.Opts{
 		GenerateName: true,
-		RemoteTasks:  true, // TODO: add an option to disable remote tasking,
+		RemoteTasks:  cs.Info.Pac.RemoteTasks,
 	})
 }
diff --git a/pkg/provider/bitbucketcloud/events.go b/pkg/provider/bitbucketcloud/events.go
index ba6b6a3b..85210e71 100644
--- a/pkg/provider/bitbucketcloud/events.go
+++ b/pkg/provider/bitbucketcloud/events.go
@@ -25,7 +25,7 @@ func lastForwarderForIP(xff string) string {
 // checkFromPublicCloudIPS Grab public IP from public cloud and make sure we match it
 func (v *Provider) checkFromPublicCloudIPS(ctx context.Context, run *params.Run) (bool, error) {
 	enval, ok := os.LookupEnv("PAC_BITBUCKET_CLOUD_CHECK_SOURCE_IP")
-	if !ok || strings.ToLower(enval) != "true" {
+	if !ok || !params.StringToBool(enval) {
 		return true, nil
 	}
 


Test patch:
diff --git a/pkg/cmd/tknpac/repository/describe_test.go b/pkg/cmd/tknpac/repository/describe_test.go
index dec5516a..6b551e01 100644
--- a/pkg/cmd/tknpac/repository/describe_test.go
+++ b/pkg/cmd/tknpac/repository/describe_test.go
@@ -12,7 +12,6 @@ import (
 	"github.com/jonboulle/clockwork"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/apis/pipelinesascode/v1alpha1"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/cli"
-	"github.com/openshift-pipelines/pipelines-as-code/pkg/consoleui"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/params"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/params/clients"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/params/info"
@@ -55,7 +54,7 @@ func TestDescribe(t *testing.T) {
 		wantErr bool
 	}{
 		{
-			name: "live run and repository run",
+			name: "Describe a Pipeline with a Live Run and a Repository Run",
 			args: args{
 				repoName:         "test-run",
 				currentNamespace: ns,
@@ -65,7 +64,6 @@ func TestDescribe(t *testing.T) {
 						map[string]string{
 							"pipelinesascode.tekton.dev/repository": "test-run",
 							"pipelinesascode.tekton.dev/branch":     "tartanpion",
-							"pipelinesascode.tekton.dev/event-type": "papayolo",
 						}, 30),
 				},
 				statuses: []v1alpha1.RepositoryRunStatus{
@@ -85,53 +83,13 @@ func TestDescribe(t *testing.T) {
 						SHAURL:          github.String("https://anurl.com/commit/SHA"),
 						Title:           github.String("A title"),
 						TargetBranch:    github.String("TargetBranch"),
-						EventType:       github.String("propseryouplaboun"),
 					},
 				},
 			},
 			wantErr: false,
 		},
 		{
-			name: "one live run",
-			args: args{
-				repoName:         "test-run",
-				currentNamespace: ns,
-				opts:             &cli.PacCliOpts{},
-				pruns: []*tektonv1beta1.PipelineRun{
-					tektontest.MakePRCompletion(cw, "running", ns, running,
-						map[string]string{
-							"pipelinesascode.tekton.dev/repository": "test-run",
-							"pipelinesascode.tekton.dev/branch":     "tartanpion",
-						}, 30),
-				},
-				statuses: []v1alpha1.RepositoryRunStatus{},
-			},
-			wantErr: false,
-		},
-		{
-			name: "multiple live runs",
-			args: args{
-				repoName:         "test-run",
-				currentNamespace: ns,
-				opts:             &cli.PacCliOpts{},
-				pruns: []*tektonv1beta1.PipelineRun{
-					tektontest.MakePRCompletion(cw, "running", ns, running,
-						map[string]string{
-							"pipelinesascode.tekton.dev/repository": "test-run",
-							"pipelinesascode.tekton.dev/branch":     "tartanpion",
-						}, 30),
-					tektontest.MakePRCompletion(cw, "running2", ns, running,
-						map[string]string{
-							"pipelinesascode.tekton.dev/repository": "test-run",
-							"pipelinesascode.tekton.dev/branch":     "vavaroom",
-						}, 30),
-				},
-				statuses: []v1alpha1.RepositoryRunStatus{},
-			},
-			wantErr: false,
-		},
-		{
-			name: "one repository status and optnamespace",
+			name: "Describe a Pipeline with a Single Run - optnamespace",
 			args: args{
 				repoName:         "test-run",
 				currentNamespace: "namespace",
@@ -161,7 +119,7 @@ func TestDescribe(t *testing.T) {
 			wantErr: false,
 		},
 		{
-			name: "multiple repo status",
+			name: "Describe a Pipeline with a Multiple Run",
 			args: args{
 				opts:             &cli.PacCliOpts{},
 				repoName:         "test-run",
@@ -244,7 +202,6 @@ func TestDescribe(t *testing.T) {
 				Clients: clients.Clients{
 					PipelineAsCode: stdata.PipelineAsCode,
 					Tekton:         stdata.Pipeline,
-					ConsoleUI:      consoleui.FallBackConsole{},
 				},
 				Info: info.Info{Kube: info.KubeOpts{Namespace: tt.args.currentNamespace}},
 			}
diff --git a/pkg/cmd/tknpac/repository/testdata/TestCommands-Describe.golden b/pkg/cmd/tknpac/repository/testdata/TestCommands-Describe.golden
index 17c146b7..7b08e4c8 100644
--- a/pkg/cmd/tknpac/repository/testdata/TestCommands-Describe.golden
+++ b/pkg/cmd/tknpac/repository/testdata/TestCommands-Describe.golden
@@ -1,8 +1,10 @@
-Name:           repo1
-Namespace:      ns
-URL:            https://anurl.com/repo/owner
+Name:        repo1
+Namespace:   ns
+URL:         https://anurl.com/repo/owner
+
+Last Run: 
+
 Status:         Success
-Log:            https://everywhere.anwywhere
 PipelineRun:    pipelinerun1
 Event:          pull_request
 Branch:         TargetBranch
diff --git a/pkg/cmd/tknpac/repository/testdata/TestDescribe-one_live_run.golden b/pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Live_Run_and_a_Repository_Run.golden
similarity index 54%
rename from pkg/cmd/tknpac/repository/testdata/TestDescribe-one_live_run.golden
rename to pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Live_Run_and_a_Repository_Run.golden
index 92571bf5..7be98bc9 100644
--- a/pkg/cmd/tknpac/repository/testdata/TestDescribe-one_live_run.golden
+++ b/pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Live_Run_and_a_Repository_Run.golden
@@ -1,8 +1,10 @@
-Name:           test-run
-Namespace:      ns
-URL:            https://anurl.com
+Name:        test-run
+Namespace:   ns
+URL:         https://anurl.com
+
+Last Run: 
+
 Status:         Running
-Log:            https://giphy.com/search/random-dogs
 PipelineRun:    running
 Event:          
 Branch:         tartanpion
diff --git a/pkg/cmd/tknpac/repository/testdata/TestDescribe-multiple_repo_status.golden b/pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Multiple_Run.golden
similarity index 93%
rename from pkg/cmd/tknpac/repository/testdata/TestDescribe-multiple_repo_status.golden
rename to pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Multiple_Run.golden
index db85bd51..43406bed 100644
--- a/pkg/cmd/tknpac/repository/testdata/TestDescribe-multiple_repo_status.golden
+++ b/pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Multiple_Run.golden
@@ -5,7 +5,6 @@ URL:         https://anurl.com
 Last Run: 
 
 Status:         Success
-Log:            https://everywhere.anwywhere
 PipelineRun:    pipelinerun1
 Event:          pull_request
 Branch:         TargetBranch
diff --git a/pkg/cmd/tknpac/repository/testdata/TestDescribe-one_repository_status_and_optnamespace.golden b/pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Single_Run_-_optnamespace.golden
similarity index 63%
rename from pkg/cmd/tknpac/repository/testdata/TestDescribe-one_repository_status_and_optnamespace.golden
rename to pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Single_Run_-_optnamespace.golden
index 676b392f..988184f4 100644
--- a/pkg/cmd/tknpac/repository/testdata/TestDescribe-one_repository_status_and_optnamespace.golden
+++ b/pkg/cmd/tknpac/repository/testdata/TestDescribe-Describe_a_Pipeline_with_a_Single_Run_-_optnamespace.golden
@@ -1,8 +1,10 @@
-Name:           test-run
-Namespace:      optnamespace
-URL:            https://anurl.com
+Name:        test-run
+Namespace:   optnamespace
+URL:         https://anurl.com
+
+Last Run: 
+
 Status:         Success
-Log:            https://everywhere.anwywhere
 PipelineRun:    pipelinerun1
 Event:          <nil>
 Branch:         TargetBranch
diff --git a/pkg/cmd/tknpac/repository/testdata/TestDescribe-live_run_and_repository_run.golden b/pkg/cmd/tknpac/repository/testdata/TestDescribe-live_run_and_repository_run.golden
deleted file mode 100644
index d146dadf..00000000
--- a/pkg/cmd/tknpac/repository/testdata/TestDescribe-live_run_and_repository_run.golden
+++ /dev/null
@@ -1,20 +0,0 @@
-Name:        test-run
-Namespace:   ns
-URL:         https://anurl.com
-
-Last Run: 
-
-Status:         Running
-Log:            https://giphy.com/search/random-dogs
-PipelineRun:    running
-Event:          papayolo
-Branch:         tartanpion
-Commit URL:     
-Commit Title:   
-StartTime:      -35 minutes ago
-
-Other Runs:
-
-STATUS    Event               Branch          SHA    STARTED TIME    DURATION   PIPELINERUN
-――――――    ―――――               ――――――          ―――    ――――――――――――    ――――――――   ―――――――――――
-Success   propseryouplaboun   TargetBranch   SHA    16 minutes ago   1 minute   pipelinerun1
diff --git a/pkg/cmd/tknpac/repository/testdata/TestDescribe-multiple_live_runs.golden b/pkg/cmd/tknpac/repository/testdata/TestDescribe-multiple_live_runs.golden
deleted file mode 100644
index 41d73e05..00000000
--- a/pkg/cmd/tknpac/repository/testdata/TestDescribe-multiple_live_runs.golden
+++ /dev/null
@@ -1,20 +0,0 @@
-Name:        test-run
-Namespace:   ns
-URL:         https://anurl.com
-
-Last Run: 
-
-Status:         Running
-Log:            https://giphy.com/search/random-dogs
-PipelineRun:    running
-Event:          
-Branch:         tartanpion
-Commit URL:     
-Commit Title:   
-StartTime:      -35 minutes ago
-
-Other Runs:
-
-STATUS    Event   Branch      SHA    STARTED TIME     DURATION   PIPELINERUN
-――――――    ―――――   ――――――      ―――    ――――――――――――     ――――――――   ―――――――――――
-Running           vavaroom          -35 minutes ago   ---        running2
diff --git a/pkg/hub/get_test.go b/pkg/hub/get_test.go
index 3fa9e3b3..dfac361c 100644
--- a/pkg/hub/get_test.go
+++ b/pkg/hub/get_test.go
@@ -6,11 +6,14 @@ import (
 
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/params"
 	"github.com/openshift-pipelines/pipelines-as-code/pkg/params/clients"
+	"github.com/openshift-pipelines/pipelines-as-code/pkg/params/info"
 	httptesthelper "github.com/openshift-pipelines/pipelines-as-code/pkg/test/http"
 	rtesting "knative.dev/pkg/reconciler/testing"
 )
 
 func TestGetTask(t *testing.T) {
+	const testHubURL = "https://myprecioushub"
+
 	tests := []struct {
 		name    string
 		task    string
@@ -24,7 +27,7 @@ func TestGetTask(t *testing.T) {
 			want:    "This is Task1",
 			wantErr: false,
 			config: map[string]map[string]string{
-				fmt.Sprintf("%s/resource/%s/task/task1", hubBaseURL, tektonCatalogHubName): {
+				fmt.Sprintf("%s/resource/%s/task/task1", testHubURL, tektonCatalogHubName): {
 					"body": `{"data":{"latestVersion": {"rawURL": "https://get.me/task1"}}}`,
 					"code": "200",
 				},
@@ -39,7 +42,7 @@ func TestGetTask(t *testing.T) {
 			task:    "task1",
 			wantErr: true,
 			config: map[string]map[string]string{
-				fmt.Sprintf("%s/resource/%s/task/task1", hubBaseURL, tektonCatalogHubName): {
+				fmt.Sprintf("%s/resource/%s/task/task1", testHubURL, tektonCatalogHubName): {
 					"code": "404",
 				},
 			},
@@ -49,7 +52,7 @@ func TestGetTask(t *testing.T) {
 			task:    "task1:1.1",
 			wantErr: true,
 			config: map[string]map[string]string{
-				fmt.Sprintf("%s/resource/%s/task/task1/1.1", hubBaseURL, tektonCatalogHubName): {
+				fmt.Sprintf("%s/resource/%s/task/task1/1.1", testHubURL, tektonCatalogHubName): {
 					"code": "404",
 				},
 			},
@@ -60,7 +63,7 @@ func TestGetTask(t *testing.T) {
 			want:    "This is Task2",
 			wantErr: false,
 			config: map[string]map[string]string{
-				fmt.Sprintf("%s/resource/%s/task/task2/1.1", hubBaseURL, tektonCatalogHubName): {
+				fmt.Sprintf("%s/resource/%s/task/task2/1.1", testHubURL, tektonCatalogHubName): {
 					"body": `{"data":{"rawURL": "https://get.me/task2"}}`,
 					"code": "200",
 				},
@@ -79,6 +82,7 @@ func TestGetTask(t *testing.T) {
 				Clients: clients.Clients{
 					HTTP: *httpTestClient,
 				},
+				Info: info.Info{Pac: &info.PacOpts{HubURL: testHubURL}},
 			}
 			got, err := GetTask(ctx, cs, tt.task)
 			if (err != nil) != tt.wantErr {
diff --git a/pkg/matcher/annotation_tasks_install_test.go b/pkg/matcher/annotation_tasks_install_test.go
index c7e6ef0c..18715ea4 100644
--- a/pkg/matcher/annotation_tasks_install_test.go
+++ b/pkg/matcher/annotation_tasks_install_test.go
@@ -27,7 +27,8 @@ func TestMain(m *testing.M) {
 }
 
 func TestRemoteTasksGetTaskFromAnnotations(t *testing.T) {
-	simpletask := `---
+	const testHubURL = "https://mybelovedhub"
+	const simpletask = `---
 apiVersion: tekton.dev/v1beta1
 kind: Task
 metadata:
@@ -132,7 +133,7 @@ spec:
 				pipelinesascode.GroupName + "/task": "[chmouzie]",
 			},
 			remoteURLS: map[string]map[string]string{
-				"https://api.hub.tekton.dev/v1/resource/tekton/task/chmouzie": {
+				testHubURL + "/resource/tekton/task/chmouzie": {
 					"body": `{"data": {"LatestVersion": {"RawURL": "http://simple.task"}}}`,
 					"code": "200",
 				},
@@ -149,7 +150,7 @@ spec:
 				pipelinesascode.GroupName + "/task": "[chmouzie:0.2]",
 			},
 			remoteURLS: map[string]map[string]string{
-				"https://api.hub.tekton.dev/v1/resource/tekton/task/chmouzie/0.2": {
+				testHubURL + "/resource/tekton/task/chmouzie/0.2": {
 					"body": `{"data": {"RawURL": "http://simple.task"}}`,
 					"code": "200",
 				},
@@ -167,7 +168,12 @@ spec:
 				Clients: clients.Clients{
 					HTTP: *httpTestClient,
 				},
-				Info: info.Info{Event: &tt.runevent},
+				Info: info.Info{
+					Event: &tt.runevent,
+					Pac: &info.PacOpts{
+						HubURL: testHubURL,
+					},
+				},
 			}
 			ctx, _ := rtesting.SetupFakeContext(t)
 			rt := RemoteTasks{
diff --git a/pkg/resolve/resolve_test.go b/pkg/resolve/resolve_test.go
index d4aaceb7..2d8a02e0 100644
--- a/pkg/resolve/resolve_test.go
+++ b/pkg/resolve/resolve_test.go
@@ -33,7 +33,7 @@ func setup() {
 }
 
 // Not sure how to get testParams fixtures working
-func readTDfile(t *testing.T, testname string, generateName bool) (*tektonv1beta1.PipelineRun, *zapobserver.ObservedLogs, error) {
+func readTDfile(t *testing.T, testname string, generateName bool, remoteTasking bool) (*tektonv1beta1.PipelineRun, *zapobserver.ObservedLogs, error) {
 	ctx, _ := rtesting.SetupFakeContext(t)
 	data, err := ioutil.ReadFile("testdata/" + testname + ".yaml")
 	if err != nil {
@@ -49,7 +49,7 @@ func readTDfile(t *testing.T, testname string, generateName bool) (*tektonv1beta
 	}
 	ropt := &Opts{
 		GenerateName: generateName,
-		RemoteTasks:  true,
+		RemoteTasks:  remoteTasking,
 	}
 	tprovider := &testprovider.TestProviderImp{}
 	resolved, err := Resolve(ctx, cs, tprovider, string(data), ropt)
@@ -60,7 +60,7 @@ func readTDfile(t *testing.T, testname string, generateName bool) (*tektonv1beta
 }
 
 func TestPipelineRunPipelineTask(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipelinerun-pipeline-task", false)
+	resolved, _, err := readTDfile(t, "pipelinerun-pipeline-task", false, true)
 	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskSpec.Steps[0].Name, "first-step")
 
@@ -69,56 +69,69 @@ func TestPipelineRunPipelineTask(t *testing.T) {
 }
 
 func TestGenerateName(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipelinerun-pipeline-task", true)
+	resolved, _, err := readTDfile(t, "pipelinerun-pipeline-task", true, true)
 	assert.NilError(t, err)
 	assert.Assert(t, resolved.ObjectMeta.GenerateName != "")
 
-	resolved, _, err = readTDfile(t, "with-generatename", true)
+	resolved, _, err = readTDfile(t, "with-generatename", true, true)
 	assert.NilError(t, err)
 	assert.Assert(t, resolved.ObjectMeta.GenerateName != "")
 }
 
 func TestBundlesSkipped(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipelinerun-with-a-bundle", false)
+	resolved, _, err := readTDfile(t, "pipelinerun-with-a-bundle", false, true)
 	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].Name, "bundled")
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskRef.Bundle, "reg.io/ruben/barichello@sha256:1234")
 }
 
 func TestClusterTasksSkipped(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipelinerun-with-a-clustertasks", false)
+	resolved, _, err := readTDfile(t, "pipelinerun-with-a-clustertasks", false, true)
 	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].Name, "clustertask")
 	assert.Equal(t, string(resolved.Spec.PipelineSpec.Tasks[0].TaskRef.Kind), "ClusterTask")
 }
 
 func TestPipelineRunPipelineSpecTaskSpec(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipelinerun-pipelinespec-taskspec", false)
+	resolved, _, err := readTDfile(t, "pipelinerun-pipelinespec-taskspec", false, true)
 	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskSpec.Steps[0].Name, "hello-moto")
 }
 
 func TestPipelineRunWithFinally(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipelinerun-finally", false)
+	resolved, _, err := readTDfile(t, "pipelinerun-finally", false, true)
 	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Finally[0].TaskSpec.Steps[0].Name, "finally-task")
 }
 
 func TestPipelineWithFinally(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipeline-finally", false)
+	resolved, _, err := readTDfile(t, "pipeline-finally", false, true)
 	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskSpec.Steps[0].Name, "normal-task")
 	assert.Equal(t, resolved.Spec.PipelineSpec.Finally[0].TaskSpec.Steps[0].Name, "finally-task")
 }
 
 func TestPipelineRunPipelineSpecTaskRef(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipelinerun-pipelinespec-taskref", false)
+	resolved, _, err := readTDfile(t, "pipelinerun-pipelinespec-taskref", false, true)
 	assert.NilError(t, err)
 	assert.Equal(t, resolved.Spec.PipelineSpec.Tasks[0].TaskSpec.Steps[0].Name, "task1")
 }
 
+func TestPipelineRunRemoteTaskDisabled(t *testing.T) {
+	resolved, _, err := readTDfile(t, "pipelinerun-pipeline-task-remote-task-annotation", false, false)
+	assert.NilError(t, err)
+	// tbh: it would crash
+	assert.Equal(t, resolved.GetAnnotations()["pipelinesascode.tekton.dev/task"], "foo")
+}
+
+func TestOriginalPRNameLabelSet(t *testing.T) {
+	resolved, _, err := readTDfile(t, "pipelinerun-pipeline-task-remote-task-annotation", false, false)
+	assert.NilError(t, err)
+	assert.Equal(t, resolved.GetLabels()["pipelinesascode.tekton.dev/original-prname"], "pr")
+}
+
 func TestPipelineRunRemoteTaskNotPacAnnotations(t *testing.T) {
-	resolved, _, err := readTDfile(t, "pipelinerun-pipeline-task-annotations-not-pac", false)
+	resolved, _, err := readTDfile(t, "pipelinerun-pipeline-task-annotations-not-pac", false, true)
 	assert.NilError(t, err)
 
 	if _, ok := resolved.GetObjectMeta().GetAnnotations()["anno"]; !ok {
@@ -127,12 +140,12 @@ func TestPipelineRunRemoteTaskNotPacAnnotations(t *testing.T) {
 }
 
 func TestPipelineRunRemoteTaskBadPacAnnotations(t *testing.T) {
-	_, _, err := readTDfile(t, "pipelinerun-pipeline-task-bad-pac-annotation", false)
+	_, _, err := readTDfile(t, "pipelinerun-pipeline-task-bad-pac-annotation", false, true)
 	assert.ErrorContains(t, err, "annotations in pipeline are in wrong format")
 }
 
 func TestNotTektonDocumentIgnore(t *testing.T) {
-	resolved, log, err := readTDfile(t, "not-a-tekton-document", false)
+	resolved, log, err := readTDfile(t, "not-a-tekton-document", false, true)
 	assert.NilError(t, err)
 	logs := log.TakeAll()
 	assert.Assert(t, len(logs) > 0)
@@ -141,7 +154,7 @@ func TestNotTektonDocumentIgnore(t *testing.T) {
 }
 
 func TestNotKubernetesDocumentIgnore(t *testing.T) {
-	resolved, log, err := readTDfile(t, "not-a-kubernetes-yaml", false)
+	resolved, log, err := readTDfile(t, "not-a-kubernetes-yaml", false, true)
 	logs := log.TakeAll()
 	assert.Assert(t, len(logs) > 0)
 	assert.Assert(t, strings.HasPrefix(logs[0].Message, "Skipping"))
@@ -151,21 +164,21 @@ func TestNotKubernetesDocumentIgnore(t *testing.T) {
 }
 
 func TestNoPipelineRuns(t *testing.T) {
-	_, _, err := readTDfile(t, "no-pipelinerun", false)
+	_, _, err := readTDfile(t, "no-pipelinerun", false, true)
 	assert.Error(t, err, "we need at least one pipelinerun to start with")
 }
 
 func TestReferencedTaskNotInRepo(t *testing.T) {
-	_, _, err := readTDfile(t, "referenced-task-not-in-repo", false)
+	_, _, err := readTDfile(t, "referenced-task-not-in-repo", false, true)
 	assert.Error(t, err, "cannot find task nothere in input")
 }
 
 func TestReferencedPipelineNotInRepo(t *testing.T) {
-	_, _, err := readTDfile(t, "referenced-pipeline-not-in-repo", false)
+	_, _, err := readTDfile(t, "referenced-pipeline-not-in-repo", false, true)
 	assert.Error(t, err, "cannot find pipeline pipeline-test1 in input")
 }
 
 func TestIgnoreDocSpace(t *testing.T) {
-	_, _, err := readTDfile(t, "empty-spaces", false)
+	_, _, err := readTDfile(t, "empty-spaces", false, true)
 	assert.NilError(t, err)
 }
diff --git a/pkg/resolve/testdata/pipelinerun-pipeline-task-remote-task-annotation.yaml b/pkg/resolve/testdata/pipelinerun-pipeline-task-remote-task-annotation.yaml
new file mode 100644
index 00000000..a78d976c
--- /dev/null
+++ b/pkg/resolve/testdata/pipelinerun-pipeline-task-remote-task-annotation.yaml
@@ -0,0 +1,55 @@
+---
+apiVersion: tekton.dev/v1beta1
+kind: PipelineRun
+metadata:
+  annotations:
+    pipelinesascode.tekton.dev/task: "foo"
+  name: pr
+spec:
+  pipelineRef:
+    name: pipeline-test1
+  params:
+    - name: key
+      value: "{{value}}"
+---
+apiVersion: tekton.dev/v1beta1
+kind: Pipeline
+metadata:
+  name: pipeline-test1
+spec:
+  params:
+    - name: repo_url
+    - name: revision
+  tasks:
+    - name: task-of-pipeline-test1
+      taskSpec:
+        steps:
+          - name: first-step
+            image: image1
+    - name: task-of-pipeline-test2
+      taskRef:
+        name: task-test2
+    - name: task-of-pipeline-test3
+      taskRef:
+        name: task-test3
+  steps:
+    - name: first-step
+      image: image
+---
+apiVersion: tekton.dev/v1beta1
+kind: Task
+metadata:
+  name: task-test2
+spec:
+  steps:
+    - name: second-step
+      image: image
+---
+apiVersion: tekton.dev/v1beta1
+kind: Task
+metadata:
+  name: task-test3
+spec:
+  steps:
+    - name: second-step
+      image: image