From 4ab659933ad7763ec60d23cd5025b55cdc93730d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Va=C5=A1ek?= Date: Thu, 30 May 2024 19:16:15 +0200 Subject: [PATCH] [serverless-1.33] Backport PaC fix (#774) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix PaC build (#2314) * fix: default NS for PaC Signed-off-by: Matej Vašek * fix: make error non-fatal Signed-off-by: Matej Vašek * fix: pass correct image to PaC Signed-off-by: Matej Vašek * chore: enable gitlab test --------- Signed-off-by: Matej Vašek * fix: pipeline run yaml format for newer PaC (#2317) Signed-off-by: Matej Vašek * Update install-gitlab.sh --------- Signed-off-by: Matej Vašek --- hack/install-gitlab.sh | 1 - pkg/pipelines/tekton/gitlab_test.go | 7 ++----- pkg/pipelines/tekton/pac/client.go | 2 +- pkg/pipelines/tekton/templates.go | 11 ++++++++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hack/install-gitlab.sh b/hack/install-gitlab.sh index 5f68705046..c99085f5fd 100755 --- a/hack/install-gitlab.sh +++ b/hack/install-gitlab.sh @@ -73,7 +73,6 @@ spec: gitlab_rails['gitlab_shell_ssh_port'] = 30022 gitlab_rails['gitlab_email_enabled'] = false puma['worker_processes'] = 0 - sidekiq['max_concurrency'] = 1 prometheus_monitoring['enable'] = false gitlab_rails['env'] = { 'MALLOC_CONF' => 'dirty_decay_ms:1000,muzzy_decay_ms:1000' diff --git a/pkg/pipelines/tekton/gitlab_test.go b/pkg/pipelines/tekton/gitlab_test.go index 2a4e14eb62..45756a8c1e 100644 --- a/pkg/pipelines/tekton/gitlab_test.go +++ b/pkg/pipelines/tekton/gitlab_test.go @@ -44,10 +44,6 @@ import ( ) func TestGitlab(t *testing.T) { - // this test is unreliable and fails majority of the time with unrelated problem - // skip this for now until the issue is fixed - // https://github.com/knative/func/issues/2185 - t.Skip() var err error ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) defer cancel() @@ -238,7 +234,8 @@ func setupGitlabEnv(ctx context.Context, t *testing.T, baseURL, username, passwo } _, _, err = glabCli.Settings.UpdateSettings(newSettings) if err != nil { - t.Fatal(err) + // just log the error, it appears that despite the error the setting is updated + t.Log(err) } // For some reason the setting update does not kick in immediately. diff --git a/pkg/pipelines/tekton/pac/client.go b/pkg/pipelines/tekton/pac/client.go index 863cb14ad3..64687d8c17 100644 --- a/pkg/pipelines/tekton/pac/client.go +++ b/pkg/pipelines/tekton/pac/client.go @@ -11,7 +11,7 @@ import ( // NewTektonPacClientAndResolvedNamespace returns PipelinesascodeV1alpha1Client,namespace,error func NewTektonPacClientAndResolvedNamespace(namespace string) (*pacv1alpha1.PipelinesascodeV1alpha1Client, string, error) { var err error - if namespace != "" { + if namespace == "" { namespace, err = k8s.GetDefaultNamespace() if err != nil { return nil, "", err diff --git a/pkg/pipelines/tekton/templates.go b/pkg/pipelines/tekton/templates.go index ee6ff7f8b2..71f193fbf2 100644 --- a/pkg/pipelines/tekton/templates.go +++ b/pkg/pipelines/tekton/templates.go @@ -204,12 +204,17 @@ func createPipelineRunTemplatePAC(f fn.Function, labels map[string]string) error s2iImageScriptsUrl = quarkusS2iImageScriptsUrl } + image := f.Deploy.Image + if image == "" { + image = f.Image + } + data := templateData{ FunctionName: f.Name, Annotations: f.Deploy.Annotations, Labels: labels, ContextDir: contextDir, - FunctionImage: f.Deploy.Image, + FunctionImage: image, Registry: f.Registry, BuilderImage: getBuilderImage(f), BuildEnvs: buildEnvs, @@ -230,8 +235,8 @@ func createPipelineRunTemplatePAC(f fn.Function, labels map[string]string) error S2iImageScriptsUrl: s2iImageScriptsUrl, - RepoUrl: "{{ repo_url }}", - Revision: "{{ revision }}", + RepoUrl: "\"{{ repo_url }}\"", + Revision: "\"{{ revision }}\"", } var template string