Documentation ¶
Overview ¶
package pipelines has functions and types that orchestrate containers.
Index ¶
- Variables
- func CDN(ctx context.Context, d *dagger.Client, args PipelineArgs) error
- func Deb(ctx context.Context, d *dagger.Client, args PipelineArgs) error
- func Docker(ctx context.Context, d *dagger.Client, args PipelineArgs) error
- func GrafanaBackendBuild(ctx context.Context, d *dagger.Client, src *dagger.Directory, ...) error
- func GrafanaBackendBuildDirectories(ctx context.Context, d *dagger.Client, opts *GrafanaCompileOpts, ...) (map[executil.Distribution]*dagger.Directory, error)
- func GrafanaBackendBuildDirectory(ctx context.Context, d *dagger.Client, opts *GrafanaCompileOpts) (*dagger.Directory, error)
- func GrafanaBackendTestIntegration(ctx context.Context, d *dagger.Client, src *dagger.Directory, ...) error
- func GrafanaBackendTests(ctx context.Context, d *dagger.Client, src *dagger.Directory, ...) error
- func GrafanaImageTags(base BaseImage, registry string, opts TarFileOpts) []string
- func ImageTag(registry, org, repo, version string) string
- func NPM(ctx context.Context, d *dagger.Client, args PipelineArgs) error
- func Package(ctx context.Context, d *dagger.Client, opts PackageOpts) error
- func PackageFiles(ctx context.Context, d *dagger.Client, opts PackageOpts) (map[executil.Distribution]*dagger.File, error)
- func PackageInstaller(ctx context.Context, d *dagger.Client, args PipelineArgs, opts InstallerOpts) error
- func PathsWithRoot(root string, paths []string) []string
- func ProImage(ctx context.Context, dc *dagger.Client, args PipelineArgs) error
- func PublishDirFunc(ctx context.Context, sm *semaphore.Weighted, d *dagger.Client, ...) func() error
- func PublishFileFunc(ctx context.Context, sm *semaphore.Weighted, d *dagger.Client, ...) func() error
- func PublishPackage(ctx context.Context, d *dagger.Client, src *dagger.Directory, ...) error
- func RPM(ctx context.Context, d *dagger.Client, args PipelineArgs) error
- func ReplaceExt(original, extension string) string
- func TarFilename(opts TarFileOpts) string
- func ValidatePackage(ctx context.Context, d *dagger.Client, src *dagger.Directory, ...) error
- func ValidatePackageSignature(ctx context.Context, d *dagger.Client, src *dagger.Directory, ...) error
- func ValidatePackageUpgrade(ctx context.Context, d *dagger.Client, src *dagger.Directory, ...) error
- func WindowsInstaller(ctx context.Context, d *dagger.Client, args PipelineArgs) error
- func WithoutExt(name string) string
- func WriteToStdout(v []string)
- func Zip(ctx context.Context, d *dagger.Client, args PipelineArgs) error
- type BaseImage
- type ConcurrencyOpts
- type GrafanaCompileOpts
- type InstallerOpts
- type PackageOpts
- type PipelineArgs
- type PipelineFunc
- type PipelineFuncWithPackageInput
- type SyncWriter
- type TarFileOpts
Constants ¶
This section is empty.
Variables ¶
var IntegrationDatabases = []string{"sqlite", "mysql", "postgres"}
var PackagedPaths = []string{
"Dockerfile",
"LICENSE",
"NOTICE.md",
"README.md",
"VERSION",
"bin/",
"conf/",
"docs/sources/",
"packaging/deb",
"packaging/rpm",
"packaging/docker",
"packaging/wrappers",
"plugins-bundled/",
"public/",
"npm-artifacts/",
}
PackagedPaths are paths that are included in the grafana tarball.
var Stdout = NewSyncWriter(os.Stdout)
Functions ¶
func Deb ¶
Deb uses the grafana package given by the '--package' argument and creates a .deb installer. It accepts publish args, so you can place the file in a local or remote destination.
func Docker ¶
Docker is a pipeline that uses a grafana.tar.gz as input and creates a Docker image using that same Grafana's Dockerfile. Grafana's Dockerfile should support supplying a tar.gz using a --build-arg.
func GrafanaBackendBuild ¶
func GrafanaBackendBuild(ctx context.Context, d *dagger.Client, src *dagger.Directory, args PipelineArgs) error
GrafanaBackendBuild builds all of the distributions in the '--distros' argument and places them in the 'bin' directory of the PWD.
func GrafanaBackendBuildDirectories ¶
func GrafanaBackendBuildDirectories(ctx context.Context, d *dagger.Client, opts *GrafanaCompileOpts, distros []executil.Distribution) (map[executil.Distribution]*dagger.Directory, error)
GrafanaBackendBuildDirectories builds multiple distributions and returns the directories for each one. The returned map of directories will be keyed by the distribution that the directory corresponds to.
func GrafanaBackendBuildDirectory ¶
func GrafanaBackendBuildDirectory(ctx context.Context, d *dagger.Client, opts *GrafanaCompileOpts) (*dagger.Directory, error)
GrafanaBackendBuildDirectory returns a directory with the compiled backend binaries for the given distribution.
func GrafanaBackendTestIntegration ¶
func GrafanaBackendTestIntegration(ctx context.Context, d *dagger.Client, src *dagger.Directory, args PipelineArgs) error
GrafanaBackendTestIntegration runs the Grafana backend test containers for short (unit) and integration tests.
func GrafanaBackendTests ¶
func GrafanaBackendTests(ctx context.Context, d *dagger.Client, src *dagger.Directory, args PipelineArgs) error
GrafanaBackendTests runs the Grafana backend test containers for short (unit) and integration tests.
func GrafanaImageTags ¶
func GrafanaImageTags(base BaseImage, registry string, opts TarFileOpts) []string
GrafanaImageTag returns the name of the grafana docker image based on the tar package name. To maintain backwards compatibility, we must keep this the same as it was before.
func PackageFiles ¶
func PackageFiles(ctx context.Context, d *dagger.Client, opts PackageOpts) (map[executil.Distribution]*dagger.File, error)
PackageFile builds and packages Grafana into a tar.gz for each dsitrbution and returns a map of the dagger file that holds each tarball, keyed by the distribution it corresponds to.
func PackageInstaller ¶
func PackageInstaller(ctx context.Context, d *dagger.Client, args PipelineArgs, opts InstallerOpts) error
Uses the grafana package given by the '--package' argument and creates a installer. It accepts publish args, so you can place the file in a local or remote destination.
func PathsWithRoot ¶
func PublishDirFunc ¶
func PublishFileFunc ¶
func PublishFileFunc(ctx context.Context, sm *semaphore.Weighted, d *dagger.Client, opts *containers.PublishFileOpts) func() error
func PublishPackage ¶
func PublishPackage(ctx context.Context, d *dagger.Client, src *dagger.Directory, args PipelineArgs) error
PublishPackage creates a package and publishes it to a Google Cloud Storage bucket.
func RPM ¶
RPM uses the grafana package given by the '--package' argument and creates a .rpm installer. It accepts publish args, so you can place the file in a local or remote destination.
func ReplaceExt ¶
ReplaceExt replaces the extension of the given package name. For example, if the input package name (original) is grafana_v1.0.0_linux-arm64_1.tar.gz, then derivatives should have the same name, but with a different extension. This function also removes the leading directory and removes the URL scheme prefix.
func TarFilename ¶
func TarFilename(opts TarFileOpts) string
TarFilename returns a file name that matches this format: {grafana|grafana-enterprise}_{version}_{os}_{arch}_{build_number}.tar.gz
func ValidatePackage ¶
func ValidatePackage(ctx context.Context, d *dagger.Client, src *dagger.Directory, args PipelineArgs) error
ValidatePackage downloads a package and validates from a Google Cloud Storage bucket.
func ValidatePackageUpgrade ¶
func WindowsInstaller ¶
WindowsInstaller uses a debian image with 'nsis' installed to create the Windows installer. The WindowsInstaller also uses "winsw", or "Windows Service Wrapper" (https://github.com/winsw/winsw) to handle the status, start, and stop functions of the windows service so that Grafana doesn't have to implement it.
func WithoutExt ¶
func WriteToStdout ¶
func WriteToStdout(v []string)
Types ¶
type ConcurrencyOpts ¶
type ConcurrencyOpts struct {
Parallel int64
}
func ConcurrencyOptsFromFlags ¶
func ConcurrencyOptsFromFlags(c cliutil.CLIContext) *ConcurrencyOpts
type GrafanaCompileOpts ¶
type GrafanaCompileOpts struct { // Source is the source tree of Grafana, ideally retrieved from a git clone. This argument is required. Source *dagger.Directory // Distribution is the target distribution to compile for. This argument is required. Distribution executil.Distribution // Platform is the dagger platform to run the containers on. Unless there's a specific requirement, this should be left empty to match the current running docker platform. Platform dagger.Platform // Version is the semver version number to insert into the binary via build arguments. Version string // Env is an optional map of environment variables (keyed by literal variable name to value) to set in the build container(s). Env map[string]string GoTags []string // Edition is just used for logging / visualization purposes Edition string YarnCacheHostDir string }
GrafanaCompileOpts are the options that must be supplied from the user to build Grafana.
func (*GrafanaCompileOpts) BackendCompileOpts ¶
func (o *GrafanaCompileOpts) BackendCompileOpts(ctx context.Context, d *dagger.Client) (*containers.CompileBackendOpts, error)
func (*GrafanaCompileOpts) BuildInfo ¶
func (o *GrafanaCompileOpts) BuildInfo(ctx context.Context, d *dagger.Client) (*containers.BuildInfo, error)
type InstallerOpts ¶
type PackageOpts ¶
type PackageOpts struct { *GrafanaCompileOpts Distributions []executil.Distribution BuildID string Edition string NodeCacheVolume *dagger.CacheVolume }
The PackageOpts command requires all of the options to build Grafana, but supports a list of distros instead of just one. It also requires extra options for determining the package name. While this struct embeds GrafanaCompileOpts, it ignores the 'Distribution' field in favor of the 'Distributions' list.
type PipelineArgs ¶
type PipelineArgs struct { // These arguments are ones that are available at the global level. Verbose bool // Platform, where applicable, specifies what platform (linux/arm64, for example) to run the dagger containers on. // This should really only be used if you know what you're doing. misusing this flag can result in really slow builds. // Some example scenarios where you might want to use this: // * You're on linux/amd64 and you're building a docker image for linux/armv7 or linux/arm64 // * You're on linux/arm64 and you're building a package for linux/arm64 Platform dagger.Platform // Context is available for all sub-commands that define their own flags. Context cliutil.CLIContext // GrafanaOpts will be populated if the GrafanaFlags are enabled on the current sub-command. GrafanaOpts *containers.GrafanaOpts // PackageOpts will be populated if the PackageFlags are enabled on the current sub-command. PackageOpts *containers.PackageOpts // PublishOpts will be populated if the PublishFlags flags are enabled on the current sub-command // This is set for pipelines that publish artifacts. PublishOpts *containers.PublishOpts // PackageInputOpts will be populated if the PackageInputFlags are enabled on current sub-command. // This is set for pipelines that accept a package as input. PackageInputOpts *containers.PackageInputOpts GPGOpts *containers.GPGOpts DockerOpts *containers.DockerOpts GCPOpts *containers.GCPOpts ConcurrencyOpts *ConcurrencyOpts // ProImageOpts will be populated if ProImageFlags are enabled on the current sub-command. ProImageOpts *containers.ProImageOpts }
func PipelineArgsFromContext ¶
func PipelineArgsFromContext(ctx context.Context, c cliutil.CLIContext) (PipelineArgs, error)
PipelineArgsFromContext populates a pipelines.PipelineArgs from a CLI context.
type PipelineFunc ¶
type SyncWriter ¶
func NewSyncWriter ¶
func NewSyncWriter(w io.Writer) *SyncWriter
type TarFileOpts ¶
type TarFileOpts struct { Version string BuildID string // Edition is the flavor text after "grafana-", like "enterprise". Edition string Distro executil.Distribution Suffix string }
func TarOptsFromFileName ¶
func TarOptsFromFileName(filename string) TarFileOpts