Skip to content

Commit 7fb0c43

Browse files
committed
Add option to deploy command too
1 parent dbea944 commit 7fb0c43

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

cmd/deploy.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SYNOPSIS
3737
[-b|--build] [--builder] [--builder-image] [-p|--push]
3838
[--domain] [--platform] [--build-timestamp] [--pvc-size]
3939
[--service-account] [-c|--confirm] [-v|--verbose]
40-
[--registry-insecure] [--remote-storage-class]
40+
[--registry-insecure] [--registry-authfile] [--remote-storage-class]
4141
4242
DESCRIPTION
4343
@@ -132,8 +132,9 @@ EXAMPLES
132132
PreRunE: bindEnv("build", "build-timestamp", "builder", "builder-image",
133133
"base-image", "confirm", "domain", "env", "git-branch", "git-dir",
134134
"git-url", "image", "namespace", "path", "platform", "push", "pvc-size",
135-
"service-account", "deployer", "registry", "registry-insecure", "remote",
136-
"username", "password", "token", "verbose", "remote-storage-class"),
135+
"service-account", "deployer", "registry", "registry-insecure",
136+
"registry-authfile", "remote", "username", "password", "token", "verbose",
137+
"remote-storage-class"),
137138
RunE: func(cmd *cobra.Command, args []string) error {
138139
return runDeploy(cmd, newClient)
139140
},
@@ -161,6 +162,7 @@ EXAMPLES
161162
cmd.Flags().StringP("registry", "r", cfg.Registry,
162163
"Container registry + registry namespace. (ex 'ghcr.io/myuser'). The full image name is automatically determined using this along with function name. ($FUNC_REGISTRY)")
163164
cmd.Flags().Bool("registry-insecure", cfg.RegistryInsecure, "Skip TLS certificate verification when communicating in HTTPS with the registry ($FUNC_REGISTRY_INSECURE)")
165+
cmd.Flags().String("registry-authfile", "", "Path to a authentication file containing registry credentials ($FUNC_REGISTRY_AUTHFILE)")
164166

165167
// Function-Context Flags:
166168
// Options whose value is available on the function with context only
@@ -918,6 +920,13 @@ func (c deployConfig) clientOptions() ([]fn.Option, error) {
918920
return o, err
919921
}
920922

923+
t := newTransport(c.RegistryInsecure)
924+
creds := newCredentialsProvider(config.Dir(), t, c.RegistryAuthfile)
925+
926+
// Override the pipelines provider to use custom credentials
927+
// This is needed for remote builds (deploy --remote)
928+
o = append(o, fn.WithPipelinesProvider(newTektonPipelinesProvider(creds, c.Verbose)))
929+
921930
// Add the appropriate deployer based on deploy type
922931
deployer := c.Deployer
923932
if deployer == "" {

0 commit comments

Comments
 (0)