GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Pass --registry-insecure flag to Tekton pipeline tlsVerify parameter … · creydr/knative-func@da21fa2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cmd
    • client.go
    • deploy.go
  • pkg/pipelines/tekton
    • pipelines_pac_provider.go
    • pipelines_provider.go
    • templates.go
    • templates_test.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cmd/client.go‎

Copy file name to clipboardExpand all lines: cmd/client.go
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func NewClient(cfg ClientConfig, options ...fn.Option) (*fn.Client, func()) {
6262
t = newTransport(cfg.InsecureSkipVerify) // may provide a custom impl which proxies
6363
c = newCredentialsProvider(config.Dir(), t, "") // for accessing registries
6464
d = newKnativeDeployer(cfg.Verbose) // default deployer (can be overridden via options)
65-
pp = newTektonPipelinesProvider(c, cfg.Verbose)
65+
pp = newTektonPipelinesProvider(c, cfg.Verbose, cfg.InsecureSkipVerify)
6666
o = []fn.Option{ // standard (shared) options for all commands
6767
fn.WithVerbose(cfg.Verbose),
6868
fn.WithTransport(t),
@@ -143,10 +143,11 @@ func newCredentialsProvider(configPath string, t http.RoundTripper, authFilePath
143143
return creds.NewCredentialsProvider(configPath, options...)
144144
}
145145

146-
func newTektonPipelinesProvider(creds oci.CredentialsProvider, verbose bool) *tekton.PipelinesProvider {
146+
func newTektonPipelinesProvider(creds oci.CredentialsProvider, verbose bool, registryInsecure bool) *tekton.PipelinesProvider {
147147
options := []tekton.Opt{
148148
tekton.WithCredentialsProvider(creds),
149149
tekton.WithVerbose(verbose),
150+
tekton.WithRegistryInsecure(registryInsecure),
150151
tekton.WithPipelineDecorator(deployDecorator{}),
151152
}
152153

Collapse file

‎cmd/deploy.go‎

Copy file name to clipboardExpand all lines: cmd/deploy.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ func (c deployConfig) clientOptions() ([]fn.Option, error) {
778778

779779
// Override the pipelines provider to use custom credentials
780780
// This is needed for remote builds (deploy --remote)
781-
o = append(o, fn.WithPipelinesProvider(newTektonPipelinesProvider(creds, c.Verbose)))
781+
o = append(o, fn.WithPipelinesProvider(newTektonPipelinesProvider(creds, c.Verbose, c.RegistryInsecure)))
782782

783783
// Add the appropriate deployer based on deploy type
784784
deployer := c.Deployer
Collapse file

‎pkg/pipelines/tekton/pipelines_pac_provider.go‎

Copy file name to clipboardExpand all lines: pkg/pipelines/tekton/pipelines_pac_provider.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (pp *PipelinesProvider) createLocalPACResources(ctx context.Context, f fn.F
129129
return err
130130
}
131131

132-
err = createPipelineRunTemplatePAC(f, labels)
132+
err = createPipelineRunTemplatePAC(f, labels, pp.registryInsecure)
133133
if err != nil {
134134
return err
135135
}
Collapse file

‎pkg/pipelines/tekton/pipelines_provider.go‎

Copy file name to clipboardExpand all lines: pkg/pipelines/tekton/pipelines_provider.go
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type pacURLCallback = func() (string, error)
5252

5353
type PipelinesProvider struct {
5454
verbose bool
55+
registryInsecure bool
5556
getPacURL pacURLCallback
5657
credentialsProvider oci.CredentialsProvider
5758
decorator PipelineDecorator
@@ -69,6 +70,12 @@ func WithVerbose(verbose bool) Opt {
6970
}
7071
}
7172

73+
func WithRegistryInsecure(insecure bool) Opt {
74+
return func(pp *PipelinesProvider) {
75+
pp.registryInsecure = insecure
76+
}
77+
}
78+
7279
func WithPipelineDecorator(decorator PipelineDecorator) Opt {
7380
return func(pp *PipelinesProvider) {
7481
pp.decorator = decorator
@@ -203,7 +210,7 @@ func (pp *PipelinesProvider) Run(ctx context.Context, f fn.Function) (string, fn
203210
return "", f, fmt.Errorf("problem in creating secret: %v", err)
204211
}
205212

206-
err = createAndApplyPipelineRunTemplate(f, namespace, labels)
213+
err = createAndApplyPipelineRunTemplate(f, namespace, labels, pp.registryInsecure)
207214
if err != nil {
208215
return "", f, fmt.Errorf("problem in creating pipeline run: %v", err)
209216
}
Collapse file

‎pkg/pipelines/tekton/templates.go‎

Copy file name to clipboardExpand all lines: pkg/pipelines/tekton/templates.go
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func createPipelineTemplatePAC(f fn.Function, labels map[string]string) error {
131131

132132
// createPipelineRunTemplatePAC creates a PipelineRun template used for PAC on-cluster build
133133
// it creates the resource in the project directory
134-
func createPipelineRunTemplatePAC(f fn.Function, labels map[string]string) error {
134+
func createPipelineRunTemplatePAC(f fn.Function, labels map[string]string, registryInsecure bool) error {
135135
contextDir := f.Build.Git.ContextDir
136136
if contextDir == "" && f.Build.Builder == builders.S2I {
137137
// TODO(lkingland): could instead update S2I to interpret empty string
@@ -167,7 +167,7 @@ func createPipelineRunTemplatePAC(f fn.Function, labels map[string]string) error
167167

168168
// Determine if TLS verification should be skipped
169169
tlsVerify := "true"
170-
if isInsecureRegistry(f.Registry) {
170+
if registryInsecure || isInsecureRegistry(f.Registry) {
171171
tlsVerify = "false"
172172
}
173173

@@ -330,7 +330,7 @@ func createAndApplyPipelineTemplate(f fn.Function, namespace string, labels map[
330330

331331
// createAndApplyPipelineRunTemplate creates and applies PipelineRun template for a standard on-cluster build
332332
// all resources are created on the fly, if there's a PipelineRun defined in the project directory, it is used instead
333-
func createAndApplyPipelineRunTemplate(f fn.Function, namespace string, labels map[string]string) error {
333+
func createAndApplyPipelineRunTemplate(f fn.Function, namespace string, labels map[string]string, registryInsecure bool) error {
334334
contextDir := f.Build.Git.ContextDir
335335
if contextDir == "" && f.Build.Builder == builders.S2I {
336336
// TODO(lkingland): could instead update S2I to interpret empty string
@@ -366,7 +366,7 @@ func createAndApplyPipelineRunTemplate(f fn.Function, namespace string, labels m
366366

367367
// Determine if TLS verification should be skipped
368368
tlsVerify := "true"
369-
if isInsecureRegistry(f.Registry) {
369+
if registryInsecure || isInsecureRegistry(f.Registry) {
370370
tlsVerify = "false"
371371
}
372372

Collapse file

‎pkg/pipelines/tekton/templates_test.go‎

Copy file name to clipboardExpand all lines: pkg/pipelines/tekton/templates_test.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func Test_createPipelineRunTemplatePAC(t *testing.T) {
147147
f.Image = "docker.io/alice/" + f.Name
148148
f.Registry = TestRegistry
149149

150-
err = createPipelineRunTemplatePAC(f, make(map[string]string))
150+
err = createPipelineRunTemplatePAC(f, make(map[string]string), false)
151151

152152
if (err != nil) != tt.wantErr {
153153
t.Errorf("createPipelineRunTemplate() error = %v, wantErr %v", err, tt.wantErr)
@@ -316,7 +316,7 @@ func Test_createAndApplyPipelineRunTemplate(t *testing.T) {
316316
f.Image = "docker.io/alice/" + f.Name
317317
f.Registry = TestRegistry
318318

319-
if err := createAndApplyPipelineRunTemplate(f, tt.namespace, tt.labels); (err != nil) != tt.wantErr {
319+
if err := createAndApplyPipelineRunTemplate(f, tt.namespace, tt.labels, false); (err != nil) != tt.wantErr {
320320
t.Errorf("createAndApplyPipelineRunTemplate() error = %v, wantErr %v", err, tt.wantErr)
321321
}
322322
})

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.