Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
ff977331
Commit
ff977331
authored
Mar 22, 2019
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: support for publishing armv6.
parent
6e802dc9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
195 deletions
+35
-195
.circleci/config.yml
+4
-2
scripts/build/release_publisher/localrelease.go
+0
-95
scripts/build/release_publisher/main.go
+5
-16
scripts/build/release_publisher/publisher.go
+9
-7
scripts/build/release_publisher/publisher_test.go
+17
-75
No files found.
.circleci/config.yml
View file @
ff977331
...
...
@@ -340,7 +340,9 @@ jobs:
command
:
'
/opt/google-cloud-sdk/bin/gsutil
cp
./enterprise-dist/*
gs://$GCP_BUCKET_NAME/enterprise/master'
-
run
:
name
:
Deploy to grafana.com
command
:
'
cd
enterprise-dist
&&
../scripts/build/release_publisher/release_publisher
-apikey
${GRAFANA_COM_API_KEY}
-enterprise
-from-local'
command
:
|
cd enterprise-dist
../scripts/build/release_publisher/release_publisher -apikey ${GRAFANA_COM_API_KEY} -enterprise -version "$(cat grafana.version)"' --nightly
deploy-enterprise-release
:
...
...
@@ -405,7 +407,7 @@ jobs:
command
:
|
rm dist/grafana-master-$(echo "${CIRCLE_SHA1}" | cut -b1-7).linux-x64.tar.gz
rm dist/*latest*
cd dist && ../scripts/build/release_publisher/release_publisher -apikey ${GRAFANA_COM_API_KEY} -
from-local
cd dist && ../scripts/build/release_publisher/release_publisher -apikey ${GRAFANA_COM_API_KEY} -
version "$(cat grafana.version)" --nightly
deploy-release
:
docker
:
...
...
scripts/build/release_publisher/localrelease.go
deleted
100644 → 0
View file @
6e802dc9
package
main
import
(
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/pkg/errors"
)
type
releaseLocalSources
struct
{
path
string
artifactConfigurations
[]
buildArtifact
}
func
(
r
releaseLocalSources
)
prepareRelease
(
baseArchiveURL
,
whatsNewURL
string
,
releaseNotesURL
string
,
nightly
bool
)
(
*
release
,
error
)
{
if
!
nightly
{
return
nil
,
errors
.
New
(
"Local releases only supported for nightly builds"
)
}
buildData
:=
r
.
findBuilds
(
baseArchiveURL
)
rel
:=
release
{
Version
:
buildData
.
version
,
ReleaseDate
:
time
.
Now
()
.
UTC
(),
Stable
:
false
,
Beta
:
false
,
Nightly
:
nightly
,
WhatsNewURL
:
whatsNewURL
,
ReleaseNotesURL
:
releaseNotesURL
,
Builds
:
buildData
.
builds
,
}
return
&
rel
,
nil
}
type
buildData
struct
{
version
string
builds
[]
build
}
func
(
r
releaseLocalSources
)
findBuilds
(
baseArchiveURL
string
)
buildData
{
data
:=
buildData
{}
filepath
.
Walk
(
r
.
path
,
createBuildWalker
(
r
.
path
,
&
data
,
r
.
artifactConfigurations
,
baseArchiveURL
))
return
data
}
func
createBuildWalker
(
path
string
,
data
*
buildData
,
archiveTypes
[]
buildArtifact
,
baseArchiveURL
string
)
func
(
path
string
,
f
os
.
FileInfo
,
err
error
)
error
{
return
func
(
path
string
,
f
os
.
FileInfo
,
err
error
)
error
{
if
err
!=
nil
{
log
.
Printf
(
"error: %v"
,
err
)
}
if
f
.
Name
()
==
path
||
strings
.
HasSuffix
(
f
.
Name
(),
".sha256"
)
{
return
nil
}
for
_
,
archive
:=
range
archiveTypes
{
if
strings
.
HasSuffix
(
f
.
Name
(),
archive
.
urlPostfix
)
{
shaBytes
,
err
:=
ioutil
.
ReadFile
(
path
+
".sha256"
)
if
err
!=
nil
{
log
.
Fatalf
(
"Failed to read sha256 file %v"
,
err
)
}
version
,
err
:=
grabVersion
(
f
.
Name
(),
archive
.
urlPostfix
)
if
err
!=
nil
{
log
.
Println
(
err
)
continue
}
data
.
version
=
version
data
.
builds
=
append
(
data
.
builds
,
build
{
Os
:
archive
.
os
,
URL
:
archive
.
getURL
(
baseArchiveURL
,
version
,
NIGHTLY
),
Sha256
:
string
(
shaBytes
),
Arch
:
archive
.
arch
,
})
return
nil
}
}
return
nil
}
}
func
grabVersion
(
name
string
,
suffix
string
)
(
string
,
error
)
{
match
:=
regexp
.
MustCompile
(
fmt
.
Sprintf
(
`grafana(-enterprise)?[-_](.*)%s`
,
suffix
))
.
FindSubmatch
([]
byte
(
name
))
if
len
(
match
)
>
0
{
return
string
(
match
[
2
]),
nil
}
return
""
,
errors
.
New
(
"No version found"
)
}
scripts/build/release_publisher/main.go
View file @
ff977331
...
...
@@ -13,7 +13,6 @@ func main() {
var
releaseNotesURL
string
var
dryRun
bool
var
enterprise
bool
var
fromLocal
bool
var
nightly
bool
var
apiKey
string
...
...
@@ -23,11 +22,9 @@ func main() {
flag
.
StringVar
(
&
apiKey
,
"apikey"
,
""
,
"Grafana.com API key (ex: --apikey ABCDEF)"
)
flag
.
BoolVar
(
&
dryRun
,
"dry-run"
,
false
,
"--dry-run"
)
flag
.
BoolVar
(
&
enterprise
,
"enterprise"
,
false
,
"--enterprise"
)
flag
.
BoolVar
(
&
fromLocal
,
"from-local"
,
false
,
"--from-local (builds will be tagged as nightly
)"
)
flag
.
BoolVar
(
&
nightly
,
"nightly"
,
false
,
"--nightly (default: false
)"
)
flag
.
Parse
()
nightly
=
fromLocal
if
len
(
os
.
Args
)
==
1
{
fmt
.
Println
(
"Usage: go run publisher.go main.go --version <v> --wn <what's new url> --rn <release notes url> --apikey <api key> --dry-run false --enterprise false --nightly false"
)
fmt
.
Println
(
"example: go run publisher.go main.go --version v5.2.0-beta2 --wn http://docs.grafana.org/guides/whats-new-in-v5-2/ --rn https://community.grafana.com/t/release-notes-v5-2-x/7894 --apikey ASDF123 --dry-run --enterprise"
)
...
...
@@ -64,18 +61,10 @@ func main() {
baseURL
=
createBaseURL
(
archiveProviderRoot
,
"oss"
,
product
,
nightly
)
}
if
fromLocal
{
path
,
_
:=
os
.
Getwd
()
builder
=
releaseLocalSources
{
path
:
path
,
artifactConfigurations
:
buildArtifacts
,
}
}
else
{
builder
=
releaseFromExternalContent
{
getter
:
getHTTPContents
{},
rawVersion
:
version
,
artifactConfigurations
:
buildArtifacts
,
}
builder
=
releaseFromExternalContent
{
getter
:
getHTTPContents
{},
rawVersion
:
version
,
artifactConfigurations
:
buildArtifacts
,
}
p
:=
publisher
{
...
...
scripts/build/release_publisher/publisher.go
View file @
ff977331
...
...
@@ -85,9 +85,10 @@ func (rt releaseType) nightly() bool {
}
type
buildArtifact
struct
{
os
string
arch
string
urlPostfix
string
os
string
arch
string
urlPostfix
string
packagePostfix
string
}
func
(
t
buildArtifact
)
getURL
(
baseArchiveURL
,
version
string
,
releaseType
releaseType
)
string
{
...
...
@@ -102,7 +103,7 @@ func (t buildArtifact) getURL(baseArchiveURL, version string, releaseType releas
rhelReleaseExtra
=
"-1"
}
url
:=
strings
.
Join
([]
string
{
baseArchiveURL
,
prefix
,
version
,
rhelReleaseExtra
,
t
.
urlPostfix
},
""
)
url
:=
strings
.
Join
([]
string
{
baseArchiveURL
,
t
.
packagePostfix
,
prefix
,
version
,
rhelReleaseExtra
,
t
.
urlPostfix
},
""
)
return
url
}
...
...
@@ -128,9 +129,10 @@ var completeBuildArtifactConfigurations = []buildArtifact{
urlPostfix
:
"_armhf.deb"
,
},
{
os
:
"deb"
,
arch
:
"armv6"
,
urlPostfix
:
"_armel.deb"
,
os
:
"deb"
,
arch
:
"armv6"
,
packagePostfix
:
"-rpi"
,
urlPostfix
:
"_armhf.deb"
,
},
{
os
:
"rhel"
,
...
...
scripts/build/release_publisher/publisher_test.go
View file @
ff977331
...
...
@@ -30,7 +30,7 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
expectedOs
:
"linux"
,
expectedURL
:
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.0-beta1.linux-amd64.tar.gz"
,
baseArchiveURL
:
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana"
,
buildArtifacts
:
[]
buildArtifact
{{
"linux"
,
"amd64"
,
".linux-amd64.tar.gz"
}},
buildArtifacts
:
[]
buildArtifact
{{
"linux"
,
"amd64"
,
".linux-amd64.tar.gz"
,
""
}},
},
{
version
:
"v5.2.3"
,
...
...
@@ -44,7 +44,7 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
expectedOs
:
"rhel"
,
expectedURL
:
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.3-1.x86_64.rpm"
,
baseArchiveURL
:
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana"
,
buildArtifacts
:
[]
buildArtifact
{{
"rhel"
,
"amd64"
,
".x86_64.rpm"
}},
buildArtifacts
:
[]
buildArtifact
{{
"rhel"
,
"amd64"
,
".x86_64.rpm"
,
""
}},
},
{
version
:
"v5.4.0-pre1asdf"
,
...
...
@@ -58,7 +58,21 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
expectedOs
:
"rhel"
,
expectedURL
:
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.4.0-pre1asdf.x86_64.rpm"
,
baseArchiveURL
:
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana"
,
buildArtifacts
:
[]
buildArtifact
{{
"rhel"
,
"amd64"
,
".x86_64.rpm"
}},
buildArtifacts
:
[]
buildArtifact
{{
"rhel"
,
"amd64"
,
".x86_64.rpm"
,
""
}},
},
{
version
:
"v5.4.0-pre1asdf"
,
expectedVersion
:
"5.4.0-pre1asdf"
,
whatsNewURL
:
"https://whatsnews.foo/"
,
relNotesURL
:
"https://relnotes.foo/"
,
nightly
:
true
,
expectedBeta
:
false
,
expectedStable
:
false
,
expectedArch
:
"armv6"
,
expectedOs
:
"linux"
,
expectedURL
:
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-rpi-5.4.0-pre1asdf_armhf.deb"
,
baseArchiveURL
:
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana"
,
buildArtifacts
:
[]
buildArtifact
{{
"linux"
,
"armv6"
,
"_armhf.deb"
,
"-rpi"
}},
},
}
...
...
@@ -105,78 +119,6 @@ func (mockHTTPGetter) getContents(url string) (string, error) {
return
url
,
nil
}
func
TestPreparingReleaseFromLocal
(
t
*
testing
.
T
)
{
whatsNewURL
:=
"https://whatsnews.foo/"
relNotesURL
:=
"https://relnotes.foo/"
expectedVersion
:=
"5.4.0-123pre1"
expectedBuilds
:=
4
var
builder
releaseBuilder
testDataPath
:=
"testdata"
builder
=
releaseLocalSources
{
path
:
testDataPath
,
artifactConfigurations
:
completeBuildArtifactConfigurations
,
}
relAll
,
_
:=
builder
.
prepareRelease
(
"https://s3-us-west-2.amazonaws.com/grafana-enterprise-releases/master/grafana-enterprise"
,
whatsNewURL
,
relNotesURL
,
true
)
if
relAll
.
Stable
||
!
relAll
.
Nightly
{
t
.
Error
(
"Expected a nightly release but wasn't."
)
}
if
relAll
.
ReleaseNotesURL
!=
relNotesURL
{
t
.
Errorf
(
"expected releaseNotesURL to be %s, but it was %s"
,
relNotesURL
,
relAll
.
ReleaseNotesURL
)
}
if
relAll
.
WhatsNewURL
!=
whatsNewURL
{
t
.
Errorf
(
"expected whatsNewURL to be %s, but it was %s"
,
whatsNewURL
,
relAll
.
WhatsNewURL
)
}
if
relAll
.
Beta
{
t
.
Errorf
(
"Expected release to be nightly, not beta."
)
}
if
relAll
.
Version
!=
expectedVersion
{
t
.
Errorf
(
"Expected version=%s, but got=%s"
,
expectedVersion
,
relAll
.
Version
)
}
if
len
(
relAll
.
Builds
)
!=
expectedBuilds
{
t
.
Errorf
(
"Expected %v builds, but was %v"
,
expectedBuilds
,
len
(
relAll
.
Builds
))
}
expectedArch
:=
"amd64"
expectedOs
:=
"win"
builder
=
releaseLocalSources
{
path
:
testDataPath
,
artifactConfigurations
:
[]
buildArtifact
{{
os
:
expectedOs
,
arch
:
expectedArch
,
urlPostfix
:
".windows-amd64.zip"
,
}},
}
relOne
,
_
:=
builder
.
prepareRelease
(
"https://s3-us-west-2.amazonaws.com/grafana-enterprise-releases/master/grafana-enterprise"
,
whatsNewURL
,
relNotesURL
,
true
)
if
len
(
relOne
.
Builds
)
!=
1
{
t
.
Errorf
(
"Expected 1 artifact, but was %v"
,
len
(
relOne
.
Builds
))
}
build
:=
relOne
.
Builds
[
0
]
if
build
.
Arch
!=
expectedArch
{
t
.
Fatalf
(
"Expected arch to be %s, but was %s"
,
expectedArch
,
build
.
Arch
)
}
if
build
.
Os
!=
expectedOs
{
t
.
Fatalf
(
"Expected os to be %s, but was %s"
,
expectedOs
,
build
.
Os
)
}
_
,
err
:=
builder
.
prepareRelease
(
""
,
""
,
""
,
false
)
if
err
==
nil
{
t
.
Error
(
"Error was nil, but expected an error as the local releaser only supports nightly builds."
)
}
}
func
TestFilterBuildArtifacts
(
t
*
testing
.
T
)
{
buildArtifacts
,
_
:=
filterBuildArtifacts
([]
artifactFilter
{
{
os
:
"deb"
,
arch
:
"amd64"
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment