job/osbuild: set AuthFilePath for container upload if provided
If a `AuthFilePath` was configured, which should contain secrets to access container registries, we set this on the `Client` so that the secrets can be used during registry access.
This commit is contained in:
parent
64a3aac895
commit
9f8df4313c
2 changed files with 17 additions and 12 deletions
|
|
@ -41,11 +41,11 @@ type S3Configuration struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainersConfiguration struct {
|
type ContainersConfiguration struct {
|
||||||
ContainerAuthFile string
|
AuthFilePath string
|
||||||
Domain string
|
Domain string
|
||||||
Account string
|
Account string
|
||||||
CertPath string
|
CertPath string
|
||||||
TLSVerify *bool
|
TLSVerify *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type OSBuildJobImpl struct {
|
type OSBuildJobImpl struct {
|
||||||
|
|
@ -214,7 +214,12 @@ func (impl *OSBuildJobImpl) getContainerClient(destination string, targetOptions
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if impl.ContainersConfig.AuthFilePath != "" {
|
||||||
|
client.SetAuthFilePath(impl.ContainersConfig.AuthFilePath)
|
||||||
|
}
|
||||||
|
|
||||||
if appliedDefaults {
|
if appliedDefaults {
|
||||||
|
|
||||||
if impl.ContainersConfig.CertPath != "" {
|
if impl.ContainersConfig.CertPath != "" {
|
||||||
client.SetDockerCertPath(impl.ContainersConfig.CertPath)
|
client.SetDockerCertPath(impl.ContainersConfig.CertPath)
|
||||||
}
|
}
|
||||||
|
|
@ -338,9 +343,9 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var extraEnv []string
|
var extraEnv []string
|
||||||
if impl.ContainersConfig.ContainerAuthFile != "" {
|
if impl.ContainersConfig.AuthFilePath != "" {
|
||||||
extraEnv = []string{
|
extraEnv = []string{
|
||||||
fmt.Sprintf("REGISTRY_AUTH_FILE=%s", impl.ContainersConfig.ContainerAuthFile),
|
fmt.Sprintf("REGISTRY_AUTH_FILE=%s", impl.ContainersConfig.AuthFilePath),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -444,11 +444,11 @@ func main() {
|
||||||
SkipSSLVerification: genericS3SkipSSLVerification,
|
SkipSSLVerification: genericS3SkipSSLVerification,
|
||||||
},
|
},
|
||||||
ContainersConfig: ContainersConfiguration{
|
ContainersConfig: ContainersConfiguration{
|
||||||
ContainerAuthFile: containersAuthFilePath,
|
AuthFilePath: containersAuthFilePath,
|
||||||
Domain: containersDomain,
|
Domain: containersDomain,
|
||||||
Account: containersAccount,
|
Account: containersAccount,
|
||||||
CertPath: containersCertPath,
|
CertPath: containersCertPath,
|
||||||
TLSVerify: &containersTLSVerify,
|
TLSVerify: &containersTLSVerify,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
worker.JobTypeKojiInit: &KojiInitJobImpl{
|
worker.JobTypeKojiInit: &KojiInitJobImpl{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue