mirror of
https://github.com/crazy-max/diun.git
synced 2026-01-04 12:05:11 +01:00
Review of platform detection (#56)
* Leave default image platform empty for static provider (see FAQ doc) * Handle platform variant * Add database migration process * Switch to Open Container Specification labels as label-schema.org ones are deprecated * Remove unneeded `diun.os` and `diun.arch` docker labels Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -66,6 +66,12 @@ func New(cfg *config.Config, location *time.Location) (*Diun, error) {
|
||||
func (di *Diun) Start() error {
|
||||
var err error
|
||||
|
||||
// Migrate db
|
||||
err = di.db.Migrate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Run on startup
|
||||
di.Run()
|
||||
|
||||
|
||||
@@ -51,8 +51,7 @@ func (di *Diun) createJob(job model.Job) {
|
||||
|
||||
// Set defaults
|
||||
if err := mergo.Merge(&job.Image, model.Image{
|
||||
Os: "linux",
|
||||
Arch: "amd64",
|
||||
Platform: model.ImagePlatform{},
|
||||
WatchRepo: false,
|
||||
MaxTags: 0,
|
||||
}); err != nil {
|
||||
@@ -75,13 +74,14 @@ func (di *Diun) createJob(job model.Job) {
|
||||
}
|
||||
|
||||
job.Registry, err = registry.New(registry.Options{
|
||||
Os: job.Image.Os,
|
||||
Arch: job.Image.Arch,
|
||||
Username: regUser,
|
||||
Password: regPassword,
|
||||
Timeout: time.Duration(regOpts.Timeout) * time.Second,
|
||||
InsecureTLS: regOpts.InsecureTLS,
|
||||
UserAgent: di.userAgent,
|
||||
Username: regUser,
|
||||
Password: regPassword,
|
||||
Timeout: time.Duration(regOpts.Timeout) * time.Second,
|
||||
InsecureTLS: regOpts.InsecureTLS,
|
||||
UserAgent: di.userAgent,
|
||||
ImageOs: job.Image.Platform.Os,
|
||||
ImageArch: job.Image.Platform.Arch,
|
||||
ImageVariant: job.Image.Platform.Variant,
|
||||
})
|
||||
if err != nil {
|
||||
sublog.Error().Err(err).Msg("Cannot create registry client")
|
||||
|
||||
Reference in New Issue
Block a user