mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2024-12-18 11:52:16 +03:00
552dbcdda9
Add copyright header Co-authored-by: sillyguodong <gedong_1994@163.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/29 Reviewed-by: Jason Song <i@wolfogre.com> Reviewed-by: Zettat123 <zettat123@noreply.gitea.io> Co-authored-by: sillyguodong <sillyguodong@noreply.gitea.io> Co-committed-by: sillyguodong <sillyguodong@noreply.gitea.io>
33 lines
655 B
Go
33 lines
655 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package engine
|
|
|
|
import "github.com/docker/docker/client"
|
|
|
|
// An Option configures a mutex.
|
|
type Option interface {
|
|
Apply(*Docker)
|
|
}
|
|
|
|
// OptionFunc is a function that configure a value.
|
|
type OptionFunc func(*Docker)
|
|
|
|
// Apply calls f(option)
|
|
func (f OptionFunc) Apply(docker *Docker) {
|
|
f(docker)
|
|
}
|
|
|
|
// WithClient set custom client
|
|
func WithClient(c client.APIClient) Option {
|
|
return OptionFunc(func(q *Docker) {
|
|
q.client = c
|
|
})
|
|
}
|
|
|
|
// WithHidePull hide pull event.
|
|
func WithHidePull(v bool) Option {
|
|
return OptionFunc(func(q *Docker) {
|
|
q.hidePull = v
|
|
})
|
|
}
|