Skip to content
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/manifestival/client-go-client v0.6.0
github.com/manifestival/manifestival v0.7.2
github.com/markbates/inflect v1.0.4
github.com/openshift-pipelines/pipelines-as-code v0.39.2
github.com/openshift-pipelines/pipelines-as-code v0.39.3
github.com/openshift/api v0.0.0-20240521185306-0314f31e7774
github.com/openshift/apiserver-library-go v0.0.0-20230816171015-6bfafa975bfb
github.com/openshift/client-go v0.0.0-20240523113335-452272e0496d
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2377,8 +2377,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
github.com/openshift-pipelines/pipelines-as-code v0.39.2 h1:VvSzAaWlEcOnu6xRXWKEquYbdr6RYqTv6zQzIym+NK4=
github.com/openshift-pipelines/pipelines-as-code v0.39.2/go.mod h1:5KqGAgmiFldqi4KG4Vj/5juzbUbPucASmqKrWwePG9U=
github.com/openshift-pipelines/pipelines-as-code v0.39.3 h1:Er8vZZrbslGeaGG5tUlMbUlzTeMCyMRsWqSD5tIJUjo=
github.com/openshift-pipelines/pipelines-as-code v0.39.3/go.mod h1:5KqGAgmiFldqi4KG4Vj/5juzbUbPucASmqKrWwePG9U=
github.com/openshift/api v0.0.0-20240521185306-0314f31e7774 h1:SsoLnIil/D0FcjUbQ9Z8h95B7rxFvrso2X6OQjR8jPw=
github.com/openshift/api v0.0.0-20240521185306-0314f31e7774/go.mod h1:7Hm1kLJGxWT6eysOpD2zUztdn+w91eiERn6KtI5o9aw=
github.com/openshift/apiserver-library-go v0.0.0-20230816171015-6bfafa975bfb h1:UMgJny13BBcHpY+JQ9Eg1Dm9+J7nWO3eqPvV1Zpd49A=
Expand Down
13 changes: 2 additions & 11 deletions pkg/apis/operator/v1alpha1/openshiftpipelinesascode_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"strings"
"sync"

