container: add support for uploading to registries
Add a new generic container registry client via a new `container` package. Use this to create a command line utility as well as a new upload target for container registries. The code uses the github.com/containers/* project and packages to interact with container registires that is also used by skopeo, podman et al. One if the dependencies is `proglottis/gpgme` that is using cgo to bind libgpgme, so we have to add the corresponding devel package to the BuildRequires as well as installing it on CI. Checks will follow later via an integration test.
This commit is contained in:
parent
d136a075bc
commit
986f076276
955 changed files with 164203 additions and 2549 deletions
52
vendor/github.com/docker/go-metrics/counter.go
generated
vendored
Normal file
52
vendor/github.com/docker/go-metrics/counter.go
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package metrics
|
||||
|
||||
import "github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
// Counter is a metrics that can only increment its current count
|
||||
type Counter interface {
|
||||
// Inc adds Sum(vs) to the counter. Sum(vs) must be positive.
|
||||
//
|
||||
// If len(vs) == 0, increments the counter by 1.
|
||||
Inc(vs ...float64)
|
||||
}
|
||||
|
||||
// LabeledCounter is counter that must have labels populated before use.
|
||||
type LabeledCounter interface {
|
||||
WithValues(vs ...string) Counter
|
||||
}
|
||||
|
||||
type labeledCounter struct {
|
||||
pc *prometheus.CounterVec
|
||||
}
|
||||
|
||||
func (lc *labeledCounter) WithValues(vs ...string) Counter {
|
||||
return &counter{pc: lc.pc.WithLabelValues(vs...)}
|
||||
}
|
||||
|
||||
func (lc *labeledCounter) Describe(ch chan<- *prometheus.Desc) {
|
||||
lc.pc.Describe(ch)
|
||||
}
|
||||
|
||||
func (lc *labeledCounter) Collect(ch chan<- prometheus.Metric) {
|
||||
lc.pc.Collect(ch)
|
||||
}
|
||||
|
||||
type counter struct {
|
||||
pc prometheus.Counter
|
||||
}
|
||||
|
||||
func (c *counter) Inc(vs ...float64) {
|
||||
if len(vs) == 0 {
|
||||
c.pc.Inc()
|
||||
}
|
||||
|
||||
c.pc.Add(sumFloat64(vs...))
|
||||
}
|
||||
|
||||
func (c *counter) Describe(ch chan<- *prometheus.Desc) {
|
||||
c.pc.Describe(ch)
|
||||
}
|
||||
|
||||
func (c *counter) Collect(ch chan<- prometheus.Metric) {
|
||||
c.pc.Collect(ch)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue