Skip to content

Commit

Permalink
Decalarative refactor (#213)
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Caulada <guilherme.caulada@grafana.com>
  • Loading branch information
kminehart and guicaulada authored Oct 31, 2023
1 parent 729a7d7 commit 107a036
Show file tree
Hide file tree
Showing 195 changed files with 7,885 additions and 5,283 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jobs:
with:
go-version: "1.21.1"
cache: true
- uses: golangci/golangci-lint-action@v3
with:
version: v1.52
args: --timeout=30m --config=.golangci.toml
go-test:
runs-on: ubuntu-latest
permissions:
Expand Down
53 changes: 45 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
# grafana-build
![Grafana](docs/logo-horizontal.png)

**Warning:** This project is still highly experimental!
The open-source platform for monitoring and observability

GitHub actions and Go packages for building Grafana using [Dagger](https://dagger.io).
To get started, executed the following command in your terminal:
[![License](https://img.shields.io/github/license/grafana/grafana)](LICENSE)
[![Drone](https://drone.grafana.net/api/badges/grafana/grafana/status.svg)](https://drone.grafana.net/grafana/grafana)
[![Go Report Card](https://goreportcard.com/badge/github.com/grafana/grafana)](https://goreportcard.com/report/github.com/grafana/grafana)

```shell
dagger run go run ./cmd --help
```
Grafana allows you to query, visualize, alert on and understand your metrics no matter where they are stored. Create, explore, and share dashboards with your team and foster a data-driven culture:

You can find further information in the [docs 📖](https://github.com/grafana/grafana-build/tree/main/docs)!
- **Visualizations:** Fast and flexible client side graphs with a multitude of options. Panel plugins offer many different ways to visualize metrics and logs.
- **Dynamic Dashboards:** Create dynamic & reusable dashboards with template variables that appear as dropdowns at the top of the dashboard.
- **Explore Metrics:** Explore your data through ad-hoc queries and dynamic drilldown. Split view and compare different time ranges, queries and data sources side by side.
- **Explore Logs:** Experience the magic of switching from metrics to logs with preserved label filters. Quickly search through all your logs or streaming them live.
- **Alerting:** Visually define alert rules for your most important metrics. Grafana will continuously evaluate and send notifications to systems like Slack, PagerDuty, VictorOps, OpsGenie.
- **Mixed Data Sources:** Mix different data sources in the same graph! You can specify a data source on a per-query basis. This works for even custom datasources.

## Get started

- [Get Grafana](https://grafana.com/get)
- [Installation guides](https://grafana.com/docs/grafana/latest/setup-grafana/installation/)

Unsure if Grafana is for you? Watch Grafana in action on [play.grafana.org](https://play.grafana.org/)!

## Documentation

The Grafana documentation is available at [grafana.com/docs](https://grafana.com/docs/).

## Contributing

If you're interested in contributing to the Grafana project:

- Start by reading the [Contributing guide](https://github.com/grafana/grafana/blob/HEAD/CONTRIBUTING.md).
- Learn how to set up your local environment, in our [Developer guide](https://github.com/grafana/grafana/blob/HEAD/contribute/developer-guide.md).
- Explore our [beginner-friendly issues](https://github.com/grafana/grafana/issues?q=is%3Aopen+is%3Aissue+label%3A%22beginner+friendly%22).
- Look through our [style guide and Storybook](https://developers.grafana.com/ui/latest/index.html).

## Get involved

- Follow [@grafana on Twitter](https://twitter.com/grafana/).
- Read and subscribe to the [Grafana blog](https://grafana.com/blog/).
- If you have a specific question, check out our [discussion forums](https://community.grafana.com/).
- For general discussions, join us on the [official Slack](https://slack.grafana.com) team.

This project is tested with [BrowserStack](https://www.browserstack.com/)

## License

Grafana is distributed under [AGPL-3.0-only](LICENSE). For Apache-2.0 exceptions, see [LICENSING.md](https://github.com/grafana/grafana/blob/HEAD/LICENSING.md).
53 changes: 53 additions & 0 deletions arguments/docker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package arguments

import (
"github.com/grafana/grafana-build/docker"
"github.com/grafana/grafana-build/pipeline"
"github.com/urfave/cli/v2"
)

var (
DockerRegistryFlag = &cli.StringFlag{
Name: "registry",
Usage: "Prefix the image name with the registry provided",
Value: "docker.io",
}
DockerOrgFlag = &cli.StringFlag{
Name: "org",
Usage: "Overrides the organization of the images",
Value: "grafana",
}
AlpineImageFlag = &cli.StringFlag{
Name: "alpine-base",
Usage: "The alpine image to use as the base image when building the Alpine version of the Grafana docker image",
Value: "alpine:latest",
}
UbuntuImageFlag = &cli.StringFlag{
Name: "ubuntu-base",
Usage: "The Ubuntu image to use as the base image when building the Ubuntu version of the Grafana docker image",
Value: "ubuntu:latest",
}
TagFormatFlag = &cli.StringFlag{
Name: "tag-format",
Usage: "Provide a go template for formatting the docker tag(s) for images with an Alpine base",
Value: docker.DefaultTagFormat,
}
UbuntuTagFormatFlag = &cli.StringFlag{
Name: "ubuntu-tag-format",
Usage: "Provide a go template for formatting the docker tag(s) for images with a ubuntu base",
Value: docker.DefaultUbuntuTagFormat,
}
BoringTagFormatFlag = &cli.StringFlag{
Name: "boring-tag-format",
Usage: "Provide a go template for formatting the docker tag(s) for the boringcrypto build of Grafana Enterprise",
Value: docker.DefaultBoringTagFormat,
}

DockerRegistry = pipeline.NewStringFlagArgument(DockerRegistryFlag)
DockerOrg = pipeline.NewStringFlagArgument(DockerOrgFlag)
AlpineImage = pipeline.NewStringFlagArgument(AlpineImageFlag)
UbuntuImage = pipeline.NewStringFlagArgument(UbuntuImageFlag)
TagFormat = pipeline.NewStringFlagArgument(TagFormatFlag)
UbuntuTagFormat = pipeline.NewStringFlagArgument(UbuntuTagFormatFlag)
BoringTagFormat = pipeline.NewStringFlagArgument(BoringTagFormatFlag)
)
4 changes: 4 additions & 0 deletions arguments/docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Package arguments holds globally-defined arguments that are used throughout the program for shared data.
// A good candidate for an argument is a directory whose contents that may be used in the creation of multiple artifacts, like the Grafana source directory.
// Arguments are different than flags; a flag is a boolean argument in an artifact string which can set one or multiple preset values.
package arguments
1 change: 1 addition & 0 deletions arguments/flag_value_func.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package arguments
27 changes: 27 additions & 0 deletions arguments/golang.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package arguments

import (
"github.com/grafana/grafana-build/pipeline"
"github.com/urfave/cli/v2"
)

const (
DefaultGoVersion = "1.21.3"
DefaultViceroyVersion = "v0.4.0"
)

var GoVersionFlag = &cli.StringFlag{
Name: "go-version",
Usage: "The Go version to use when compiling Grafana",
Value: DefaultGoVersion,
}

var GoVersion = pipeline.NewStringFlagArgument(GoVersionFlag)

var ViceroyVersionFlag = &cli.StringFlag{
Name: "viceroy-version",
Usage: "This flag sets the base image of the container used to build the Grafana backend binaries for non-Linux distributions",
Value: DefaultViceroyVersion,
}

var ViceroyVersion = pipeline.NewStringFlagArgument(ViceroyVersionFlag)
28 changes: 28 additions & 0 deletions arguments/gpg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package arguments

import (
"github.com/grafana/grafana-build/pipeline"
"github.com/urfave/cli/v2"
)

var (
GPGPublicKeyFlag = &cli.StringFlag{
Name: "gpg-public-key-base64",
Usage: "Provides a public key encoded in base64 for GPG signing",
EnvVars: []string{"GPG_PUBLIC_KEY"},
}
GPGPrivateKeyFlag = &cli.StringFlag{
Name: "gpg-private-key-base64",
Usage: "Provides a private key encoded in base64 for GPG signing",
EnvVars: []string{"GPG_PRIVATE_KEY"},
}
GPGPassphraseFlag = &cli.StringFlag{
Name: "gpg-passphrase",
Usage: "Provides a private key passphrase encoded in base64 for GPG signing",
EnvVars: []string{"GPG_PASSPHRASE"},
}

GPGPublicKey = pipeline.NewStringFlagArgument(GPGPublicKeyFlag)
GPGPrivateKey = pipeline.NewStringFlagArgument(GPGPrivateKeyFlag)
GPGPassphrase = pipeline.NewStringFlagArgument(GPGPassphraseFlag)
)
Loading

0 comments on commit 107a036

Please sign in to comment.