debian-forge-composer/internal/target/local_target.go
Tomas Hozza 40abb32dec target: deprecate local target and don't use it anywhere
Completely remove the use of `local` target from all code, which is not
required to keep backward compatibility. The target has not been used in
composer for some time already, but some unit tests still used its data
structures. Mark the target as deprecated and adjust all unit tests that
depended on it.

The backward compatibility is kept mostly to enable long running
osbuild-composer instances, which were upgraded to still read old jobs
from the store.

While a target with the same intention will be reintroduced, the current
`local` target data structures contain many fields which would not be
relevant for the new target.

In addition, while the "local" target will be ever used only by Weldr
API, the name would be a bit misleading. Although the worker usually
runs on the same system when using Weldr API, there is no hard
requirement enforcing this setup. In reality, the worker will be
uploading the image back to the worker server, so there is room for a
better name.
2022-07-01 18:55:01 +01:00

24 lines
924 B
Go

package target
import "github.com/google/uuid"
// Deprecated: TargetNameLocal should not be used by any new code.
const TargetNameLocal TargetName = "org.osbuild.local"
// Deprecated: LocalTargetOptions should not be used by any new code.
// The data structure is kept for backward compatibility and to ensure
// that old osbuild-composer instances which were upgraded will be able
// to read the target details from the local store.
type LocalTargetOptions struct {
ComposeId uuid.UUID `json:"compose_id"`
ImageBuildId int `json:"image_build_id"`
Filename string `json:"filename"`
StreamOptimized bool `json:"stream_optimized"` // return image as stream optimized
}
func (LocalTargetOptions) isTargetOptions() {}
// Deprecated: NewLocalTarget should not be used by any new code.
func NewLocalTarget(options *LocalTargetOptions) *Target {
return newTarget(TargetNameLocal, options)
}