diff --git a/pkg/pipelines/tekton/task-buildpack.yaml.tmpl b/pkg/pipelines/tekton/task-buildpack.yaml.tmpl index abda863372..51867292e6 100644 --- a/pkg/pipelines/tekton/task-buildpack.yaml.tmpl +++ b/pkg/pipelines/tekton/task-buildpack.yaml.tmpl @@ -61,6 +61,9 @@ spec: - name: PLATFORM_DIR description: The name of the platform directory. default: empty-dir + - name: INSECURE_REGISTRIES + description: Registries to access without TLS verification + default: "" stepTemplate: env: - name: CNB_PLATFORM_API @@ -199,6 +202,8 @@ spec: env: - name: DOCKER_CONFIG value: $(workspaces.dockerconfig.path) + - name: CNB_INSECURE_REGISTRIES + value: $(params.INSECURE_REGISTRIES) args: - "-app=$(workspaces.source.path)/$(params.SOURCE_SUBPATH)" - "-cache-dir=$(workspaces.cache.path)" diff --git a/pkg/pipelines/tekton/templates.go b/pkg/pipelines/tekton/templates.go index c199f7ffac..5ca9cb5f2c 100644 --- a/pkg/pipelines/tekton/templates.go +++ b/pkg/pipelines/tekton/templates.go @@ -95,11 +95,19 @@ type templateData struct { // createPipelineTemplatePAC creates a Pipeline template used for PAC on-cluster build // it creates the resource in the project directory func createPipelineTemplatePAC(f fn.Function, labels map[string]string) error { + // Determine if TLS verification should be skipped + tlsVerify := "true" + if f.RegistryInsecure || isInsecureRegistry(f.Registry) { + tlsVerify = "false" + } + data := templateData{ FunctionName: f.Name, Annotations: f.Deploy.Annotations, Labels: labels, PipelineName: getPipelineName(f), + TlsVerify: tlsVerify, + Registry: f.Registry, } for _, val := range []struct { @@ -294,11 +302,19 @@ func createAndApplyPipelineTemplate(f fn.Function, namespace string, labels map[ // If Git is set up create fetch task and reference it from build task, // otherwise sources have been already uploaded to workspace PVC. + // Determine if TLS verification should be skipped + tlsVerify := "true" + if f.RegistryInsecure || isInsecureRegistry(f.Registry) { + tlsVerify = "false" + } + data := templateData{ FunctionName: f.Name, Annotations: f.Deploy.Annotations, Labels: labels, PipelineName: getPipelineName(f), + Registry: f.Registry, + TlsVerify: tlsVerify, } for _, val := range []struct { diff --git a/pkg/pipelines/tekton/templates_pack.go b/pkg/pipelines/tekton/templates_pack.go index 30ac671d11..7b5dcd02d9 100644 --- a/pkg/pipelines/tekton/templates_pack.go +++ b/pkg/pipelines/tekton/templates_pack.go @@ -58,6 +58,10 @@ spec: - name: ENV_VARS value: - '$(params.buildEnvs[*])' + {{- if eq .TlsVerify "false"}} + - name: INSECURE_REGISTRIES + value: $(params.registry) + {{- end}} {{.FuncBuildpacksTaskRef}} workspaces: - name: source