diff --git a/.bingo/.gitignore b/.bingo/.gitignore new file mode 100644 index 00000000000..4f2055b6e4c --- /dev/null +++ b/.bingo/.gitignore @@ -0,0 +1,12 @@ + +# Ignore everything +* + +# But not these files: +!.gitignore +!*.mod +!README.md +!Variables.mk +!variables.env + +*tmp.mod diff --git a/.bingo/README.md b/.bingo/README.md new file mode 100644 index 00000000000..7a5c2d4f6da --- /dev/null +++ b/.bingo/README.md @@ -0,0 +1,14 @@ +# Project Development Dependencies. + +This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo. + +* Run `bingo get` to install all tools having each own module file in this directory. +* Run `bingo get ` to install that have own module file in this directory. +* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $() variable where is the .bingo/.mod. +* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool. +* For go: Import `.bingo/variables.go` to for variable names. +* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies. + +## Requirements + +* Go 1.14+ diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk new file mode 100644 index 00000000000..f847833f32f --- /dev/null +++ b/.bingo/Variables.mk @@ -0,0 +1,25 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.5.1. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +GOPATH ?= $(shell go env GOPATH) +GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin +GO ?= $(shell which go) + +# Below generated variables ensure that every time a tool under each variable is invoked, the correct version +# will be used; reinstalling only if needed. +# For example for drone variable: +# +# In your main Makefile (for non array binaries): +# +#include .bingo/Variables.mk # Assuming -dir was set to .bingo . +# +#command: $(DRONE) +# @echo "Running drone" +# @$(DRONE) +# +DRONE := $(GOBIN)/drone-v1.2.4 +$(DRONE): $(BINGO_DIR)/drone.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/drone-v1.2.4" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=drone.mod -o=$(GOBIN)/drone-v1.2.4 "github.com/drone/drone-cli/drone" + diff --git a/.bingo/drone.mod b/.bingo/drone.mod new file mode 100644 index 00000000000..a53dc7266e4 --- /dev/null +++ b/.bingo/drone.mod @@ -0,0 +1,7 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.17 + +replace github.com/docker/docker => github.com/docker/engine v17.12.0-ce-rc1.0.20200309214505-aa6a9891b09c+incompatible + +require github.com/drone/drone-cli v1.2.4 // drone diff --git a/.bingo/go.mod b/.bingo/go.mod new file mode 100644 index 00000000000..610249af0b0 --- /dev/null +++ b/.bingo/go.mod @@ -0,0 +1 @@ +module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files. \ No newline at end of file diff --git a/.bingo/variables.env b/.bingo/variables.env new file mode 100644 index 00000000000..9a746a77d6a --- /dev/null +++ b/.bingo/variables.env @@ -0,0 +1,12 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.5.1. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk. +GOBIN=${GOBIN:=$(go env GOBIN)} + +if [ -z "$GOBIN" ]; then + GOBIN="$(go env GOPATH)/bin" +fi + + +DRONE="${GOBIN}/drone-v1.2.4" + diff --git a/.drone.yml b/.drone.yml index 68382deec99..8cf4a257a14 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3428,6 +3428,6 @@ get: --- kind: signature -hmac: c15f392635eccde32a463d618b922528353b5e6a0d1a96d9f28cc708d74fab10 +hmac: 2ba86c708134cd67f098f896776b1420bec631fa043a14a9991ee2167f0aff1e ... diff --git a/Makefile b/Makefile index 6f4e32ae1f0..f27a57e8b48 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ ## For more information, refer to https://suva.sh/posts/well-documented-makefiles/ -include local/Makefile +include .bingo/Variables.mk .PHONY: all deps-go deps-js deps build-go build-server build-cli build-js build build-docker-dev build-docker-full lint-go golangci-lint test-go test-js test run run-frontend clean devenv devenv-down protobuf drone help @@ -144,9 +145,9 @@ clean: ## Clean up intermediate build artifacts. # Use this make target to regenerate the configuration YAML files when # you modify starlark files. drone: - drone starlark - drone lint - drone --server https://drone.grafana.net sign --save grafana/grafana + $(DRONE) starlark + $(DRONE) lint + $(DRONE) --server https://drone.grafana.net sign --save grafana/grafana help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) diff --git a/e2e/suite1/specs/dashboard-time-zone.spec.ts b/e2e/suite1/specs/dashboard-time-zone.spec.ts index e0be47065e0..144601c302d 100644 --- a/e2e/suite1/specs/dashboard-time-zone.spec.ts +++ b/e2e/suite1/specs/dashboard-time-zone.spec.ts @@ -10,9 +10,9 @@ e2e.scenario({ scenario: () => { e2e.flows.openDashboard({ uid: '5SdHCasdf' }); - const fromTimeZone = 'Coordinated Universal Time'; + const fromTimeZone = 'UTC'; const toTimeZone = 'America/Chicago'; - const offset = -5; + const offset = offsetBetweenTimeZones(toTimeZone, fromTimeZone); const panelsToCheck = [ 'Random walk series', @@ -44,8 +44,7 @@ e2e.scenario({ e2e.components.TimeZonePicker.container() .should('be.visible') .within(() => { - e2e.components.Select.singleValue().should('be.visible').should('have.text', fromTimeZone); - + e2e.components.Select.singleValue().should('be.visible').should('have.text', 'Coordinated Universal Time'); e2e.components.Select.input().should('be.visible').click(); }); @@ -90,3 +89,16 @@ const isTimeCorrect = (inUtc: string, inTz: string, offset: number): boolean => return diff <= Math.abs(offset * 60); }; + +const offsetBetweenTimeZones = (timeZone1: string, timeZone2: string, when: Date = new Date()): number => { + const t1 = convertDateToAnotherTimeZone(when, timeZone1); + const t2 = convertDateToAnotherTimeZone(when, timeZone2); + return (t1.getTime() - t2.getTime()) / (1000 * 60 * 60); +}; + +const convertDateToAnotherTimeZone = (date: Date, timeZone: string): Date => { + const dateString = date.toLocaleString('en-US', { + timeZone: timeZone, + }); + return new Date(dateString); +}; diff --git a/scripts/ci-reference-docs-lint.sh b/scripts/ci-reference-docs-lint.sh index 44fc3f43a3e..ef6e8add94e 100755 --- a/scripts/ci-reference-docs-lint.sh +++ b/scripts/ci-reference-docs-lint.sh @@ -29,7 +29,7 @@ if [ ! -d "$REPORT_PATH" ]; then fi WARNINGS_COUNT="$(find "$REPORT_PATH" -type f -name \*.log -print0 | xargs -0 grep -o "Warning: " | wc -l | xargs)" -WARNINGS_COUNT_LIMIT=1073 +WARNINGS_COUNT_LIMIT=1074 if [ "$WARNINGS_COUNT" -gt $WARNINGS_COUNT_LIMIT ]; then echo -e "API Extractor warnings/errors $WARNINGS_COUNT exceeded $WARNINGS_COUNT_LIMIT so failing build.\n"