Chore: Upgrade Go to 1.21.5 (#79329)

* bumping grafanas go version to 1.21.5

* adding how to upgrade go doc

* removing the whole ci-build and corresponding pipelines

* clarifying that we have to run make drone

* fixing starlark linter and removing unused code

* Adding note about enterprise

* trying to change the underyling image to avoid musl issues

* only need to golang one
pull/79508/head^2
Timur Olzhabayev 2 years ago committed by GitHub
parent 79fca7dce4
commit 4991e71b85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .drone.star
  2. 255
      .drone.yml
  3. 2
      .github/workflows/alerting-swagger-gen.yml
  4. 2
      .github/workflows/codeql-analysis.yml
  5. 2
      .github/workflows/pr-codeql-analysis-go.yml
  6. 2
      .github/workflows/publish-kinds-next.yml
  7. 2
      .github/workflows/publish-kinds-release.yml
  8. 2
      .github/workflows/verify-kinds.yml
  9. 2
      Dockerfile
  10. 2
      Makefile
  11. 22
      contribute/backend/upgrading-go-version.md
  12. 1
      scripts/build/ci-build/.gitignore
  13. 193
      scripts/build/ci-build/Dockerfile
  14. 18
      scripts/build/ci-build/README.md
  15. 5
      scripts/build/ci-build/bootstrap.sh
  16. 52
      scripts/drone/pipelines/ci_images.star
  17. 3
      scripts/drone/utils/images.star
  18. 2
      scripts/drone/variables.star

@ -19,7 +19,6 @@ load(
)
load(
"scripts/drone/pipelines/ci_images.star",
"publish_ci_build_container_image_pipeline",
"publish_ci_windows_test_image_pipeline",
)
load(
@ -51,7 +50,6 @@ def main(_ctx):
}, "oss", "testing")] +
integration_test_pipelines() +
publish_ci_windows_test_image_pipeline() +
publish_ci_build_container_image_pipeline() +
cronjobs() +
secrets()
)

