mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CI: Call for Grafana version on demand - remove need for version.json
(#54638)
* Remove need for version.json * Fix lint * log.Info -> fmt.Print * Add back tests * Remove non-used file * Fix lint * Update grabpl version to v3.0.6
This commit is contained in:
parent
942be4215a
commit
e277ab0017
80
.drone.yml
80
.drone.yml
@ -17,7 +17,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -62,7 +62,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -141,7 +141,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -246,7 +246,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -509,7 +509,7 @@ services:
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -612,7 +612,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -696,7 +696,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -785,7 +785,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -861,7 +861,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -965,7 +965,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -1399,7 +1399,7 @@ services:
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -1503,7 +1503,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- $$ProgressPreference = "SilentlyContinue"
|
- $$ProgressPreference = "SilentlyContinue"
|
||||||
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/windows/grabpl.exe
|
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/windows/grabpl.exe
|
||||||
-OutFile grabpl.exe
|
-OutFile grabpl.exe
|
||||||
image: grafana/ci-wix:0.1.1
|
image: grafana/ci-wix:0.1.1
|
||||||
name: windows-init
|
name: windows-init
|
||||||
@ -1599,7 +1599,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -1705,7 +1705,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -2013,7 +2013,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -2152,7 +2152,7 @@ services:
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -2248,7 +2248,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- $$ProgressPreference = "SilentlyContinue"
|
- $$ProgressPreference = "SilentlyContinue"
|
||||||
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/windows/grabpl.exe
|
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/windows/grabpl.exe
|
||||||
-OutFile grabpl.exe
|
-OutFile grabpl.exe
|
||||||
image: grafana/ci-wix:0.1.1
|
image: grafana/ci-wix:0.1.1
|
||||||
name: windows-init
|
name: windows-init
|
||||||
@ -2306,7 +2306,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -2654,7 +2654,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -2839,7 +2839,7 @@ services:
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -2981,7 +2981,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- $$ProgressPreference = "SilentlyContinue"
|
- $$ProgressPreference = "SilentlyContinue"
|
||||||
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/windows/grabpl.exe
|
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/windows/grabpl.exe
|
||||||
-OutFile grabpl.exe
|
-OutFile grabpl.exe
|
||||||
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
|
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
|
||||||
- cd grafana-enterprise
|
- cd grafana-enterprise
|
||||||
@ -3057,7 +3057,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3137,7 +3137,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3200,7 +3200,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3281,7 +3281,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3345,7 +3345,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3385,7 +3385,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3425,7 +3425,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3485,7 +3485,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3564,7 +3564,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3641,7 +3641,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3682,7 +3682,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -3957,7 +3957,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -4090,7 +4090,7 @@ services:
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -4180,7 +4180,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- $$ProgressPreference = "SilentlyContinue"
|
- $$ProgressPreference = "SilentlyContinue"
|
||||||
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/windows/grabpl.exe
|
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/windows/grabpl.exe
|
||||||
-OutFile grabpl.exe
|
-OutFile grabpl.exe
|
||||||
image: grafana/ci-wix:0.1.1
|
image: grafana/ci-wix:0.1.1
|
||||||
name: windows-init
|
name: windows-init
|
||||||
@ -4228,7 +4228,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -4565,7 +4565,7 @@ services: []
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -4741,7 +4741,7 @@ services:
|
|||||||
steps:
|
steps:
|
||||||
- commands:
|
- commands:
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/grabpl
|
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/grabpl
|
||||||
- chmod +x bin/grabpl
|
- chmod +x bin/grabpl
|
||||||
image: byrnedo/alpine-curl:0.1.8
|
image: byrnedo/alpine-curl:0.1.8
|
||||||
name: grabpl
|
name: grabpl
|
||||||
@ -4874,7 +4874,7 @@ steps:
|
|||||||
name: identify-runner
|
name: identify-runner
|
||||||
- commands:
|
- commands:
|
||||||
- $$ProgressPreference = "SilentlyContinue"
|
- $$ProgressPreference = "SilentlyContinue"
|
||||||
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.5/windows/grabpl.exe
|
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.6/windows/grabpl.exe
|
||||||
-OutFile grabpl.exe
|
-OutFile grabpl.exe
|
||||||
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
|
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
|
||||||
- cd grafana-enterprise
|
- cd grafana-enterprise
|
||||||
@ -5115,6 +5115,6 @@ kind: secret
|
|||||||
name: packages_secret_access_key
|
name: packages_secret_access_key
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: 0b1eda9462f2da0c0991a3e774e2073b082924705ef8d97dd58a40a8c314d9cd
|
hmac: 6cefdb187edd20260ae51a32f160df1b5523fc48152112284db283b1152f8f4a
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -3,32 +3,21 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/build/compilers"
|
"github.com/grafana/grafana/pkg/build/compilers"
|
||||||
"github.com/grafana/grafana/pkg/build/config"
|
"github.com/grafana/grafana/pkg/build/config"
|
||||||
"github.com/grafana/grafana/pkg/build/errutil"
|
"github.com/grafana/grafana/pkg/build/errutil"
|
||||||
"github.com/grafana/grafana/pkg/build/grafana"
|
"github.com/grafana/grafana/pkg/build/grafana"
|
||||||
"github.com/grafana/grafana/pkg/build/syncutil"
|
"github.com/grafana/grafana/pkg/build/syncutil"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BuildBackend(ctx *cli.Context) error {
|
func BuildBackend(ctx *cli.Context) error {
|
||||||
metadata, err := config.GetMetadata(filepath.Join("dist", "version.json"))
|
metadata, err := GenerateMetadata(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
version := metadata.GrafanaVersion
|
||||||
var version string
|
|
||||||
|
|
||||||
// ./ci build-backend v1.0.0
|
|
||||||
if ctx.NArg() == 1 {
|
|
||||||
version = strings.TrimPrefix(ctx.Args().Get(0), "v")
|
|
||||||
} else {
|
|
||||||
version = metadata.GrafanaVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
edition = config.Edition(ctx.String("edition"))
|
edition = config.Edition(ctx.String("edition"))
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/build/config"
|
"github.com/grafana/grafana/pkg/build/config"
|
||||||
"github.com/grafana/grafana/pkg/build/docker"
|
"github.com/grafana/grafana/pkg/build/docker"
|
||||||
@ -15,7 +14,7 @@ func BuildDocker(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata, err := config.GetMetadata(filepath.Join("dist", "version.json"))
|
metadata, err := GenerateMetadata(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/build/errutil"
|
"github.com/grafana/grafana/pkg/build/errutil"
|
||||||
"github.com/grafana/grafana/pkg/build/frontend"
|
"github.com/grafana/grafana/pkg/build/frontend"
|
||||||
@ -11,10 +10,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func BuildFrontend(c *cli.Context) error {
|
func BuildFrontend(c *cli.Context) error {
|
||||||
version := ""
|
metadata, err := GenerateMetadata(c)
|
||||||
if c.NArg() == 1 {
|
if err != nil {
|
||||||
version = strings.TrimPrefix(c.Args().Get(0), "v")
|
return err
|
||||||
}
|
}
|
||||||
|
version := metadata.GrafanaVersion
|
||||||
|
|
||||||
cfg, mode, err := frontend.GetConfig(c, version)
|
cfg, mode, err := frontend.GetConfig(c, version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/build/config"
|
"github.com/grafana/grafana/pkg/build/config"
|
||||||
"github.com/grafana/grafana/pkg/build/errutil"
|
"github.com/grafana/grafana/pkg/build/errutil"
|
||||||
@ -18,7 +17,7 @@ func BuildInternalPlugins(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const grafanaDir = "."
|
const grafanaDir = "."
|
||||||
metadata, err := config.GetMetadata(filepath.Join("dist", "version.json"))
|
metadata, err := GenerateMetadata(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/build/config"
|
"github.com/grafana/grafana/pkg/build/config"
|
||||||
@ -12,25 +10,13 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GenerateVersions(c *cli.Context) error {
|
func GenerateMetadata(c *cli.Context) (config.Metadata, error) {
|
||||||
var metadata config.Metadata
|
var metadata config.Metadata
|
||||||
version := ""
|
version := ""
|
||||||
if c.NArg() == 1 {
|
|
||||||
version = strings.TrimPrefix(c.Args().Get(0), "v")
|
|
||||||
} else {
|
|
||||||
buildID, ok := os.LookupEnv("DRONE_BUILD_NUMBER")
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("unable to get DRONE_BUILD_NUMBER environmental variable")
|
|
||||||
}
|
|
||||||
var err error
|
|
||||||
version, err = config.GetGrafanaVersion(buildID, ".")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event, err := droneutil.GetDroneEventFromEnv()
|
event, err := droneutil.GetDroneEventFromEnv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return config.Metadata{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var releaseMode config.ReleaseMode
|
var releaseMode config.ReleaseMode
|
||||||
@ -40,13 +26,13 @@ func GenerateVersions(c *cli.Context) error {
|
|||||||
case config.Push:
|
case config.Push:
|
||||||
mode, err := config.CheckDroneTargetBranch()
|
mode, err := config.CheckDroneTargetBranch()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return config.Metadata{}, err
|
||||||
}
|
}
|
||||||
releaseMode = config.ReleaseMode{Mode: mode}
|
releaseMode = config.ReleaseMode{Mode: mode}
|
||||||
case config.Custom:
|
case config.Custom:
|
||||||
mode, err := config.CheckDroneTargetBranch()
|
mode, err := config.CheckDroneTargetBranch()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return config.Metadata{}, err
|
||||||
}
|
}
|
||||||
// if there is a custom event targeting the main branch, that's an enterprise downstream build
|
// if there is a custom event targeting the main branch, that's an enterprise downstream build
|
||||||
if mode == config.MainBranch {
|
if mode == config.MainBranch {
|
||||||
@ -55,16 +41,28 @@ func GenerateVersions(c *cli.Context) error {
|
|||||||
releaseMode = config.ReleaseMode{Mode: mode}
|
releaseMode = config.ReleaseMode{Mode: mode}
|
||||||
}
|
}
|
||||||
case config.Tag, config.Promote:
|
case config.Tag, config.Promote:
|
||||||
|
tag, ok := os.LookupEnv("DRONE_TAG")
|
||||||
|
if !ok || tag == "" {
|
||||||
|
return config.Metadata{}, err
|
||||||
|
}
|
||||||
|
version = strings.TrimPrefix(tag, "v")
|
||||||
mode, err := config.CheckSemverSuffix()
|
mode, err := config.CheckSemverSuffix()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return config.Metadata{}, err
|
||||||
}
|
}
|
||||||
releaseMode = mode
|
releaseMode = mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if version == "" {
|
||||||
|
version, err = generateVersionFromBuildID()
|
||||||
|
if err != nil {
|
||||||
|
return config.Metadata{}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
currentCommit, err := config.GetDroneCommit()
|
currentCommit, err := config.GetDroneCommit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return config.Metadata{}, err
|
||||||
}
|
}
|
||||||
metadata = config.Metadata{
|
metadata = config.Metadata{
|
||||||
GrafanaVersion: version,
|
GrafanaVersion: version,
|
||||||
@ -75,25 +73,18 @@ func GenerateVersions(c *cli.Context) error {
|
|||||||
|
|
||||||
fmt.Printf("building Grafana version: %s, release mode: %+v", metadata.GrafanaVersion, metadata.ReleaseMode)
|
fmt.Printf("building Grafana version: %s, release mode: %+v", metadata.GrafanaVersion, metadata.ReleaseMode)
|
||||||
|
|
||||||
jsonMetadata, err := json.Marshal(&metadata)
|
return metadata, nil
|
||||||
if err != nil {
|
}
|
||||||
return fmt.Errorf("error marshalling metadata, %w", err)
|
|
||||||
}
|
func generateVersionFromBuildID() (string, error) {
|
||||||
|
buildID, ok := os.LookupEnv("DRONE_BUILD_NUMBER")
|
||||||
const distDir = "dist"
|
if !ok {
|
||||||
if _, err := os.Stat(distDir); os.IsNotExist(err) {
|
return "", fmt.Errorf("unable to get DRONE_BUILD_NUMBER environmental variable")
|
||||||
if err := os.RemoveAll(distDir); err != nil {
|
}
|
||||||
return err
|
var err error
|
||||||
}
|
version, err := config.GetGrafanaVersion(buildID, ".")
|
||||||
if err := os.Mkdir(distDir, 0750); err != nil {
|
if err != nil {
|
||||||
return err
|
return "", err
|
||||||
}
|
}
|
||||||
|
return version, nil
|
||||||
// nolint:gosec
|
|
||||||
if err := os.WriteFile(filepath.Join(distDir, "version.json"), jsonMetadata, 0664); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
81
pkg/build/cmd/genversions_test.go
Normal file
81
pkg/build/cmd/genversions_test.go
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/grafana/grafana/pkg/build/config"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DroneBuildEvent = "DRONE_BUILD_EVENT"
|
||||||
|
DroneTargetBranch = "DRONE_TARGET_BRANCH"
|
||||||
|
DroneTag = "DRONE_TAG"
|
||||||
|
DroneSemverPrerelease = "DRONE_SEMVER_PRERELEASE"
|
||||||
|
DroneBuildNumber = "DRONE_BUILD_NUMBER"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
hashedGrafanaVersion = "9.2.0-12345pre"
|
||||||
|
versionedBranch = "v9.2.x"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetMetadata(t *testing.T) {
|
||||||
|
tcs := []struct {
|
||||||
|
envMap map[string]string
|
||||||
|
expVersion string
|
||||||
|
mode config.ReleaseMode
|
||||||
|
}{
|
||||||
|
{map[string]string{DroneBuildEvent: config.PullRequest, DroneTargetBranch: "", DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, config.ReleaseMode{Mode: config.PullRequestMode}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Push, DroneTargetBranch: versionedBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, config.ReleaseMode{Mode: config.ReleaseBranchMode}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Push, DroneTargetBranch: config.MainBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, config.ReleaseMode{Mode: config.MainMode}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Custom, DroneTargetBranch: versionedBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, config.ReleaseMode{Mode: config.ReleaseBranchMode}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Custom, DroneTargetBranch: config.MainBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, config.ReleaseMode{Mode: config.Custom}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Tag, DroneTargetBranch: "", DroneTag: "v9.2.0", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, "9.2.0", config.ReleaseMode{Mode: config.TagMode, IsBeta: false, IsTest: false}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Tag, DroneTargetBranch: "", DroneTag: "v9.2.0-beta", DroneSemverPrerelease: "beta", DroneBuildNumber: "12345"}, "9.2.0-beta", config.ReleaseMode{Mode: config.TagMode, IsBeta: true, IsTest: false}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Tag, DroneTargetBranch: "", DroneTag: "v9.2.0-test", DroneSemverPrerelease: "test", DroneBuildNumber: "12345"}, "9.2.0-test", config.ReleaseMode{Mode: config.TagMode, IsBeta: false, IsTest: true}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Promote, DroneTargetBranch: "", DroneTag: "v9.2.0", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, "9.2.0", config.ReleaseMode{Mode: config.TagMode, IsBeta: false, IsTest: false}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Promote, DroneTargetBranch: "", DroneTag: "v9.2.0-beta", DroneSemverPrerelease: "beta", DroneBuildNumber: "12345"}, "9.2.0-beta", config.ReleaseMode{Mode: config.TagMode, IsBeta: true, IsTest: false}},
|
||||||
|
{map[string]string{DroneBuildEvent: config.Promote, DroneTargetBranch: "", DroneTag: "v9.2.0-test", DroneSemverPrerelease: "test", DroneBuildNumber: "12345"}, "9.2.0-test", config.ReleaseMode{Mode: config.TagMode, IsBeta: false, IsTest: true}},
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := cli.NewContext(cli.NewApp(), &flag.FlagSet{}, nil)
|
||||||
|
for _, tc := range tcs {
|
||||||
|
t.Run("Should return valid metadata, ", func(t *testing.T) {
|
||||||
|
setUpEnv(t, tc.envMap)
|
||||||
|
testMetadata(t, ctx, tc.expVersion, tc.mode)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testMetadata(t *testing.T, ctx *cli.Context, version string, releaseMode config.ReleaseMode) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
metadata, err := GenerateMetadata(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
t.Run("with a valid version", func(t *testing.T) {
|
||||||
|
expVersion := metadata.GrafanaVersion
|
||||||
|
require.Equal(t, expVersion, version)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("with a valid release mode from the built-in list", func(t *testing.T) {
|
||||||
|
expMode := metadata.ReleaseMode
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, expMode, releaseMode)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func setUpEnv(t *testing.T, envMap map[string]string) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
os.Clearenv()
|
||||||
|
err := os.Setenv("DRONE_COMMIT", "abcd12345")
|
||||||
|
require.NoError(t, err)
|
||||||
|
for k, v := range envMap {
|
||||||
|
err := os.Setenv(k, v)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,6 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Before = GenerateVersions
|
|
||||||
app.Commands = cli.Commands{
|
app.Commands = cli.Commands{
|
||||||
{
|
{
|
||||||
Name: "build-backend",
|
Name: "build-backend",
|
||||||
|
3
pkg/build/cmd/package.json
Normal file
3
pkg/build/cmd/package.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"version": "9.2.0-pre"
|
||||||
|
}
|
@ -2,10 +2,7 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
@ -57,40 +54,6 @@ func (md *Metadata) GetReleaseMode() (ReleaseMode, error) {
|
|||||||
// than the way it will be built in 'main'
|
// than the way it will be built in 'main'
|
||||||
type VersionMap map[VersionMode]Version
|
type VersionMap map[VersionMode]Version
|
||||||
|
|
||||||
// GetMetadata attempts to read the JSON file located at 'path' and decode it as a Metadata{} type.
|
|
||||||
// If the provided path does not exist, then an error is not returned. Instead, an empty metadata is returned with no error.
|
|
||||||
func GetMetadata(path string) (*Metadata, error) {
|
|
||||||
if _, err := os.Stat(path); err != nil {
|
|
||||||
if errors.Is(err, os.ErrNotExist) {
|
|
||||||
return &Metadata{}, nil
|
|
||||||
}
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
// Ignore gosec G304 as this function is only used in the build process.
|
|
||||||
//nolint:gosec
|
|
||||||
file, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if err := file.Close(); err != nil {
|
|
||||||
log.Printf("error closing file at '%s': %s", path, err.Error())
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
return DecodeMetadata(file)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DecodeMetadata decodes the data in the io.Reader 'r' as Metadata.
|
|
||||||
func DecodeMetadata(r io.Reader) (*Metadata, error) {
|
|
||||||
m := &Metadata{}
|
|
||||||
if err := json.NewDecoder(r).Decode(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVersions reads the embedded config.json and decodes it.
|
// GetVersions reads the embedded config.json and decodes it.
|
||||||
func GetVersion(mode VersionMode) (*Version, error) {
|
func GetVersion(mode VersionMode) (*Version, error) {
|
||||||
if v, ok := Versions[mode]; ok {
|
if v, ok := Versions[mode]; ok {
|
||||||
|
@ -1,167 +0,0 @@
|
|||||||
package config_test
|
|
||||||
|
|
||||||
var configJSON = []byte(`{
|
|
||||||
"pull_request": {
|
|
||||||
"variants": [
|
|
||||||
"linux-amd64",
|
|
||||||
"linux-amd64-musl",
|
|
||||||
"darwin-amd64",
|
|
||||||
"windows-amd64"
|
|
||||||
],
|
|
||||||
"pluginSignature": {
|
|
||||||
"sign": false,
|
|
||||||
"adminSign": false
|
|
||||||
},
|
|
||||||
"docker": {
|
|
||||||
"shouldSave": false,
|
|
||||||
"archs": [
|
|
||||||
"amd64"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"main": {
|
|
||||||
"variants": [
|
|
||||||
"linux-armv6",
|
|
||||||
"linux-armv7",
|
|
||||||
"linux-armv7-musl",
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-arm64-musl",
|
|
||||||
"darwin-amd64",
|
|
||||||
"windows-amd64",
|
|
||||||
"linux-amd64",
|
|
||||||
"linux-amd64-musl"
|
|
||||||
],
|
|
||||||
"pluginSignature": {
|
|
||||||
"sign": true,
|
|
||||||
"adminSign": true
|
|
||||||
},
|
|
||||||
"docker": {
|
|
||||||
"shouldSave": false,
|
|
||||||
"archs": [
|
|
||||||
"amd64",
|
|
||||||
"arm64",
|
|
||||||
"armv7"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packagesBucket": "grafana-downloads",
|
|
||||||
"CDNAssetsBucket": "grafana-static-assets"
|
|
||||||
},
|
|
||||||
"branch": {
|
|
||||||
"variants": [
|
|
||||||
"linux-armv6",
|
|
||||||
"linux-armv7",
|
|
||||||
"linux-armv7-musl",
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-arm64-musl",
|
|
||||||
"darwin-amd64",
|
|
||||||
"windows-amd64",
|
|
||||||
"linux-amd64",
|
|
||||||
"linux-amd64-musl"
|
|
||||||
],
|
|
||||||
"pluginSignature": {
|
|
||||||
"sign": true,
|
|
||||||
"adminSign": true
|
|
||||||
},
|
|
||||||
"docker": {
|
|
||||||
"shouldSave": true,
|
|
||||||
"archs": [
|
|
||||||
"amd64",
|
|
||||||
"arm64",
|
|
||||||
"armv7"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packagesBucket": "grafana-downloads",
|
|
||||||
"packagesBucketEnterprise2": "grafana-downloads-enterprise2",
|
|
||||||
"CDNAssetsBucket": "grafana-static-assets"
|
|
||||||
},
|
|
||||||
"release": {
|
|
||||||
"variants": [
|
|
||||||
"linux-armv6",
|
|
||||||
"linux-armv7",
|
|
||||||
"linux-armv7-musl",
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-arm64-musl",
|
|
||||||
"darwin-amd64",
|
|
||||||
"windows-amd64",
|
|
||||||
"linux-amd64",
|
|
||||||
"linux-amd64-musl"
|
|
||||||
],
|
|
||||||
"pluginSignature": {
|
|
||||||
"sign": true,
|
|
||||||
"adminSign": true
|
|
||||||
},
|
|
||||||
"docker": {
|
|
||||||
"shouldSave": true,
|
|
||||||
"archs": [
|
|
||||||
"amd64",
|
|
||||||
"arm64",
|
|
||||||
"armv7"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packagesBucket": "grafana-prerelease/artifacts/downloads",
|
|
||||||
"CDNAssetsBucket": "grafana-prerelease",
|
|
||||||
"CDNAssetsDir": "artifacts/static-assets",
|
|
||||||
"storybookBucket": "grafana-prerelease",
|
|
||||||
"storybookSrcDir": "artifacts/storybook"
|
|
||||||
},
|
|
||||||
"beta": {
|
|
||||||
"variants": [
|
|
||||||
"linux-armv6",
|
|
||||||
"linux-armv7",
|
|
||||||
"linux-armv7-musl",
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-arm64-musl",
|
|
||||||
"darwin-amd64",
|
|
||||||
"windows-amd64",
|
|
||||||
"linux-amd64",
|
|
||||||
"linux-amd64-musl"
|
|
||||||
],
|
|
||||||
"pluginSignature": {
|
|
||||||
"sign": true,
|
|
||||||
"adminSign": true
|
|
||||||
},
|
|
||||||
"docker": {
|
|
||||||
"shouldSave": true,
|
|
||||||
"archs": [
|
|
||||||
"amd64",
|
|
||||||
"arm64",
|
|
||||||
"armv7"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packagesBucket": "grafana-prerelease/artifacts/downloads",
|
|
||||||
"CDNAssetsBucket": "grafana-prerelease",
|
|
||||||
"CDNAssetsDir": "artifacts/static-assets",
|
|
||||||
"storybookBucket": "grafana-prerelease",
|
|
||||||
"storybookSrcDir": "artifacts/storybook"
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"variants": [
|
|
||||||
"linux-armv6",
|
|
||||||
"linux-armv7",
|
|
||||||
"linux-armv7-musl",
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-arm64-musl",
|
|
||||||
"darwin-amd64",
|
|
||||||
"windows-amd64",
|
|
||||||
"linux-amd64",
|
|
||||||
"linux-amd64-musl"
|
|
||||||
],
|
|
||||||
"pluginSignature": {
|
|
||||||
"sign": true,
|
|
||||||
"adminSign": true
|
|
||||||
},
|
|
||||||
"docker": {
|
|
||||||
"shouldSave": true,
|
|
||||||
"archs": [
|
|
||||||
"amd64",
|
|
||||||
"arm64",
|
|
||||||
"armv7"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packagesBucket": "grafana-prerelease/artifacts/downloads",
|
|
||||||
"CDNAssetsBucket": "grafana-prerelease",
|
|
||||||
"CDNAssetsDir": "artifacts/static-assets",
|
|
||||||
"storybookBucket": "grafana-prerelease",
|
|
||||||
"storybookSrcDir": "artifacts/storybook"
|
|
||||||
}
|
|
||||||
}`)
|
|
@ -1,96 +0,0 @@
|
|||||||
package config_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/build/config"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestGetMetadata(t *testing.T) {
|
|
||||||
tcs := []struct {
|
|
||||||
version string
|
|
||||||
mode config.ReleaseMode
|
|
||||||
}{
|
|
||||||
{"v1.2.3", config.ReleaseMode{Mode: config.TagMode}},
|
|
||||||
{"v1.2.3-12345pre", config.ReleaseMode{Mode: config.PullRequestMode}},
|
|
||||||
{"v1.2.3-beta1", config.ReleaseMode{Mode: config.TagMode, IsBeta: true}},
|
|
||||||
{"v1.2.3-test1", config.ReleaseMode{Mode: config.TagMode, IsTest: true}},
|
|
||||||
{"v1.2.3-foobar", config.ReleaseMode{Mode: config.ReleaseBranchMode}},
|
|
||||||
{"v1.2.3-foobar", config.ReleaseMode{Mode: config.PullRequestMode}},
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Run("Should return empty metadata, dist/ is not present", func(t *testing.T) {
|
|
||||||
dir := t.TempDir()
|
|
||||||
metadata, err := config.GetMetadata(filepath.Join(dir, "dist"))
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, metadata, &config.Metadata{})
|
|
||||||
if err := os.RemoveAll(dir); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
for _, tc := range tcs {
|
|
||||||
dir := t.TempDir()
|
|
||||||
t.Run("Should return valid metadata, tag mode, ", func(t *testing.T) {
|
|
||||||
testMetadata(t, dir, tc.version, tc.mode)
|
|
||||||
})
|
|
||||||
if err := os.RemoveAll(dir); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func testMetadata(t *testing.T, dir string, version string, releaseMode config.ReleaseMode) {
|
|
||||||
t.Helper()
|
|
||||||
file := filepath.Join(dir, "version.json")
|
|
||||||
createVersionJSON(t, version, file, releaseMode)
|
|
||||||
|
|
||||||
metadata, err := config.GetMetadata(file)
|
|
||||||
require.NoError(t, err)
|
|
||||||
t.Run("with a valid version", func(t *testing.T) {
|
|
||||||
expVersion := metadata.GrafanaVersion
|
|
||||||
require.Equal(t, expVersion, version)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("with a valid release mode from the built-in list", func(t *testing.T) {
|
|
||||||
expMode := metadata.ReleaseMode
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, expMode, releaseMode)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("with a valid configuration from a JSON file", func(t *testing.T) {
|
|
||||||
version, err := config.GetVersion(metadata.ReleaseMode.Mode)
|
|
||||||
require.NoError(t, err)
|
|
||||||
parsed := verModeFromConfig(t, metadata)
|
|
||||||
require.EqualValues(t, parsed, *version)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func verModeFromConfig(t *testing.T, metadata *config.Metadata) config.Version {
|
|
||||||
t.Helper()
|
|
||||||
|
|
||||||
metadataComp := config.VersionMap{}
|
|
||||||
|
|
||||||
require.NoError(t, json.Unmarshal(configJSON, &metadataComp))
|
|
||||||
|
|
||||||
return metadataComp[metadata.ReleaseMode.Mode]
|
|
||||||
}
|
|
||||||
|
|
||||||
func createVersionJSON(t *testing.T, version string, file string, releaseMode config.ReleaseMode) {
|
|
||||||
t.Helper()
|
|
||||||
|
|
||||||
metadata := &config.Metadata{
|
|
||||||
GrafanaVersion: version,
|
|
||||||
ReleaseMode: releaseMode,
|
|
||||||
}
|
|
||||||
|
|
||||||
//nolint:gosec
|
|
||||||
f, err := os.Create(file)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
require.NoError(t, json.NewEncoder(f).Encode(metadata))
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token', 'prerelease_bucket')
|
load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token', 'prerelease_bucket')
|
||||||
|
|
||||||
grabpl_version = 'v3.0.5'
|
grabpl_version = 'v3.0.6'
|
||||||
build_image = 'grafana/build-container:1.5.9'
|
build_image = 'grafana/build-container:1.5.9'
|
||||||
publish_image = 'grafana/grafana-ci-deploy:1.3.3'
|
publish_image = 'grafana/grafana-ci-deploy:1.3.3'
|
||||||
deploy_docker_image = 'us.gcr.io/kubernetes-dev/drone/plugins/deploy-image'
|
deploy_docker_image = 'us.gcr.io/kubernetes-dev/drone/plugins/deploy-image'
|
||||||
|
Loading…
Reference in New Issue
Block a user