Skip to content

Commit

Permalink
[serverless-1.33] Backport PaC fix (#774)
Browse files Browse the repository at this point in the history
* Fix PaC build (knative#2314)

* fix: default NS for PaC

Signed-off-by: Matej Vašek <[email protected]>

* fix: make error non-fatal

Signed-off-by: Matej Vašek <[email protected]>

* fix: pass correct image to PaC

Signed-off-by: Matej Vašek <[email protected]>

* chore: enable gitlab test

---------

Signed-off-by: Matej Vašek <[email protected]>

* fix: pipeline run yaml format for newer PaC (knative#2317)

Signed-off-by: Matej Vašek <[email protected]>

* Update install-gitlab.sh

---------

Signed-off-by: Matej Vašek <[email protected]>
  • Loading branch information
matejvasek authored May 30, 2024
1 parent 6035bad commit 4ab6599
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion hack/install-gitlab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 2 additions & 5 deletions pkg/pipelines/tekton/gitlab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion pkg/pipelines/tekton/pac/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions pkg/pipelines/tekton/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 4ab6599

Please sign in to comment.