@ -24,7 +24,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- ./bin/build verify-drone
@ -74,14 +74,14 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- go install github.com/bazelbuild/buildtools/buildifier@latest
- buildifier --lint=warn -mode=check -r .
depends_on:
- compile-build-cmd
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: lint-starlark
trigger:
event:
@ -316,7 +316,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -325,21 +325,21 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: test-backend
- commands:
- apk add --update build-base
@ -348,7 +348,7 @@ steps:
| grep -o '\(.*\)/' | sort -u)
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: test-backend-integration
trigger:
event:
@ -398,7 +398,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- apk add --update curl jq bash
@ -425,7 +425,7 @@ steps:
- apk add --update make
- make gen-go
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- apk add --update make build-base
@ -434,16 +434,16 @@ steps:
- wire-install
environment:
CGO_ENABLED: "1"
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: lint-backend
- commands:
- go run scripts/modowners/modowners.go check go.mod
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: validate-modfile
- commands:
- apk add --update make
- make swagger-validate
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: validate-openapi-spec
trigger:
event:
@ -499,7 +499,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- '# It is required that code generated from Thema/CUE be committed and in sync
@ -509,7 +509,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -518,14 +518,14 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- yarn install --immutable
@ -558,7 +558,7 @@ steps:
from_secret: drone_token
- commands:
- /src/grafana-build artifacts -a targz:grafana:linux/amd64 -a targz:grafana:linux/arm64
--go-version=1.21.3 --yarn-cache=$$YARN_CACHE_FOLDER --build-id=$$DRONE_BUILD_NUMBER
--go-version=1.21.5 --yarn-cache=$$YARN_CACHE_FOLDER --build-id=$$DRONE_BUILD_NUMBER
--grafana-dir=$$PWD > packages.txt
depends_on:
- yarn-install
@ -843,7 +843,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- echo $DRONE_RUNNER_NAME
@ -857,7 +857,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -866,14 +866,14 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- dockerize -wait tcp://postgres:5432 -timeout 120s
@ -894,7 +894,7 @@ steps:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: postgres
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: postgres-integration-tests
- commands:
- dockerize -wait tcp://mysql57:3306 -timeout 120s
@ -915,7 +915,7 @@ steps:
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql57
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: mysql-5.7-integration-tests
- commands:
- dockerize -wait tcp://mysql80:3306 -timeout 120s
@ -936,7 +936,7 @@ steps:
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql80
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: mysql-8.0-integration-tests
- commands:
- dockerize -wait tcp://redis:6379 -timeout 120s
@ -951,7 +951,7 @@ steps:
- wait-for-redis
environment:
REDIS_URL: redis://redis:6379/0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: redis-integration-tests
- commands:
- dockerize -wait tcp://memcached:11211 -timeout 120s
@ -966,7 +966,7 @@ steps:
- wait-for-memcached
environment:
MEMCACHED_HOSTS: memcached:11211
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: memcached-integration-tests
- commands:
- dockerize -wait tcp://mimir_backend:8080 -timeout 120s
@ -982,7 +982,7 @@ steps:
environment:
AM_TENANT_ID: test
AM_URL: http://mimir_backend:8080
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: remote-alertmanager-integration-tests
trigger:
event:
@ -1069,7 +1069,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
trigger:
event:
@ -1109,7 +1109,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- apt-get update -yq && apt-get install shellcheck
@ -1176,7 +1176,7 @@ steps:
environment:
GITHUB_TOKEN:
from_secret: github_token
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: swagger-gen
trigger:
event:
@ -1277,7 +1277,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- '# It is required that code generated from Thema/CUE be committed and in sync
@ -1288,7 +1288,7 @@ steps:
- CODEGEN_VERIFY=1 make gen-cue
depends_on:
- clone-enterprise
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -1298,14 +1298,14 @@ steps:
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on:
- clone-enterprise
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- apk add --update build-base
@ -1313,7 +1313,7 @@ steps:
- go test -v -run=^$ -benchmem -timeout=1h -count=8 -bench=. ${GO_PACKAGES}
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: sqlite-benchmark-integration-tests
- commands:
- apk add --update build-base
@ -1325,7 +1325,7 @@ steps:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: postgres
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: postgres-benchmark-integration-tests
- commands:
- apk add --update build-base
@ -1336,7 +1336,7 @@ steps:
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql57
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: mysql-5.7-benchmark-integration-tests
- commands:
- apk add --update build-base
@ -1347,7 +1347,7 @@ steps:
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql80
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: mysql-8.0-benchmark-integration-tests
trigger:
event:
@ -1424,7 +1424,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
trigger:
branch: main
@ -1596,7 +1596,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -1605,21 +1605,21 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: test-backend
- commands:
- apk add --update build-base
@ -1628,7 +1628,7 @@ steps:
| grep -o '\(.*\)/' | sort -u)
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: test-backend-integration
trigger:
branch: main
@ -1672,13 +1672,13 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- apk add --update make
- make gen-go
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- apk add --update make build-base
@ -1687,16 +1687,16 @@ steps:
- wire-install
environment:
CGO_ENABLED: "1"
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: lint-backend
- commands:
- go run scripts/modowners/modowners.go check go.mod
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: validate-modfile
- commands:
- apk add --update make
- make swagger-validate
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: validate-openapi-spec
- commands:
- ./bin/build verify-drone
@ -1752,7 +1752,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- '# It is required that code generated from Thema/CUE be committed and in sync
@ -1762,7 +1762,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -1771,14 +1771,14 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- yarn install --immutable
@ -1810,7 +1810,7 @@ steps:
name: build-frontend-packages
- commands:
- /src/grafana-build artifacts -a targz:grafana:linux/amd64 -a targz:grafana:linux/arm64
--go-version=1.21.3 --yarn-cache=$$YARN_CACHE_FOLDER --build-id=$$DRONE_BUILD_NUMBER
--go-version=1.21.5 --yarn-cache=$$YARN_CACHE_FOLDER --build-id=$$DRONE_BUILD_NUMBER
--grafana-dir=$$PWD > packages.txt
depends_on:
- update-package-json-version
@ -2193,7 +2193,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- echo $DRONE_RUNNER_NAME
@ -2207,7 +2207,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -2216,14 +2216,14 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- dockerize -wait tcp://postgres:5432 -timeout 120s
@ -2244,7 +2244,7 @@ steps:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: postgres
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: postgres-integration-tests
- commands:
- dockerize -wait tcp://mysql57:3306 -timeout 120s
@ -2265,7 +2265,7 @@ steps:
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql57
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: mysql-5.7-integration-tests
- commands:
- dockerize -wait tcp://mysql80:3306 -timeout 120s
@ -2286,7 +2286,7 @@ steps:
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql80
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: mysql-8.0-integration-tests
- commands:
- dockerize -wait tcp://redis:6379 -timeout 120s
@ -2301,7 +2301,7 @@ steps:
- wait-for-redis
environment:
REDIS_URL: redis://redis:6379/0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: redis-integration-tests
- commands:
- dockerize -wait tcp://memcached:11211 -timeout 120s
@ -2316,7 +2316,7 @@ steps:
- wait-for-memcached
environment:
MEMCACHED_HOSTS: memcached:11211
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: memcached-integration-tests
- commands:
- dockerize -wait tcp://mimir_backend:8080 -timeout 120s
@ -2332,7 +2332,7 @@ steps:
environment:
AM_TENANT_ID: test
AM_URL: http://mimir_backend:8080
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: remote-alertmanager-integration-tests
trigger:
branch: main
@ -2522,7 +2522,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- ./bin/build artifacts docker fetch --edition oss
@ -2618,7 +2618,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- ./bin/build artifacts packages --tag $${DRONE_TAG} --src-bucket $${PRERELEASE_BUCKET}
@ -2687,7 +2687,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- yarn install --immutable
@ -2752,7 +2752,7 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- depends_on:
- compile-build-cmd
@ -2858,7 +2858,7 @@ steps:
from_secret: gcp_key_base64
GITHUB_TOKEN:
from_secret: github_token
GO_VERSION: 1.21.3
GO_VERSION: 1.21.5
GPG_PASSPHRASE:
from_secret: packages_gpg_passphrase
GPG_PRIVATE_KEY:
@ -2915,13 +2915,13 @@ steps:
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: compile-build-cmd
- commands:
- ./bin/build whatsnew-checker
depends_on:
- compile-build-cmd
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: whats-new-checker
trigger:
event:
@ -3021,7 +3021,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -3030,21 +3030,21 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: test-backend
- commands:
- apk add --update build-base
@ -3053,7 +3053,7 @@ steps:
| grep -o '\(.*\)/' | sort -u)
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: test-backend-integration
trigger:
event:
@ -3109,7 +3109,7 @@ steps:
from_secret: gcp_key_base64
GITHUB_TOKEN:
from_secret: github_token
GO_VERSION: 1.21.3
GO_VERSION: 1.21.5
GPG_PASSPHRASE:
from_secret: packages_gpg_passphrase
GPG_PRIVATE_KEY:
@ -3289,7 +3289,7 @@ steps:
from_secret: gcp_key_base64
GITHUB_TOKEN:
from_secret: github_token
GO_VERSION: 1.21.3
GO_VERSION: 1.21.5
GPG_PASSPHRASE:
from_secret: packages_gpg_passphrase
GPG_PRIVATE_KEY:
@ -3435,7 +3435,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -3444,21 +3444,21 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: test-backend
- commands:
- apk add --update build-base
@ -3467,7 +3467,7 @@ steps:
| grep -o '\(.*\)/' | sort -u)
depends_on:
- wire-install
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: test-backend-integration
trigger:
cron:
@ -3521,7 +3521,7 @@ steps:
from_secret: gcp_key_base64
GITHUB_TOKEN:
from_secret: github_token
GO_VERSION: 1.21.3
GO_VERSION: 1.21.5
GPG_PASSPHRASE:
from_secret: packages_gpg_passphrase
GPG_PRIVATE_KEY:
@ -3667,7 +3667,7 @@ steps:
from_secret: gcp_key_base64
GITHUB_TOKEN:
from_secret: github_token
GO_VERSION: 1.21.3
GO_VERSION: 1.21.5
GPG_PASSPHRASE:
from_secret: packages_gpg_passphrase
GPG_PRIVATE_KEY:
@ -3764,20 +3764,20 @@ steps:
- commands: []
depends_on:
- clone
image: golang:1.21.3-windowsservercore-1809
image: golang:1.21.5-windowsservercore-1809
name: windows-init
- commands:
- go install github.com/google/wire/cmd/wire@v0.5.0
- wire gen -tags oss ./pkg/server
depends_on:
- windows-init
image: golang:1.21.3-windowsservercore-1809
image: golang:1.21.5-windowsservercore-1809
name: wire-install
- commands:
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
image: golang:1.21.3-windowsservercore-1809
image: golang:1.21.5-windowsservercore-1809
name: test-backend
trigger:
event:
@ -3869,7 +3869,7 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-cue
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-cue
- commands:
- '# It is required that generated jsonnet is committed and in sync with its inputs.'
@ -3878,14 +3878,14 @@ steps:
- apk add --update make
- CODEGEN_VERIFY=1 make gen-jsonnet
depends_on: []
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: verify-gen-jsonnet
- commands:
- apk add --update make
- make gen-go
depends_on:
- verify-gen-cue
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: wire-install
- commands:
- dockerize -wait tcp://postgres:5432 -timeout 120s
@ -3906,7 +3906,7 @@ steps:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: postgres
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: postgres-integration-tests
- commands:
- dockerize -wait tcp://mysql57:3306 -timeout 120s
@ -3927,7 +3927,7 @@ steps:
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql57
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: mysql-5.7-integration-tests
- commands:
- dockerize -wait tcp://mysql80:3306 -timeout 120s
@ -3948,7 +3948,7 @@ steps:
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql80
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: mysql-8.0-integration-tests
- commands:
- dockerize -wait tcp://redis:6379 -timeout 120s
@ -3963,7 +3963,7 @@ steps:
- wait-for-redis
environment:
REDIS_URL: redis://redis:6379/0
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: redis-integration-tests
- commands:
- dockerize -wait tcp://memcached:11211 -timeout 120s
@ -3978,7 +3978,7 @@ steps:
- wait-for-memcached
environment:
MEMCACHED_HOSTS: memcached:11211
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: memcached-integration-tests
- commands:
- dockerize -wait tcp://mimir_backend:8080 -timeout 120s
@ -3994,7 +3994,7 @@ steps:
environment:
AM_TENANT_ID: test
AM_URL: http://mimir_backend:8080
image: golang:1.21.3-alpine
image: golang:1.21.5-alpine3.18
name: remote-alertmanager-integration-tests
trigger:
event:
@ -4063,59 +4063,6 @@ volumes:
path: //./pipe/docker_engine/
name: docker
---
clone:
retries: 3
depends_on: []
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: publish-ci-build-container-image
node:
type: no-parallel
platform:
arch: amd64
os: linux
services: []
steps:
- commands:
- if [ -z "${BUILD_CONTAINER_VERSION}" ]; then echo Missing BUILD_CONTAINER_VERSION;
false; fi
image: alpine:3.18.4
name: validate-version
- commands:
- printenv GCP_KEY > /tmp/key.json
- gcloud auth activate-service-account --key-file=/tmp/key.json
- gsutil cp gs://grafana-private-downloads/MacOSX10.15.sdk.tar.xz ./scripts/build/ci-build/MacOSX10.15.sdk.tar.xz
environment:
GCP_KEY:
from_secret: gcp_download_build_container_assets_key
image: google/cloud-sdk:431.0.0
name: download-macos-sdk
- commands:
- printenv DOCKER_PASSWORD | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker build -t "grafana/build-container:${BUILD_CONTAINER_VERSION}" ./scripts/build/ci-build
- docker push "grafana/build-container:${BUILD_CONTAINER_VERSION}"
environment:
DOCKER_PASSWORD:
from_secret: docker_password
DOCKER_USERNAME:
from_secret: docker_username
image: google/cloud-sdk:431.0.0
name: build-and-publish
volumes:
- name: docker
path: /var/run/docker.sock
trigger:
event:
- promote
target:
- ci-build-container-image
type: docker
volumes:
- host:
path: /var/run/docker.sock
name: docker
---
clone:
retries: 3
kind: pipeline
@ -4400,7 +4347,7 @@ steps:
path: /root/.docker/
- commands:
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM alpine/git:2.40.1
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM golang:1.21.3-alpine
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM golang:1.21.5-alpine3.18
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM node:20.9.0-alpine
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM google/cloud-sdk:431.0.0
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM grafana/grafana-ci-deploy:1.3.3
@ -4434,7 +4381,7 @@ steps:
path: /root/.docker/
- commands:
- trivy --exit-code 1 --severity HIGH,CRITICAL alpine/git:2.40.1
- trivy --exit-code 1 --severity HIGH,CRITICAL golang:1.21.3-alpine
- trivy --exit-code 1 --severity HIGH,CRITICAL golang:1.21.5-alpine3.18
- trivy --exit-code 1 --severity HIGH,CRITICAL node:20.9.0-alpine
- trivy --exit-code 1 --severity HIGH,CRITICAL google/cloud-sdk:431.0.0
- trivy --exit-code 1 --severity HIGH,CRITICAL grafana/grafana-ci-deploy:1.3.3
@ -4682,6 +4629,6 @@ kind: secret
name: gcr_credentials
---
kind: signature
hmac: 0e9f67184e414d3afbda81c86dfa58b3c2cf7c1a668be5313c851ff5f42de44d
hmac: 04015469da0c5f55005a1b953231fbe9f2841a8d5c4e36b1e6833f255edc82bc
...

@ -16,7 +16,7 @@ jobs:
- name: Set go version
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.5'
- name: Build swagger
run: |
make -C pkg/services/ngalert/api/tooling post.json api.json

@ -47,7 +47,7 @@ jobs:
name: Set go version
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.5'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

@ -26,7 +26,7 @@ jobs:
- name: Set go version
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.5'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

@ -36,7 +36,7 @@ jobs:
- name: "Setup Go"
uses: "actions/setup-go@v4"
with:
go-version: '1.21.3'
go-version: '1.21.5'
- name: "Verify kinds"
run: go run .github/workflows/scripts/kinds/verify-kinds.go

@ -39,7 +39,7 @@ jobs:
- name: "Setup Go"
uses: "actions/setup-go@v4"
with:
go-version: '1.21.3'
go-version: '1.21.5'
- name: "Verify kinds"
run: go run .github/workflows/scripts/kinds/verify-kinds.go

@ -18,7 +18,7 @@ jobs:
- name: "Setup Go"
uses: "actions/setup-go@v4"
with:
go-version: '1.21.3'
go-version: '1.21.5'
- name: "Verify kinds"
run: go run .github/workflows/scripts/kinds/verify-kinds.go

@ -3,7 +3,7 @@
ARG BASE_IMAGE=alpine:3.18.3
ARG JS_IMAGE=node:20-alpine3.18
ARG JS_PLATFORM=linux/amd64
ARG GO_IMAGE=golang:1.21.3-alpine3.18
ARG GO_IMAGE=golang:1.21.5-alpine3.18
ARG GO_SRC=go-builder
ARG JS_SRC=js-builder

@ -261,7 +261,7 @@ build-docker-full-ubuntu: ## Build Docker image based on Ubuntu for development.
--build-arg COMMIT_SHA=$$(git rev-parse HEAD) \
--build-arg BUILD_BRANCH=$$(git rev-parse --abbrev-ref HEAD) \
--build-arg BASE_IMAGE=ubuntu:22.04 \
--build-arg GO_IMAGE=golang:1.21.3 \
--build-arg GO_IMAGE=golang:1.21.5 \
--tag grafana/grafana$(TAG_SUFFIX):dev-ubuntu \
$(DOCKER_BUILD_ARGS)

@ -0,0 +1,22 @@
# Upgrading Go Version
Notes on upgrading Go version.
Example PR: https://github.com/grafana/grafana/pull/79329
## The main areas that need to change during the upgrade are:
- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/scripts/drone/variables.star#L6
- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/Makefile#L264
- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/Dockerfile#L6
Make sure to run `make drone` so that changes to `.star` files are reflected and `drone.yml` is generated.
### Additional files to change
- Take a look in `.github/workflows` folder for what `go` version is being used there in various workflows.
- Make sure to create a PR with the corresponding changes in `grafana/grafana-enterprise` repository.
## Updating the go.mod file
Please avoid updating the `go.mod` to the newest version unless really necessary. This ensures backwards compatibility and introduces less breaking changes. Always upgrade Go version in the runtime files above first, let them run for a couple of weeks and only then consider updating the `go.mod` file if necessary.

