diff --git a/cmd/osbuild-worker/config.go b/cmd/osbuild-worker/config.go index 226c77138..28daf5518 100644 --- a/cmd/osbuild-worker/config.go +++ b/cmd/osbuild-worker/config.go @@ -67,11 +67,6 @@ type containersConfig struct { TLSVerify bool `toml:"tls_verify"` } -type pulpConfig struct { - Credentials string `toml:"credentials"` - ServerURL string `toml:"server_address"` -} - type executorConfig struct { Type string `toml:"type"` IAMProfile string `toml:"iam_profile"` @@ -97,7 +92,6 @@ type workerConfig struct { Authentication *authenticationConfig `toml:"authentication"` Containers *containersConfig `toml:"containers"` OCI *ociConfig `toml:"oci"` - Pulp *pulpConfig `toml:"pulp"` // default value: /api/worker/v1 BasePath string `toml:"base_path"` DNFJson string `toml:"dnf-json"` diff --git a/cmd/osbuild-worker/config_test.go b/cmd/osbuild-worker/config_test.go index 540570d2f..036dd7a20 100644 --- a/cmd/osbuild-worker/config_test.go +++ b/cmd/osbuild-worker/config_test.go @@ -66,10 +66,6 @@ client_id = "toucan" client_secret = "/etc/osbuild-worker/client_secret" offline_token = "/etc/osbuild-worker/offline_token" -[pulp] -credentials = "/etc/osbuild-worker/pulp-creds" -server_address = "https://example.com/pulp" - [osbuild_executor] type = "aws.ec2" iam_profile = "osbuild-worker" @@ -132,10 +128,6 @@ cloudwatch_group = "osbuild-worker" ClientId: "toucan", ClientSecretPath: "/etc/osbuild-worker/client_secret", }, - Pulp: &pulpConfig{ - Credentials: "/etc/osbuild-worker/pulp-creds", - ServerURL: "https://example.com/pulp", - }, DeploymentChannel: "local", }, }, diff --git a/cmd/osbuild-worker/jobimpl-osbuild.go b/cmd/osbuild-worker/jobimpl-osbuild.go index e67339552..99a43a269 100644 --- a/cmd/osbuild-worker/jobimpl-osbuild.go +++ b/cmd/osbuild-worker/jobimpl-osbuild.go @@ -12,7 +12,6 @@ import ( "os" "os/exec" "path" - "path/filepath" "runtime/debug" "slices" "strings" @@ -25,7 +24,6 @@ import ( "github.com/osbuild/osbuild-composer/internal/common" "github.com/osbuild/osbuild-composer/internal/upload/oci" - "github.com/osbuild/osbuild-composer/internal/upload/pulp" "github.com/google/uuid" "github.com/sirupsen/logrus" @@ -318,44 +316,6 @@ func (impl *OSBuildJobImpl) getContainerClient(destination string, targetOptions return client, nil } -// Read server configuration and credentials from the target options and fall -// back to worker config if they are not set (targetOptions take precedent). -// Mixing sources is allowed. For example, the server address can be configured -// in the worker config while the targetOptions provide the credentials (or -// vice versa). -func (impl *OSBuildJobImpl) getPulpClient(targetOptions *target.PulpOSTreeTargetOptions) (*pulp.Client, error) { - - var creds *pulp.Credentials - // Credentials are considered together. In other words, the username can't - // come from a different config source than the password. - if targetOptions.Username != "" && targetOptions.Password != "" { - creds = &pulp.Credentials{ - Username: targetOptions.Username, - Password: targetOptions.Password, - } - } - address := targetOptions.ServerAddress - if address == "" { - // fall back to worker configuration for server address - address = impl.PulpConfig.ServerAddress - } - if address == "" { - return nil, fmt.Errorf("pulp server address not set") - } - - if creds != nil { - return pulp.NewClient(address, creds), nil - } - - // read from worker configuration - if impl.PulpConfig.CredsFilePath == "" { - return nil, fmt.Errorf("pulp credentials not set") - } - - // use creds file loader helper - return pulp.NewClientFromFile(address, impl.PulpConfig.CredsFilePath) -} - func makeJobErrorFromOsbuildOutput(osbuildOutput *osbuild.Result) *clienterrors.Error { var osbErrors []string if osbuildOutput.Error != nil { @@ -1331,23 +1291,6 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error { logWithId.Printf("[container] 🎉 Image uploaded (%s)!", digest.String()) targetResult.Options = &target.ContainerTargetResultOptions{URL: client.Target.String(), Digest: digest.String()} - case *target.PulpOSTreeTargetOptions: - targetResult = target.NewPulpOSTreeTargetResult(nil, &artifact) - archivePath := filepath.Join(outputDirectory, jobTarget.OsbuildArtifact.ExportName, jobTarget.OsbuildArtifact.ExportFilename) - - client, err := impl.getPulpClient(targetOptions) - if err != nil { - targetResult.TargetError = clienterrors.New(clienterrors.ErrorInvalidConfig, err.Error(), nil) - break - } - - url, err := client.UploadAndDistributeCommit(archivePath, targetOptions.Repository, targetOptions.BasePath) - if err != nil { - targetResult.TargetError = clienterrors.New(clienterrors.ErrorUploadingImage, err.Error(), nil) - break - } - targetResult.Options = &target.PulpOSTreeTargetResultOptions{RepoURL: url} - default: // TODO: we may not want to return completely here with multiple targets, because then no TargetErrors will be added to the JobError details // Nevertheless, all target errors will be still in the OSBuildJobResult. diff --git a/cmd/osbuild-worker/main.go b/cmd/osbuild-worker/main.go index d410f87cf..b4a892a69 100644 --- a/cmd/osbuild-worker/main.go +++ b/cmd/osbuild-worker/main.go @@ -400,13 +400,6 @@ var run = func() { } } - var pulpCredsFilePath = "" - var pulpAddress = "" - if config.Pulp != nil { - pulpCredsFilePath = config.Pulp.Credentials - pulpAddress = config.Pulp.ServerURL - } - var repositoryMTLSConfig *RepositoryMTLSConfig if config.RepositoryMTLSConfig != nil { baseURL, err := url.Parse(config.RepositoryMTLSConfig.BaseURL) @@ -503,10 +496,6 @@ var run = func() { CertPath: containersCertPath, TLSVerify: &containersTLSVerify, }, - PulpConfig: PulpConfiguration{ - CredsFilePath: pulpCredsFilePath, - ServerAddress: pulpAddress, - }, RepositoryMTLSConfig: repositoryMTLSConfig, }, worker.JobTypeKojiInit: &KojiInitJobImpl{