client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const CreateTablesSQL = `` /* 210-byte string literal not displayed */
View Source
const InsertRowSql = `` /* 149-byte string literal not displayed */

Variables

This section is empty.

Functions

func SetUpClientTest

func SetUpClientTest(t *testing.T) *testEngine

Types

type Clients

type Clients struct {
	NomadClient          *NomadClient
	DockerRegistryClient *DockerRegistryClient
	PostgresClient       *PostgresClient
	DockerTags           sync.Map
	DigestMap            sync.Map

	// for test usage only
	NomadServer *testutil.TestServer
}

func SetUpClients

func SetUpClients(conf *viper.Viper) *Clients

func SetUpTestClients

func SetUpTestClients(t *testing.T, conf *viper.Viper) *Clients

func (*Clients) DeployPinnedTag

func (client *Clients) DeployPinnedTag(conf *viper.Viper, repoName string)

func (*Clients) GetCachedTagDigest

func (client *Clients) GetCachedTagDigest(repoName string) (string, error)

func (*Clients) GetCachedTags

func (client *Clients) GetCachedTags(repoName string) ([]string, error)

func (*Clients) GetFormattedPinnedTag

func (client *Clients) GetFormattedPinnedTag(repoName string) (string, error)

fetches the CACHED pinned tag

func (*Clients) PopulateCaches

func (client *Clients) PopulateCaches(repoName string)

func (*Clients) ShouldDeploy

func (client *Clients) ShouldDeploy(repoName string) (bool, error)

this function compares cached values with the actual values, so only update the cache after calling, not before

func (*Clients) UpdateCaches

func (client *Clients) UpdateCaches(repoName string)

type DeployedRepositoryVersionRow

type DeployedRepositoryVersionRow struct {
	PinnedTag      string `json:"pinned_tag" db:"pinned_tag"`
	RepositoryName string `json:"repository_name" db:"repository_name"`
	AutoDeploy     bool   `json:"auto_deploy" db:"auto_deploy"`
}

type DockerRegistryClient

type DockerRegistryClient struct {
	Hubs map[string]registry.Registry
	// contains filtered or unexported fields
}

func InitializeDockerRegistryClient

func InitializeDockerRegistryClient(conf *viper.Viper) *DockerRegistryClient

func (*DockerRegistryClient) GetAllTags

func (e *DockerRegistryClient) GetAllTags(repoName string) ([]string, error)

func (*DockerRegistryClient) GetTagDigest

func (e *DockerRegistryClient) GetTagDigest(repoName, tag string) (string, error)

type NomadClient

type NomadClient struct {
	// contains filtered or unexported fields
}

func InitializeNomadClient

func InitializeNomadClient(conf *viper.Viper) *NomadClient

func (*NomadClient) GetNomadJobTag

func (client *NomadClient) GetNomadJobTag(jobID, imageName string) (string, error)

func (*NomadClient) MonitorNomadJob

func (client *NomadClient) MonitorNomadJob(evalID, jobID, desiredTag string)

Monitor the progress of a Nomad job deployment and posts a slack update on the outcome

func (*NomadClient) RestartNomadJob

func (client *NomadClient) RestartNomadJob(job *nomad.Job, desiredTag string)

There is no way to restart a job through the API currently https://github.com/hashicorp/nomad/issues/698

func (*NomadClient) UpdateNomadJobTag

func (client *NomadClient) UpdateNomadJobTag(jobID, imageName, taskName, desiredTag string)

Updates one image in a Nomad job, unless the Nomad jobspec is registrywatcher itself. Since the registrywatcher Nomad jobspec contains 2 images (UI and backend), it will update both images before it restarts itself.

type PostgresClient

type PostgresClient struct {
	// contains filtered or unexported fields
}

func InitializePostgresClient

func InitializePostgresClient(conf *viper.Viper) (*PostgresClient, error)

Initialize creates tables if they do not exist cloud agnostic function

func (*PostgresClient) GetAllTags

func (client *PostgresClient) GetAllTags() (map[string]string, error)

func (*PostgresClient) GetAutoDeployFlag

func (client *PostgresClient) GetAutoDeployFlag(repoName string) (bool, error)

func (*PostgresClient) GetPinnedTag

func (client *PostgresClient) GetPinnedTag(repoName string) (string, error)

func (*PostgresClient) UpdateAutoDeployFlag

func (client *PostgresClient) UpdateAutoDeployFlag(repoName string, autoDeploy bool) error

func (*PostgresClient) UpdatePinnedTag

func (client *PostgresClient) UpdatePinnedTag(repoName, pinnedTag string) error

Jump to

Keyboard shortcuts

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