Documentation ¶
Index ¶
- Constants
- Variables
- func GetDroneCommit() (string, error)
- func GetGrafanaVersion(buildID, grafanaDir string) (string, error)
- func GrafanaTimestamp(ctx context.Context, dir string) (int64, error)
- type Architecture
- type Buckets
- type BuildConfig
- type Config
- type Distribution
- type Docker
- type Edition
- type LibC
- type Metadata
- type OS
- type PluginSignature
- type ReleaseMode
- type Revision
- type Variant
- type VersionMap
- type VersionMode
Constants ¶
const ( Tag = "tag" PullRequest = "pull_request" Push = "push" Custom = "custom" Promote = "promote" Cronjob = "cron" )
const (
LibCMusl = "musl"
)
const (
MainBranch = "main"
)
const PublicBucket = "grafana-downloads"
Variables ¶
var AllVariants = []Variant{ VariantArmV6, VariantArmV7, VariantArmV7Musl, VariantArm64, VariantArm64Musl, VariantDarwinAmd64, VariantWindowsAmd64, VariantLinuxAmd64, VariantLinuxAmd64Musl, }
var Versions = VersionMap{ PullRequestMode: { Variants: []Variant{ VariantLinuxAmd64, VariantLinuxAmd64Musl, VariantDarwinAmd64, VariantWindowsAmd64, VariantArm64, VariantArm64Musl, }, PluginSignature: PluginSignature{ Sign: false, AdminSign: false, }, Docker: Docker{ ShouldSave: false, Architectures: []Architecture{ ArchAMD64, ArchARM64, }, Distribution: []Distribution{ Alpine, }, }, }, MainMode: { Variants: []Variant{ VariantArmV6, VariantArmV7, VariantArmV7Musl, VariantArm64, VariantArm64Musl, VariantDarwinAmd64, VariantWindowsAmd64, VariantLinuxAmd64, VariantLinuxAmd64Musl, }, PluginSignature: PluginSignature{ Sign: true, AdminSign: true, }, Docker: Docker{ ShouldSave: false, Architectures: []Architecture{ ArchAMD64, ArchARM64, ArchARMv7, }, Distribution: []Distribution{ Alpine, Ubuntu, }, }, Buckets: Buckets{ Artifacts: "grafana-downloads", ArtifactsEnterprise2: "grafana-downloads-enterprise2", CDNAssets: "grafana-static-assets", Storybook: "grafana-storybook", }, }, DownstreamMode: { Variants: []Variant{ VariantArmV6, VariantArmV7, VariantArmV7Musl, VariantArm64, VariantArm64Musl, VariantDarwinAmd64, VariantWindowsAmd64, VariantLinuxAmd64, VariantLinuxAmd64Musl, }, PluginSignature: PluginSignature{ Sign: true, AdminSign: true, }, Docker: Docker{ ShouldSave: true, Architectures: []Architecture{ ArchAMD64, ArchARM64, ArchARMv7, }, Distribution: []Distribution{ Alpine, Ubuntu, }, }, Buckets: Buckets{ Artifacts: "grafana-downloads", ArtifactsEnterprise2: "grafana-downloads-enterprise2", CDNAssets: "grafana-static-assets", }, }, ReleaseBranchMode: { Variants: []Variant{ VariantArmV6, VariantArmV7, VariantArmV7Musl, VariantArm64, VariantArm64Musl, VariantDarwinAmd64, VariantWindowsAmd64, VariantLinuxAmd64, VariantLinuxAmd64Musl, }, PluginSignature: PluginSignature{ Sign: true, AdminSign: true, }, Docker: Docker{ ShouldSave: true, Architectures: []Architecture{ ArchAMD64, ArchARM64, ArchARMv7, }, Distribution: []Distribution{ Alpine, Ubuntu, }, PrereleaseBucket: "grafana-prerelease/artifacts/docker", }, Buckets: Buckets{ Artifacts: "grafana-downloads", ArtifactsEnterprise2: "grafana-downloads-enterprise2", CDNAssets: "grafana-static-assets", }, }, TagMode: { Variants: []Variant{ VariantArmV6, VariantArmV7, VariantArmV7Musl, VariantArm64, VariantArm64Musl, VariantDarwinAmd64, VariantWindowsAmd64, VariantLinuxAmd64, VariantLinuxAmd64Musl, }, PluginSignature: PluginSignature{ Sign: true, AdminSign: true, }, Docker: Docker{ ShouldSave: true, Architectures: []Architecture{ ArchAMD64, ArchARM64, ArchARMv7, }, Distribution: []Distribution{ Alpine, Ubuntu, }, PrereleaseBucket: "grafana-prerelease/artifacts/docker", }, Buckets: Buckets{ Artifacts: "grafana-prerelease/artifacts/downloads", ArtifactsEnterprise2: "grafana-prerelease/artifacts/downloads-enterprise2", CDNAssets: "grafana-prerelease", CDNAssetsDir: "artifacts/static-assets", Storybook: "grafana-prerelease", StorybookSrcDir: "artifacts/storybook", }, }, Enterprise2Mode: { Variants: []Variant{ VariantArmV6, VariantArmV7, VariantArmV7Musl, VariantArm64, VariantArm64Musl, VariantDarwinAmd64, VariantWindowsAmd64, VariantLinuxAmd64, VariantLinuxAmd64Musl, }, PluginSignature: PluginSignature{ Sign: true, AdminSign: true, }, Docker: Docker{ ShouldSave: true, Architectures: []Architecture{ ArchAMD64, ArchARM64, ArchARMv7, }, Distribution: []Distribution{ Alpine, Ubuntu, }, PrereleaseBucket: "grafana-prerelease/artifacts/docker", }, Buckets: Buckets{ Artifacts: "grafana-prerelease/artifacts/downloads", ArtifactsEnterprise2: "grafana-prerelease/artifacts/downloads-enterprise2", CDNAssets: "grafana-prerelease", CDNAssetsDir: "artifacts/static-assets", Storybook: "grafana-prerelease", StorybookSrcDir: "artifacts/storybook", }, }, CloudMode: { Variants: []Variant{ VariantLinuxAmd64Musl, VariantLinuxAmd64, }, PluginSignature: PluginSignature{ Sign: true, AdminSign: true, }, Docker: Docker{ ShouldSave: true, Architectures: []Architecture{ ArchAMD64, }, Distribution: []Distribution{ Alpine, }, PrereleaseBucket: "grafana-prerelease/artifacts/docker", }, Buckets: Buckets{ Artifacts: "grafana-prerelease/artifacts/downloads", ArtifactsEnterprise2: "grafana-prerelease/artifacts/downloads-enterprise2", CDNAssets: "grafana-prerelease", CDNAssetsDir: "artifacts/static-assets", Storybook: "grafana-prerelease", StorybookSrcDir: "artifacts/storybook", }, }, }
Functions ¶
func GetDroneCommit ¶
func GetGrafanaVersion ¶
GetGrafanaVersion gets the Grafana version from the package.json
Types ¶
type Architecture ¶
type Architecture string
Architecture is an allowed value in the GOARCH environment variable.
const ( ArchAMD64 Architecture = "amd64" ArchARMv6 Architecture = "armv6" ArchARMv7 Architecture = "armv7" ArchARM64 Architecture = "arm64" ArchARMHF Architecture = "armhf" ArchARMHFP Architecture = "armhfp" ArchARM Architecture = "arm" )
type Buckets ¶
type Buckets struct { Artifacts string `json:"artifacts,omitempty"` ArtifactsEnterprise2 string `json:"artifactsEnterprise2,omitempty"` CDNAssets string `json:"CDNAssets,omitempty"` CDNAssetsDir string `json:"CDNAssetsDir,omitempty"` Storybook string `json:"storybook,omitempty"` StorybookSrcDir string `json:"storybookSrcDir,omitempty"` }
type BuildConfig ¶
type BuildConfig struct { Variants []Variant `json:"variants,omitempty"` PluginSignature PluginSignature `json:"pluginSignature,omitempty"` Docker Docker `json:"docker,omitempty"` Buckets Buckets `json:"buckets,omitempty"` }
BuildConfig represents the struct that defines all of the different variables used to build Grafana
func GetBuildConfig ¶
func GetBuildConfig(mode VersionMode) (*BuildConfig, error)
GetBuildConfig reads the embedded config.json and decodes it.
type Distribution ¶
type Distribution string
Distribution is the base os image where the Grafana image is built on.
const ( Ubuntu Distribution = "ubuntu" Alpine Distribution = "alpine" )
type Docker ¶
type Docker struct { ShouldSave bool `json:"shouldSave,omitempty"` Distribution []Distribution `json:"distribution,omitempty"` Architectures []Architecture `json:"archs,omitempty"` PrereleaseBucket string `json:"prereleaseBucket,omitempty"` }
type Metadata ¶
type Metadata struct { GrafanaVersion string `json:"version,omitempty"` ReleaseMode ReleaseMode `json:"releaseMode,omitempty"` GrabplVersion string `json:"grabplVersion,omitempty"` CurrentCommit string `json:"currentCommit,omitempty"` }
func GenerateMetadata ¶
func (*Metadata) GetReleaseMode ¶
func (md *Metadata) GetReleaseMode() (ReleaseMode, error)
type PluginSignature ¶
type ReleaseMode ¶
type ReleaseMode struct { Mode VersionMode `json:"mode,omitempty"` IsPreview bool `json:"IsPreview,omitempty"` IsTest bool `json:"isTest,omitempty"` }
func CheckSemverSuffix ¶
func CheckSemverSuffix() (ReleaseMode, error)
type Variant ¶
type Variant string
Variant is the OS / Architecture combination that Grafana can be compiled for.
const ( VariantLinuxAmd64 Variant = "linux-amd64" VariantLinuxAmd64Musl Variant = "linux-amd64-musl" VariantArmV6 Variant = "linux-armv6" VariantArmV7 Variant = "linux-armv7" VariantArmV7Musl Variant = "linux-armv7-musl" VariantArm64 Variant = "linux-arm64" VariantArm64Musl Variant = "linux-arm64-musl" VariantDarwinAmd64 Variant = "darwin-amd64" VariantWindowsAmd64 Variant = "windows-amd64" )
type VersionMap ¶
type VersionMap map[VersionMode]BuildConfig
VersionMap is a map of versions. Each key of the Versions map is an event that uses the the config as the value for that key. For example, the 'pull_request' key will have data in it that might cause Grafana to be built differently in a pull request, than the way it will be built in 'main'
type VersionMode ¶
type VersionMode string
VersionMode defines the source event that created a release or published version
const ( MainMode VersionMode = "main" TagMode VersionMode = "release" ReleaseBranchMode VersionMode = "branch" PullRequestMode VersionMode = "pull_request" DownstreamMode VersionMode = "downstream" Enterprise2Mode VersionMode = "enterprise2" CronjobMode VersionMode = "cron" CloudMode VersionMode = "cloud" )
func CheckDroneTargetBranch ¶
func CheckDroneTargetBranch() (VersionMode, error)