cmd/osbuild-worker: delete the PulpOstree target support
It turned out that the upload target was never adopted by the service, thus we are removing it as part of upload code consolidation. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
dd99c0cb78
commit
bd848727c2
4 changed files with 0 additions and 82 deletions
|
|
@ -67,11 +67,6 @@ type containersConfig struct {
|
||||||
TLSVerify bool `toml:"tls_verify"`
|
TLSVerify bool `toml:"tls_verify"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type pulpConfig struct {
|
|
||||||
Credentials string `toml:"credentials"`
|
|
||||||
ServerURL string `toml:"server_address"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type executorConfig struct {
|
type executorConfig struct {
|
||||||
Type string `toml:"type"`
|
Type string `toml:"type"`
|
||||||
IAMProfile string `toml:"iam_profile"`
|
IAMProfile string `toml:"iam_profile"`
|
||||||
|
|
@ -97,7 +92,6 @@ type workerConfig struct {
|
||||||
Authentication *authenticationConfig `toml:"authentication"`
|
Authentication *authenticationConfig `toml:"authentication"`
|
||||||
Containers *containersConfig `toml:"containers"`
|
Containers *containersConfig `toml:"containers"`
|
||||||
OCI *ociConfig `toml:"oci"`
|
OCI *ociConfig `toml:"oci"`
|
||||||
Pulp *pulpConfig `toml:"pulp"`
|
|
||||||
// default value: /api/worker/v1
|
// default value: /api/worker/v1
|
||||||
BasePath string `toml:"base_path"`
|
BasePath string `toml:"base_path"`
|
||||||
DNFJson string `toml:"dnf-json"`
|
DNFJson string `toml:"dnf-json"`
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,6 @@ client_id = "toucan"
|
||||||
client_secret = "/etc/osbuild-worker/client_secret"
|
client_secret = "/etc/osbuild-worker/client_secret"
|
||||||
offline_token = "/etc/osbuild-worker/offline_token"
|
offline_token = "/etc/osbuild-worker/offline_token"
|
||||||
|
|
||||||
[pulp]
|
|
||||||
credentials = "/etc/osbuild-worker/pulp-creds"
|
|
||||||
server_address = "https://example.com/pulp"
|
|
||||||
|
|
||||||
[osbuild_executor]
|
[osbuild_executor]
|
||||||
type = "aws.ec2"
|
type = "aws.ec2"
|
||||||
iam_profile = "osbuild-worker"
|
iam_profile = "osbuild-worker"
|
||||||
|
|
@ -132,10 +128,6 @@ cloudwatch_group = "osbuild-worker"
|
||||||
ClientId: "toucan",
|
ClientId: "toucan",
|
||||||
ClientSecretPath: "/etc/osbuild-worker/client_secret",
|
ClientSecretPath: "/etc/osbuild-worker/client_secret",
|
||||||
},
|
},
|
||||||
Pulp: &pulpConfig{
|
|
||||||
Credentials: "/etc/osbuild-worker/pulp-creds",
|
|
||||||
ServerURL: "https://example.com/pulp",
|
|
||||||
},
|
|
||||||
DeploymentChannel: "local",
|
DeploymentChannel: "local",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -25,7 +24,6 @@ import (
|
||||||
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/common"
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
"github.com/osbuild/osbuild-composer/internal/upload/oci"
|
"github.com/osbuild/osbuild-composer/internal/upload/oci"
|
||||||
"github.com/osbuild/osbuild-composer/internal/upload/pulp"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
@ -318,44 +316,6 @@ func (impl *OSBuildJobImpl) getContainerClient(destination string, targetOptions
|
||||||
return client, nil
|
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 {
|
func makeJobErrorFromOsbuildOutput(osbuildOutput *osbuild.Result) *clienterrors.Error {
|
||||||
var osbErrors []string
|
var osbErrors []string
|
||||||
if osbuildOutput.Error != nil {
|
if osbuildOutput.Error != nil {
|
||||||
|
|
@ -1331,23 +1291,6 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
||||||
logWithId.Printf("[container] 🎉 Image uploaded (%s)!", digest.String())
|
logWithId.Printf("[container] 🎉 Image uploaded (%s)!", digest.String())
|
||||||
targetResult.Options = &target.ContainerTargetResultOptions{URL: client.Target.String(), Digest: 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:
|
default:
|
||||||
// TODO: we may not want to return completely here with multiple targets, because then no TargetErrors will be added to the JobError details
|
// 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.
|
// Nevertheless, all target errors will be still in the OSBuildJobResult.
|
||||||
|
|
|
||||||
|
|
@ -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
|
var repositoryMTLSConfig *RepositoryMTLSConfig
|
||||||
if config.RepositoryMTLSConfig != nil {
|
if config.RepositoryMTLSConfig != nil {
|
||||||
baseURL, err := url.Parse(config.RepositoryMTLSConfig.BaseURL)
|
baseURL, err := url.Parse(config.RepositoryMTLSConfig.BaseURL)
|
||||||
|
|
@ -503,10 +496,6 @@ var run = func() {
|
||||||
CertPath: containersCertPath,
|
CertPath: containersCertPath,
|
||||||
TLSVerify: &containersTLSVerify,
|
TLSVerify: &containersTLSVerify,
|
||||||
},
|
},
|
||||||
PulpConfig: PulpConfiguration{
|
|
||||||
CredsFilePath: pulpCredsFilePath,
|
|
||||||
ServerAddress: pulpAddress,
|
|
||||||
},
|
|
||||||
RepositoryMTLSConfig: repositoryMTLSConfig,
|
RepositoryMTLSConfig: repositoryMTLSConfig,
|
||||||
},
|
},
|
||||||
worker.JobTypeKojiInit: &KojiInitJobImpl{
|
worker.JobTypeKojiInit: &KojiInitJobImpl{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue