From 2e8a4f2b3205f2bca9a7b4364e4b91aab16808ef Mon Sep 17 00:00:00 2001 From: Mark Goodwin Date: Wed, 26 Feb 2020 08:38:50 +1100 Subject: [PATCH] Update to latest upstream sources v6.6.2 --- .gitignore | 2 + 000-set-version-string.patch | 15 + 001-login-oauth-use-oauth2-exchange.patch | 4 +- 002-remove-jaeger-tracing.patch | 95 +++++- 003-new-files.patch | 249 ++++++++------- 004-wrappers-grafana-cli.patch | 26 ++ 004-xerrors.patch | 146 --------- 005-mute-shellcheck-grafana-cli.patch | 12 - 005-pkg-main-fix-import-paths.patch | 17 ++ 006-pkg-setting-ini-default-section.patch | 13 + 007-pkg-prometheus-client-query-range.patch | 18 ++ ...services-notifications-codes-Unknwon.patch | 13 + 009-pkg-fix-xorm-import.patch | 288 ++++++++++++++++++ grafana.spec | 224 +++++++------- sources | 4 +- 15 files changed, 718 insertions(+), 408 deletions(-) create mode 100644 000-set-version-string.patch create mode 100644 004-wrappers-grafana-cli.patch delete mode 100644 004-xerrors.patch delete mode 100644 005-mute-shellcheck-grafana-cli.patch create mode 100644 005-pkg-main-fix-import-paths.patch create mode 100644 006-pkg-setting-ini-default-section.patch create mode 100644 007-pkg-prometheus-client-query-range.patch create mode 100644 008-pkg-services-notifications-codes-Unknwon.patch create mode 100644 009-pkg-fix-xorm-import.patch diff --git a/.gitignore b/.gitignore index f73aa3f..9380e56 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ /grafana_webpack-6.3.5.tar.gz /grafana-6.3.6.tar.gz /grafana_webpack-6.3.6.tar.gz +/grafana-6.6.2.tar.gz +/grafana_webpack-6.6.2.tar.gz diff --git a/000-set-version-string.patch b/000-set-version-string.patch new file mode 100644 index 0000000..d66154e --- /dev/null +++ b/000-set-version-string.patch @@ -0,0 +1,15 @@ +diff --git a/pkg/cmd/grafana-server/main.go b/pkg/cmd/grafana-server/main.go +index 14d6036e82..d2e61564f2 100644 +--- a/pkg/cmd/grafana-server/main.go ++++ b/pkg/cmd/grafana-server/main.go +@@ -32,8 +32,8 @@ import ( + _ "github.com/grafana/grafana/pkg/tsdb/testdatasource" + ) + +-var version = "5.0.0" +-var commit = "NA" ++var version = "6.6.2" ++var commit = "3fa63cfc34668781c7f9b3caafe6d9d400b06b7f" + var buildBranch = "master" + var buildstamp string + diff --git a/001-login-oauth-use-oauth2-exchange.patch b/001-login-oauth-use-oauth2-exchange.patch index ff59d44..f6dff49 100644 --- a/001-login-oauth-use-oauth2-exchange.patch +++ b/001-login-oauth-use-oauth2-exchange.patch @@ -1,8 +1,8 @@ diff --git a/pkg/api/login_oauth.go b/pkg/api/login_oauth.go -index a46c97238..76fc8480c 100644 +index c8c9f05b33..1b5a67aec2 100644 --- a/pkg/api/login_oauth.go +++ b/pkg/api/login_oauth.go -@@ -125,7 +125,7 @@ func (hs *HTTPServer) OAuthLogin(ctx *m.ReqContext) { +@@ -134,7 +134,7 @@ func (hs *HTTPServer) OAuthLogin(ctx *m.ReqContext) { oauthCtx := context.WithValue(context.Background(), oauth2.HTTPClient, oauthClient) // get token from provider diff --git a/002-remove-jaeger-tracing.patch b/002-remove-jaeger-tracing.patch index 0d20b5e..e6fae49 100644 --- a/002-remove-jaeger-tracing.patch +++ b/002-remove-jaeger-tracing.patch @@ -1,5 +1,5 @@ diff --git a/pkg/cmd/grafana-server/server.go b/pkg/cmd/grafana-server/server.go -index 85d6db43e..6de99b58b 100644 +index 0dace4ebab..f1a4bfde53 100644 --- a/pkg/cmd/grafana-server/server.go +++ b/pkg/cmd/grafana-server/server.go @@ -23,7 +23,6 @@ import ( @@ -12,10 +12,10 @@ index 85d6db43e..6de99b58b 100644 "github.com/grafana/grafana/pkg/login/social" diff --git a/pkg/infra/tracing/tracing.go b/pkg/infra/tracing/tracing.go deleted file mode 100644 -index d1511a533..000000000 +index 923459786b..0000000000 --- a/pkg/infra/tracing/tracing.go +++ /dev/null -@@ -1,148 +0,0 @@ +@@ -1,161 +0,0 @@ -package tracing - -import ( @@ -56,7 +56,7 @@ index d1511a533..000000000 - ts.parseSettings() - - if ts.enabled { -- ts.initGlobalTracer() +- return ts.initGlobalTracer() - } - - return nil @@ -80,7 +80,7 @@ index d1511a533..000000000 - ts.disableSharedZipkinSpans = section.Key("disable_shared_zipkin_spans").MustBool(false) -} - --func (ts *TracingService) initGlobalTracer() error { +-func (ts *TracingService) initJaegerCfg() (jaegercfg.Configuration, error) { - cfg := jaegercfg.Configuration{ - ServiceName: "grafana", - Disabled: !ts.enabled, @@ -94,6 +94,19 @@ index d1511a533..000000000 - }, - } - +- _, err := cfg.FromEnv() +- if err != nil { +- return cfg, err +- } +- return cfg, nil +-} +- +-func (ts *TracingService) initGlobalTracer() error { +- cfg, err := ts.initJaegerCfg() +- if err != nil { +- return err +- } +- - jLogger := &jaegerLogWrapper{logger: log.New("jaeger")} - - options := []jaegercfg.Option{} @@ -120,7 +133,7 @@ index d1511a533..000000000 - return err - } - -- opentracing.InitGlobalTracer(tracer) +- opentracing.SetGlobalTracer(tracer) - - ts.closer = closer - @@ -166,13 +179,18 @@ index d1511a533..000000000 -} diff --git a/pkg/infra/tracing/tracing_test.go b/pkg/infra/tracing/tracing_test.go deleted file mode 100644 -index 27e4de777..000000000 +index a6d71cf165..0000000000 --- a/pkg/infra/tracing/tracing_test.go +++ /dev/null -@@ -1,36 +0,0 @@ +@@ -1,94 +0,0 @@ -package tracing - --import "testing" +-import ( +- "github.com/stretchr/testify/assert" +- "github.com/stretchr/testify/require" +- "os" +- "testing" +-) - -func TestGroupSplit(t *testing.T) { - tests := []struct { @@ -200,9 +218,62 @@ index 27e4de777..000000000 - tags := splitTagSettings(test.input) - for k, v := range test.expected { - value, exists := tags[k] -- if !exists || value != v { -- t.Errorf("tags does not match %v ", test) -- } +- assert.Truef(t, exists, "Tag %q not found for input %q", k, test.input) +- assert.Equalf(t, v, value, "Tag %q has wrong value for input %q", k, test.input) - } - } -} +- +-func TestInitJaegerCfg_Default(t *testing.T) { +- ts := &TracingService{} +- cfg, err := ts.initJaegerCfg() +- require.NoError(t, err) +- +- assert.True(t, cfg.Disabled) +-} +- +-func TestInitJaegerCfg_Enabled(t *testing.T) { +- ts := &TracingService{enabled: true} +- cfg, err := ts.initJaegerCfg() +- require.NoError(t, err) +- +- assert.False(t, cfg.Disabled) +- assert.Equal(t, "localhost:6831", cfg.Reporter.LocalAgentHostPort) +-} +- +-func TestInitJaegerCfg_DisabledViaEnv(t *testing.T) { +- os.Setenv("JAEGER_DISABLED", "true") +- defer func() { +- os.Unsetenv("JAEGER_DISABLED") +- }() +- +- ts := &TracingService{enabled: true} +- cfg, err := ts.initJaegerCfg() +- require.NoError(t, err) +- +- assert.True(t, cfg.Disabled) +-} +- +-func TestInitJaegerCfg_EnabledViaEnv(t *testing.T) { +- os.Setenv("JAEGER_DISABLED", "false") +- defer func() { +- os.Unsetenv("JAEGER_DISABLED") +- }() +- +- ts := &TracingService{enabled: false} +- cfg, err := ts.initJaegerCfg() +- require.NoError(t, err) +- +- assert.False(t, cfg.Disabled) +-} +- +-func TestInitJaegerCfg_InvalidEnvVar(t *testing.T) { +- os.Setenv("JAEGER_DISABLED", "totallybogus") +- defer func() { +- os.Unsetenv("JAEGER_DISABLED") +- }() +- +- ts := &TracingService{} +- _, err := ts.initJaegerCfg() +- require.EqualError(t, err, "cannot parse env var JAEGER_DISABLED=totallybogus: strconv.ParseBool: parsing \"totallybogus\": invalid syntax") +-} diff --git a/003-new-files.patch b/003-new-files.patch index 2cac75d..0d21b7f 100644 --- a/003-new-files.patch +++ b/003-new-files.patch @@ -1,9 +1,9 @@ diff --git a/conf/distro-defaults.ini b/conf/distro-defaults.ini new file mode 100644 -index 0000000000..e337ba0b57 +index 0000000000..e9d3cb9593 --- /dev/null +++ b/conf/distro-defaults.ini -@@ -0,0 +1,685 @@ +@@ -0,0 +1,706 @@ +##################### Grafana Configuration Defaults for distros ##################### +# +# Do not modify this file in grafana installs @@ -34,7 +34,7 @@ index 0000000000..e337ba0b57 + +#################################### Server ############################## +[server] -+# Protocol (http, https, socket) ++# Protocol (http, https, h2, socket) +protocol = http + +# The ip address to bind to, empty will bind to all interfaces @@ -122,7 +122,7 @@ index 0000000000..e337ba0b57 + +# cache connectionstring options +# database: will use Grafana primary database. -+# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0`. Only addr is required. ++# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'. +# memcache: 127.0.0.1:11211 +connstr = + @@ -161,6 +161,9 @@ index 0000000000..e337ba0b57 + +#################################### Security ############################ +[security] ++# disable creation of admin user on first start of grafana ++disable_initial_admin_creation = false ++ +# default admin user, created on startup +admin_user = admin + @@ -182,7 +185,7 @@ index 0000000000..e337ba0b57 +# set to true if you host Grafana behind HTTPS. default is false. +cookie_secure = false + -+# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict" and "none" ++# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled" +cookie_samesite = lax + +# set to true if you want to allow browsers to render Grafana in a ,