promoter

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NrTagsPromoted metrics
	NrTagsPromoted = promauto.NewCounter(prometheus.CounterOpts{
		Name: "nr_tags_promoted_total",
		Help: "The total number of tags being promoted",
	})
	// HistArtifactory metrics
	HistArtifactory = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "request_from_artifactory",
		Help:    "Historgram get from artifactory",
		Buckets: []float64{0.1, 0.2, 0.5, 1, 2, 5},
	},
		[]string{"repoImage"})

	// HistWebhook metrics
	HistWebhook = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "request_to_webhook",
		Help:    "Historgram post to webhook",
		Buckets: []float64{0.1, 0.2, 0.5, 1, 2, 5},
	},
		[]string{"repoImage"})
)

Functions

func AppendIfMissing

func AppendIfMissing(slice []string, i string) []string

AppendIfMissing takes a list and adds unique values to that list

func InitialRunner added in v0.4.0

func InitialRunner(item *Items, client *http.Client, service RedirectRepository) error

InitialRunner creates the initial data in the database, getting all the data that currently exist in your repo

func MainRunner added in v0.4.0

func MainRunner(ctx context.Context, item *Items, client *http.Client, service RedirectRepository)

MainRunner the main for loop of promoterChecker

func StringNotInSlice

func StringNotInSlice(a string, list []string) bool

StringInSlice checks if a string is in the existing list

Types

type Children added in v0.4.0

type Children struct {
	URI    string
	Folder bool
}

Children artifactory output for all tags

type Item added in v0.4.0

type Item struct {
	Repo    string
	Image   string
	Webhook string
}

Item the config values that the app check

type Items added in v0.4.0

type Items struct {
	Containers        []Item `yaml:"containers"`
	ArtifactoryURL    string `yaml:"artifactoryURL"`
	ArtifactoryAPIkey string `yaml:"artifactoryAPIkey"`
	ArtifactoryUSER   string `yaml:"artifactoryUSER"`
	PollTime          int    `yaml:"pollTime"`
	HTTPtimeout       int    `yaml:"httpTimeout"`
	HTTPinsecure      bool   `yaml:"httpInsecure"`
	WebhookSecret     string `yaml:"webhookSecret"`
	DBType            string `yaml:"dbType"`
	EndpointPort      int    `yaml:"endpointPort"`
}

Items config file struct

type RedirectRepository

type RedirectRepository interface {
	Store(repoImage string, artrepo string, image string, tags []string) error
	Read(repoImage string) ([]string, error)
	UpdateTags(repoImage string, repo string, image string, newTags []string) error
}

type RedirectService

type RedirectService interface {
	Store(repoImage string, artrepo string, image string, tags []string) error
	Read(repoImage string) ([]string, error)
	UpdateTags(repoImage string, repo string, image string, newTags []string) error
}

func NewRedirectService

func NewRedirectService(redirectRepo RedirectRepository) RedirectService

type Repos

type Repos struct {
	RepoImage string
	Repo      string
	Image     string
	Tags      []string
}

Repos what promotionChecker looks for.

type Tags added in v0.4.0

type Tags struct {
	Repo         string
	Path         string
	Created      string
	CreatedBy    string
	LastModified string
	ModifiedBy   string
	LastUpdated  string
	Children     []Children
	URI          string
}

Tags artifactory output from rest call

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL