dx

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 27 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPatches added in v0.8.0

func ApplyPatches(strategicMergePatch string, jsonPatches []Json6902Patch, manifests string) (string, error)

func CloneChartFromRepo

func CloneChartFromRepo(m *Manifest, token string) (string, error)

CloneChartFromRepo returns the chart location of the specified chart

func GetTemplatedManifests added in v0.8.0

func GetTemplatedManifests(m *Manifest) (string, error)

func HelmTemplate

func HelmTemplate(m *Manifest) (string, error)

HelmTemplate returns Kubernetes yaml from the Gimlet Manifest format

func RenderCueToManifests added in v0.8.0

func RenderCueToManifests(fileContent string) ([]string, error)

func SplitHelmOutput

func SplitHelmOutput(input map[string]string) map[string]string

SplitHelmOutput splits helm's multifile string output into file paths and their content

func TemplateChart added in v0.8.0

func TemplateChart(m *Manifest) (string, error)

Types

type Artifact

type Artifact struct {
	ID string `json:"id,omitempty"`

	Created int64 `json:"created,omitempty"`

	// The releasable version
	Version Version `json:"version,omitempty"`

	// Arbitrary environment variables from CI
	Context map[string]string `json:"context,omitempty"`

	// The complete set of Gimlet environments from the Gimlet environment files
	Environments []*Manifest `json:"environments,omitempty"`

	// The complete set of Gimlet environments from the Gimlet environment files
	CueEnvironments []string `json:"cueEnvironments,omitempty"`

	// CI job information, test results, Docker image information, etc
	Items []map[string]interface{} `json:"items,omitempty"`
}

Artifact that contains all metadata that can be later used for releasing and auditing

func (*Artifact) CueEnvironmentsToManifests added in v0.8.0

func (a *Artifact) CueEnvironmentsToManifests() ([]*Manifest, error)

func (*Artifact) HasCleanupPolicy added in v0.5.0

func (a *Artifact) HasCleanupPolicy() bool

func (*Artifact) Vars added in v0.5.5

func (a *Artifact) Vars() map[string]string

type Chart

type Chart struct {
	Repository string `yaml:"repository" json:"repository"`
	Name       string `yaml:"name" json:"name"`
	Version    string `yaml:"version" json:"version"`
}

type Cleanup added in v0.5.0

type Cleanup struct {
	AppToCleanup string       `yaml:"app" json:"app"`
	Event        CleanupEvent `yaml:"event" json:"event"`
	Branch       string       `yaml:"branch,omitempty" json:"branch,omitempty"`
}

func (*Cleanup) ResolveVars added in v0.5.0

func (c *Cleanup) ResolveVars(vars map[string]string) error

type CleanupEvent added in v0.5.0

type CleanupEvent int

CleanupEvent represents events that cause an app instance cleanup

const (
	// BranchDeleted indicates if a git branch is deleted
	BranchDeleted CleanupEvent = iota
)

func (CleanupEvent) MarshalJSON added in v0.5.0

func (s CleanupEvent) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (CleanupEvent) MarshalYAML added in v0.5.0

func (s CleanupEvent) MarshalYAML() (interface{}, error)

MarshalYAML marshals the enum as a quoted yaml string

func (CleanupEvent) String added in v0.5.0

func (s CleanupEvent) String() string

func (*CleanupEvent) UnmarshalJSON added in v0.5.0

func (s *CleanupEvent) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls a quoted json string to the enum value

func (*CleanupEvent) UnmarshalYAML added in v0.5.0

func (s *CleanupEvent) UnmarshalYAML(n *yaml.Node) error

UnmarshalYAML unmarshalls a quoted yaml string to the enum value

type Deploy

type Deploy struct {
	Tag    string    `yaml:"tag,omitempty" json:"tag,omitempty"`
	Branch string    `yaml:"branch,omitempty" json:"branch,omitempty"`
	Event  *GitEvent `yaml:"event,omitempty" json:"event,omitempty"`
}

type GitEvent

type GitEvent int

GitEvent represents the git event that produced the artifact

const (
	// Push artifact is produced by a git push event
	Push GitEvent = iota
	// Tag artifact is produced by a git tag event
	Tag
	// PR artifact is produced by a pull request event
	PR
)

func PRPtr

func PRPtr() *GitEvent

func PushPtr

func PushPtr() *GitEvent

func TagPtr

func TagPtr() *GitEvent

func (GitEvent) MarshalJSON

func (s GitEvent) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (GitEvent) MarshalYAML

func (s GitEvent) MarshalYAML() (interface{}, error)

MarshalYAML marshals the enum as a quoted yaml string

func (GitEvent) String

func (s GitEvent) String() string

func (*GitEvent) UnmarshalJSON

func (s *GitEvent) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls a quoted json string to the enum value

func (*GitEvent) UnmarshalYAML

func (s *GitEvent) UnmarshalYAML(n *yaml.Node) error

UnmarshalYAML unmarshalls a quoted yaml string to the enum value

type GitopsStatus added in v0.4.0

type GitopsStatus struct {
	Hash       string `json:"hash,omitempty"`
	Status     string `json:"status,omitempty"`
	StatusDesc string `json:"statusDesc,omitempty"`
}

GitopsStatus holds the gitops references that were created based on an event

type Json6902Patch added in v0.8.0

type Json6902Patch struct {
	Patch  string `yaml:"patch" json:"patch"`
	Target Target `yaml:"target" json:"target"`
}

type Manifest

type Manifest struct {
	App                   string                 `yaml:"app" json:"app"`
	Env                   string                 `yaml:"env" json:"env"`
	Namespace             string                 `yaml:"namespace" json:"namespace"`
	Deploy                *Deploy                `yaml:"deploy,omitempty" json:"deploy,omitempty"`
	Cleanup               *Cleanup               `yaml:"cleanup,omitempty" json:"cleanup,omitempty"`
	Chart                 Chart                  `yaml:"chart" json:"chart"`
	Values                map[string]interface{} `yaml:"values" json:"values"`
	StrategicMergePatches string                 `yaml:"strategicMergePatches" json:"strategicMergePatches"`
	Json6902Patches       []Json6902Patch        `yaml:"json6902Patches" json:"json6902Patches"`
	Manifests             string                 `yaml:"manifests" json:"manifests"`
}

func (*Manifest) Render added in v0.8.0

func (m *Manifest) Render() (string, error)

func (*Manifest) ResolveVars

func (m *Manifest) ResolveVars(vars map[string]string) error

type Release

type Release struct {
	App string `json:"app"`
	Env string `json:"env"`

	ArtifactID  string `json:"artifactId"`
	TriggeredBy string `json:"triggeredBy"`

	Version *Version `json:"version"`

	GitopsRef  string `json:"gitopsRef"`
	GitopsRepo string `json:"gitopsRepo"`
	Created    int64  `json:"created,omitempty"`

	RolledBack bool `json:"rolledBack,omitempty"`
}

Release contains all metadata about a release event

type ReleaseRequest

type ReleaseRequest struct {
	Env         string `json:"env"`
	App         string `json:"app,omitempty"`
	ArtifactID  string `json:"artifactId"`
	TriggeredBy string `json:"triggeredBy"`
}

ReleaseRequest contains all metadata about the release intent

type ReleaseStatus added in v0.4.0

type ReleaseStatus struct {
	Status       string         `json:"status"`
	StatusDesc   string         `json:"statusDesc"`
	GitopsHashes []GitopsStatus `json:"gitopsHashes"`
}

type RollbackRequest

type RollbackRequest struct {
	Env         string `json:"env"`
	App         string `json:"app"`
	TargetSHA   string `json:"targetSHA"`
	TriggeredBy string `json:"triggeredBy"`
}

RollbackRequest contains all metadata about the rollback intent

type Target added in v0.8.0

type Target struct {
	Group   string `yaml:"group" json:"group"`
	Version string `yaml:"version" json:"version"`
	Kind    string `yaml:"kind" json:"kind"`
	Name    string `yaml:"name" json:"name"`
}

type Version

type Version struct {
	RepositoryName string   `json:"repositoryName,omitempty"`
	SHA            string   `json:"sha,omitempty"`
	Created        int64    `json:"created,omitempty"`
	Branch         string   `json:"branch,omitempty"`
	Event          GitEvent `json:"event,omitempty"`
	SourceBranch   string   `json:"sourceBranch,omitempty"`
	TargetBranch   string   `json:"targetBranch,omitempty"`
	Tag            string   `json:"tag,omitempty"`
	AuthorName     string   `json:"authorName,omitempty"`
	AuthorEmail    string   `json:"authorEmail,omitempty"`
	CommitterName  string   `json:"committerName,omitempty"`
	CommitterEmail string   `json:"committerEmail,omitempty"`
	Message        string   `json:"message,omitempty"`
	URL            string   `json:"url,omitempty"`
}

Jump to

Keyboard shortcuts

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