hubtypes "github.com/openshift-pipelines/pipelines-as-code/pkg/hub/vars"
pacSettings "github.com/openshift-pipelines/pipelines-as-code/pkg/params/settings"
"go.uber.org/zap"
"knative.dev/pkg/logging"
Expand All @@ -46,7 +45,8 @@ func (set *PACSettings) setPACDefaults(logger *zap.SugaredLogger) {
if set.Settings == nil {
set.Settings = map[string]string{}
}
defaultPacSettings := pacSettings.DefaultSettings()
defaultPacSettings := pacSettings.Settings{}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have that code been merged into PAC Which handles the default hub ?
Can you share that PR as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then we should wait for that PR to merge first.
Once done we may need to upgrade the PAC dependency as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/hold

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pramodbindal We can merge this PR as this is in the main branch and we will have to cherry pick it in release-v0.77.x branch
We will update PAC dependency in the releasev0.77.x branch only

err := pacSettings.SyncConfig(logger, &defaultPacSettings, set.Settings, map[string]func(string) error{})
if err != nil {
logger.Error("error on applying default PAC settings", err)
Expand All @@ -55,15 +55,6 @@ func (set *PACSettings) setPACDefaults(logger *zap.SugaredLogger) {
// Remove tektonhub catalog to only keep artifacthub
defaultPacSettings.HubCatalogs.Delete("tektonhub")

// Override the default ArtifactHub URL to use https://artifacthub.io instead of https://artifacthub.io/api/v1
if defaultCatalog, ok := defaultPacSettings.HubCatalogs.Load("default"); ok {
catalog := defaultCatalog.(pacSettings.HubCatalog)
if catalog.Type == hubtypes.ArtifactHubType {
catalog.URL = "https://artifacthub.io"
}
defaultPacSettings.HubCatalogs.Store("default", catalog)
}

set.Settings = ConvertPacStructToConfigMap(&defaultPacSettings)
setAdditionalPACControllerDefault(set.AdditionalPACControllers)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestSetPACControllerDefaultSettings(t *testing.T) {
"error-log-snippet": "true",
"error-log-snippet-number-of-lines": "3",
"hub-catalog-type": "artifacthub",
"hub-url": "https://artifacthub.io",
"hub-url": "https://artifacthub.io/api/v1",
"max-keep-run-upper-limit": "0",
"remember-ok-to-test": "false",
"require-ok-to-test-sha": "false",
Expand Down Expand Up @@ -120,7 +120,7 @@ func TestSetPACControllerLimitedSettings(t *testing.T) {
"error-log-snippet": "true",
"error-log-snippet-number-of-lines": "3",
"hub-catalog-type": "artifacthub",
"hub-url": "https://artifacthub.io",
"hub-url": "https://artifacthub.io/api/v1",
"max-keep-run-upper-limit": "0",
"remember-ok-to-test": "false",
"require-ok-to-test-sha": "false",
Expand Down Expand Up @@ -186,7 +186,7 @@ func TestSetPACControllerDefaultSettingsWithMultipleCatalogs(t *testing.T) {
"error-log-snippet": "true",
"error-log-snippet-number-of-lines": "3",
"hub-catalog-type": "artifacthub",
"hub-url": "https://artifacthub.io",
"hub-url": "https://artifacthub.io/api/v1",
"max-keep-run-upper-limit": "0",
"remember-ok-to-test": "false",
"require-ok-to-test-sha": "false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (pac *OpenShiftPipelinesAsCode) Validate(ctx context.Context) *apis.FieldEr
func (ps *PACSettings) validate(logger *zap.SugaredLogger, path string) *apis.FieldError {
var errs *apis.FieldError

defaultPacSettings := pacSettings.DefaultSettings()
defaultPacSettings := pacSettings.Settings{}
if err := pacSettings.SyncConfig(logger, &defaultPacSettings, ps.Settings, pacSettings.DefaultValidators()); err != nil {
errs = errs.Also(apis.ErrInvalidValue(err, fmt.Sprintf("%s.settings", path)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ data:
secret-github-app-scope-extra-repos: ""

# Tekton HUB API urls
hub-url: "https://custom-hub.com"
hub-url: "https://custom-hub-catalog.com"

# Tekton HUB catalog type
hub-catalog-type: "artifacthub"
hub-catalog-type: "tektonhub"

# Additional Hub Catalogs is supported, for example:
#
Expand All @@ -41,12 +41,6 @@ data:
# this configuration will have a new catalog named anotherhub on https://api.other.com/v1 endpoint and catalog name tekton
# to be used by a user in their templates like this:
# pipelinesascode.tekton.dev/task: "anotherhub://task"
#
# Increase the number of the catalog to add more of them
catalog-tektonhub-id: "tektonhub"
catalog-tektonhub-name: "tekton"
catalog-tektonhub-type: "tektonhub"
catalog-tektonhub-url: "https://api.hub.tekton.dev/v1"

# Allow fetching remote tasks
remote-tasks: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func updateAdditionControllerConfigMap(config v1alpha1.AdditionalPACControllerCo
config.Settings = map[string]string{}
}

defaultPacSettings := pacSettings.DefaultSettings()
defaultPacSettings := pacSettings.Settings{}
err := pacSettings.SyncConfig(zap.NewNop().Sugar(), &defaultPacSettings, config.Settings, pacSettings.DefaultValidators())
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func TestUpdateAdditionControllerConfigMap(t *testing.T) {
additionalPACConfig := v1alpha1.AdditionalPACControllerConfig{
ConfigMapName: "test-config",
SecretName: "test-secret",
Settings: map[string]string{"application-name": "Test CI application", "hub-url": "https://custom-hub.com"},
Settings: map[string]string{"application-name": "Test CI application", "hub-url": "https://custom-hub-catalog.com"},
}

updatedManifest, err := manifest.Transform(updateAdditionControllerConfigMap(additionalPACConfig))
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ github.com/opencontainers/go-digest
## explicit; go 1.18
github.com/opencontainers/image-spec/specs-go
github.com/opencontainers/image-spec/specs-go/v1
# github.com/openshift-pipelines/pipelines-as-code v0.39.2
# github.com/openshift-pipelines/pipelines-as-code v0.39.3
## explicit; go 1.24.0
github.com/openshift-pipelines/pipelines-as-code/pkg/cli
github.com/openshift-pipelines/pipelines-as-code/pkg/configutil
Expand Down
Loading