@ -1 +0,0 @@
MacOSX*.tar.xz

@ -1,193 +0,0 @@
# Use old Debian (LTS into 2024) in order to ensure binary compatibility with older glibc's.
FROM debian:buster-20220822 AS toolchain
ENV OSX_MIN=10.10 \
CTNG=1.24.0 \
CTNG_CHKSUM=89b8794a4184ad4928750e29712ed4f194aa1d0b93768d67ff64f30c30f1b1e165647cafc6de94d68d3ef70e50446e544dad65aa36137511a32ee7a667dddfb4 \
# This is the last revision that builds on Debian Stretch
OSX_CROSS_REV=a1d7d7a8d569f9f0b8c3140b8b32848dbcd62afa
# Use ARG so as not to persist environment variable in image
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /tmp
# FIRST PART
# build osx64 toolchain (stripped of man documentation)
# the toolchain produced is not self contained, it needs clang at runtime
#
# SECOND PART
# build gcc (no g++) centos6-x64 toolchain
# doc: https://crosstool-ng.github.io/docs/
# apt-get should be all dep to build toolchain
# sed and 1st echo are for convenience to get the toolchain in /tmp/x86_64-centos6-linux-gnu
# other echo are to enable build by root (crosstool-NG refuse to do that by default)
# the last 2 rm are just to save some time and space writing docker layers
#
# THIRD PART
# build fpm and creates a set of deb from gem
# ruby2.0 depends on ruby1.9.3 which is install as default ruby
# rm/ln are here to change that
# created deb depends on rubygem-json but json gem is not build
# so do by hand
# might wanna make sure osx cross and the other tarball as well as the packages ends up somewhere other than tmp
# might also wanna put them as their own layer to not have to unpack them every time?
RUN apt-get update && \
apt-get install -yq \
clang patch libxml2-dev \
build-essential \
ca-certificates \
curl \
git \
make \
cmake \
libssl-dev \
xz-utils \
lzma-dev
RUN git clone https://github.com/tpoechtrager/osxcross.git /tmp/osxcross && \
cd /tmp/osxcross && git reset --hard $OSX_CROSS_REV
COPY MacOSX10.15.sdk.tar.xz /tmp/osxcross/tarballs/
RUN ln -s /usr/bin/llvm-dsymutil-6.0 /usr/bin/dsymutil
RUN UNATTENDED=1 OSX_VERSION_MIN=${OSX_MIN} /tmp/osxcross/build.sh
RUN rm -rf /tmp/osxcross/target/SDK/*/usr/share && \
cd /tmp && \
tar cfJ osxcross.tar.xz osxcross/target && \
rm -rf /tmp/osxcross
RUN apt-get install -yq \
unzip libtool-bin bison flex gawk gcc g++ gperf help2man libncurses5-dev make patch python-dev texinfo xz-utils
RUN curl -fLO http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-${CTNG}.tar.xz
RUN echo $CTNG_CHKSUM crosstool-ng-${CTNG}.tar.xz | sha512sum --check --strict --status
RUN tar xf crosstool-ng-${CTNG}.tar.xz
RUN cd /tmp/crosstool-ng-${CTNG} && \
./configure --enable-local && \
make && \
./ct-ng x86_64-centos6-linux-gnu && \
sed -i '/CT_PREFIX_DIR=/d' .config && \
echo 'CT_PREFIX_DIR="/tmp/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"' >> .config && \
echo 'CT_EXPERIMENTAL=y' >> .config && \
echo 'CT_ALLOW_BUILD_AS_ROOT=y' >> .config && \
echo 'CT_ALLOW_BUILD_AS_ROOT_SURE=y' >> .config && \
mkdir -p .build/tarballs && \
cd .build/tarballs && \
curl -fLO https://libisl.sourceforge.io/isl-0.20.tar.gz && \
curl -fLO https://github.com/libexpat/libexpat/releases/download/R_2_1_0/expat-2.1.0.tar.gz && \
cd - && \
./ct-ng build
RUN cd /tmp && \
rm /tmp/x86_64-centos6-linux-gnu/build.log.bz2 && \
tar cfJ x86_64-centos6-linux-gnu.tar.xz x86_64-centos6-linux-gnu/ && \
rm -rf /tmp/x86_64-centos6-linux-gnu/ && \
rm -rf /tmp/crosstool-ng-${CTNG}
ARG SHELLCHECK_VERSION=0.7.1
ARG SHELLCHECK_CHKSUM=beca3d7819a6bdcfbd044576df4fc284053b48f468b2f03428fe66f4ceb2c05d9b5411357fa15003cb0311406c255084cf7283a3b8fce644c340c2f6aa910b9f
RUN curl -fLO http://storage.googleapis.com/grafana-downloads/ci-dependencies/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz
RUN echo $SHELLCHECK_CHKSUM shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz | sha512sum --check --strict --status
RUN tar xf shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz && mv shellcheck-v${SHELLCHECK_VERSION}/shellcheck /tmp/
ARG BUILDIFIER_VERSION=5.1.0
ARG BUILDIFIER_CHKSUM=52bf6b102cb4f88464e197caac06d69793fa2b05f5ad50a7e7bf6fbd656648a3
RUN curl -fLO https://github.com/bazelbuild/buildtools/releases/download/${BUILDIFIER_VERSION}/buildifier-linux-amd64
RUN echo $BUILDIFIER_CHKSUM buildifier-linux-amd64 | sha256sum --check --strict --status
RUN mv buildifier-linux-amd64 /tmp/buildifier && chmod +x /tmp/buildifier
ARG CUE_VERSION=0.3.0-alpha5
ARG CUE_CHKSUM=9d3131e470cdb5182afd9966688f1c052d383145cce005a947156b5591da39b7
RUN curl -fLO https://github.com/cuelang/cue/releases/download/v${CUE_VERSION}/cue_${CUE_VERSION}_Linux_x86_64.tar.gz
RUN echo $CUE_CHKSUM cue_${CUE_VERSION}_Linux_x86_64.tar.gz | sha256sum --check --strict --status
RUN tar xf cue_${CUE_VERSION}_Linux_x86_64.tar.gz -C /tmp cue
ARG DOCKERIZE_VERSION=0.6.1
RUN curl -fLO https://github.com/jwilder/dockerize/releases/download/v${DOCKERIZE_VERSION}/dockerize-linux-amd64-v${DOCKERIZE_VERSION}.tar.gz
RUN tar -xzvf dockerize-linux-amd64-v${DOCKERIZE_VERSION}.tar.gz -C /tmp/
RUN rm dockerize-linux-amd64-v${DOCKERIZE_VERSION}.tar.gz
# Base image to crossbuild grafana.
# Use old Debian (LTS into 2024) in order to ensure binary compatibility with older glibc's.
FROM debian:buster-20220822
ENV GOVERSION=1.21.3 \
PATH=/usr/local/go/bin:$PATH \
GOPATH=/go \
NODEVERSION=20.9.0-1nodesource1 \
YARNVERSION=1.22.19-1
# Use ARG so as not to persist environment variable in image
ARG DEBIAN_FRONTEND=noninteractive
COPY --from=toolchain /tmp/x86_64-centos6-linux-gnu.tar.xz /tmp/osxcross.tar.xz /tmp/
COPY --from=toolchain /tmp/shellcheck /usr/local/bin/
COPY --from=toolchain /tmp/buildifier /usr/local/bin/
COPY --from=toolchain /tmp/cue /usr/local/bin/
COPY --from=toolchain /tmp/dockerize /usr/local/bin/
RUN apt-get update && \
apt-get install -yq \
apt-transport-https \
build-essential netcat-traditional clang gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-mingw-w64-x86-64 \
python-pip \
ca-certificates \
curl \
gcc \
g++ \
git \
jq \
make \
rpm \
xz-utils \
expect \
gnupg2 \
procps \
ruby \
ruby-dev \
rubygems \
unzip && \
gem install -N public_suffix -v 4.0.7 && \
gem install --conservative -N fpm && \
ln -s /usr/bin/llvm-dsymutil-6.0 /usr/bin/dsymutil && \
curl -fsS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
curl -O https://deb.nodesource.com/node_20.x/pool/main/n/nodejs/nodejs_${NODEVERSION}_amd64.deb &&\
dpkg -i nodejs_${NODEVERSION}_amd64.deb &&\
rm nodejs_${NODEVERSION}_amd64.deb &&\
curl -fsS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -yq yarn=${YARNVERSION} && \
curl -fL https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz \
| tar -xz -C /usr/local && \
git clone https://github.com/raspberrypi/tools.git /opt/rpi-tools --depth=1 && \
pip install codespell
# We build our own musl cross-compilers via the musl-cross-make project, on the same OS as this image's base image,
# to ensure compatibility. We also make sure to target musl 1.1.x, since musl 1.2.x introduces 64-bit time types
# that breaks compatibility on some 32-bit architectures (https://github.com/grafana/grafana/issues/23500).
#
# Use ARG so as not to persist environment variable in image
ARG CHKSUM_ARMV7_MUSL=5db487fb0a4aa61667de45a9cfbf7940360bd7256583b8a1e7810b4d9dd0e02a8aac737ca634b57bf269195e776ef503832ed22a6689a1c8fcdcc956f846bef7
ARG CHKSUM_ARMV8_MUSL=50f4899cc2f637dbc39470bbe307074ccf7f40da2ab730218d13a9f75d578266311db6a0785919dcdcb5e7ce4517b13ee8d4a56d76e6fca7c6d4c2510d71aa8b
ARG CHKSUM_AMD64_MUSL=493a79e9e29a1eab3fdff6435bac6509253d2e54ac30ad9098ce5da638bbb8ad18a7ebf3520bcaf2f9588befeff23402d8bbf54fa3809bfe18c984a4ecabcb12
# Install musl cross compilers
RUN cd /tmp && \
curl -fLO https://grafana-downloads.storage.googleapis.com/compilers/arm-linux-musleabihf-cross.tgz && \
([ "$(sha512sum arm-linux-musleabihf-cross.tgz|cut -f1 -d ' ')" = "$CHKSUM_ARMV7_MUSL" ] || (echo "Mismatching checksums armv7"; exit 1)) && \
tar xf arm-linux-musleabihf-cross.tgz && \
rm arm-linux-musleabihf-cross.tgz && \
curl -fLO https://grafana-downloads.storage.googleapis.com/compilers/aarch64-linux-musl-cross.tgz && \
([ "$(sha512sum aarch64-linux-musl-cross.tgz|cut -f1 -d ' ')" = "$CHKSUM_ARMV8_MUSL" ] || (echo "Mismatching checksums armv8"; exit 1)) && \
tar xf aarch64-linux-musl-cross.tgz && \
rm aarch64-linux-musl-cross.tgz && \
curl -fLO https://grafana-downloads.storage.googleapis.com/compilers/x86_64-linux-musl-cross.tgz && \
([ "$(sha512sum x86_64-linux-musl-cross.tgz|cut -f1 -d ' ')" = "$CHKSUM_AMD64_MUSL" ] || (echo "Mismatching checksums amd64"; exit 1)) && \
tar xf x86_64-linux-musl-cross.tgz && \
rm x86_64-linux-musl-cross.tgz
RUN go install github.com/mgechev/revive@v1.0.2 && \
mv ${GOPATH}/bin/revive /usr/local/bin/ && \
go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest && \
mv ${GOPATH}/bin/jsonnetfmt /usr/local/bin/ && \
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest && \
mv ${GOPATH}/bin/mixtool /usr/local/bin/
COPY ./bootstrap.sh /tmp/bootstrap.sh

@ -1,18 +0,0 @@
# grafana-build-container
These are the sources for the Docker image that we use for the Grafana build containers. The image source itself
is in Dockerfile, but there are supporting scripts such as the Makefile, for building images.
The image is based on Debian Buster, since we want an older Linux distribution (Buster has long-term support into 2024) to build binaries that are as portable as possible.
## Build/Publish Docker Image
In order to build and publish the Grafana build Docker image, execute the following:
```
# Download MacOSX10.15.sdk.tar.xz from our private GCS bucket into this directory
docker build -t grafana/build-container:<VERSION> --ulimit nofile=2048:2048 .
docker push grafana/build-container:<VERSION>
```
If you're running on a machine that has an ARM chip (Apple M1/M2, etc.), add `--platform linux/amd64` to the `docker build` command. It can take approximately four hours for an initial build to complete. Due to caching, subsequent builds take less time (~10 mins or so).

@ -1,5 +0,0 @@
#!/bin/bash
cd /tmp || exit 1
tar xfJ x86_64-centos6-linux-gnu.tar.xz
tar xfJ osxcross.tar.xz

@ -2,10 +2,6 @@
This module contains steps and pipelines relating to creating CI Docker images.
"""
load(
"scripts/drone/utils/images.star",
"images",
)
load(
"scripts/drone/utils/utils.star",
"pipeline",
@ -17,7 +13,6 @@ load(
load(
"scripts/drone/vault.star",
"from_secret",
"gcp_download_build_container_assets_key",
)
def publish_ci_windows_test_image_pipeline():
@ -69,50 +64,3 @@ def publish_ci_windows_test_image_pipeline():
}
return [pl]
def publish_ci_build_container_image_pipeline():
trigger = {
"event": ["promote"],
"target": ["ci-build-container-image"],
}
pl = pipeline(
name = "publish-ci-build-container-image",
trigger = trigger,
steps = [
{
"name": "validate-version",
"image": images["alpine"],
"commands": [
"if [ -z \"${BUILD_CONTAINER_VERSION}\" ]; then echo Missing BUILD_CONTAINER_VERSION; false; fi",
],
},
{
"name": "download-macos-sdk",
"image": images["cloudsdk"],
"environment": {
"GCP_KEY": from_secret(gcp_download_build_container_assets_key),
},
"commands": [
"printenv GCP_KEY > /tmp/key.json",
"gcloud auth activate-service-account --key-file=/tmp/key.json",
"gsutil cp gs://grafana-private-downloads/MacOSX10.15.sdk.tar.xz ./scripts/build/ci-build/MacOSX10.15.sdk.tar.xz",
],
},
{
"name": "build-and-publish", # Consider splitting the build and the upload task.
"image": images["cloudsdk"],
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
"environment": {
"DOCKER_USERNAME": from_secret("docker_username"),
"DOCKER_PASSWORD": from_secret("docker_password"),
},
"commands": [
"printenv DOCKER_PASSWORD | docker login -u \"$DOCKER_USERNAME\" --password-stdin",
"docker build -t \"grafana/build-container:${BUILD_CONTAINER_VERSION}\" ./scripts/build/ci-build",
"docker push \"grafana/build-container:${BUILD_CONTAINER_VERSION}\"",
],
},
],
)
return [pl]

@ -8,9 +8,10 @@ load(
"nodejs_version",
)
# "go" image can be switched back to golang:{}-alpine once this is resolved https://github.com/mattn/go-sqlite3/pull/1177#issuecomment-1849176090
images = {
"git": "alpine/git:2.40.1",
"go": "golang:{}-alpine".format(golang_version),
"go": "golang:{}-alpine3.18".format(golang_version),
"node": "node:{}-alpine".format(nodejs_version),
"cloudsdk": "google/cloud-sdk:431.0.0",
"publish": "grafana/grafana-ci-deploy:1.3.3",

@ -3,7 +3,7 @@ global variables
"""
grabpl_version = "v3.0.42"
golang_version = "1.21.3"
golang_version = "1.21.5"
# nodejs_version should match what's in ".nvmrc", but without the v prefix.
nodejs_version = "20.9.0"

Loading…
Cancel
Save