From 2a5d25d9c02e29a8898166f1e1cdc9c58313e78c Mon Sep 17 00:00:00 2001 From: Lukas Zapletal Date: Fri, 8 Nov 2024 18:04:11 +0100 Subject: [PATCH] worker: check MTLS config for ostree --- cmd/osbuild-worker/jobimpl-ostree-resolve.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/osbuild-worker/jobimpl-ostree-resolve.go b/cmd/osbuild-worker/jobimpl-ostree-resolve.go index 3dd2301059..aa29bbcbca 100644 --- a/cmd/osbuild-worker/jobimpl-ostree-resolve.go +++ b/cmd/osbuild-worker/jobimpl-ostree-resolve.go @@ -17,6 +17,10 @@ type OSTreeResolveJobImpl struct { } func (job *OSTreeResolveJobImpl) CompareBaseURL(baseURLStr string) (bool, error) { + if job.RepositoryMTLSConfig == nil || job.RepositoryMTLSConfig.BaseURL == nil { + return false, nil + } + baseURL, err := url.Parse(baseURLStr) if err != nil { return false, err @@ -91,6 +95,12 @@ func (impl *OSTreeResolveJobImpl) Run(job worker.Job) error { err.Error(), ) break + } else { + mURL := "" + if impl.RepositoryMTLSConfig != nil && impl.RepositoryMTLSConfig.BaseURL != nil { + mURL = impl.RepositoryMTLSConfig.BaseURL.String() + } + logWithId.Warnf("Repository URL '%s' does not match '%s', MTLS: %t", s.URL, mURL, impl.RepositoryMTLSConfig != nil) } commitSpec, err := ostree.Resolve(reqParams) if err != nil {