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
8f0d3ff7
Commit
8f0d3ff7
authored
Nov 19, 2018
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: fixes a bug where nightly rpm builds would be handled as stable.
parent
2d361eea
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
17 deletions
+83
-17
scripts/build/release_publisher/externalrelease.go
+9
-5
scripts/build/release_publisher/localrelease.go
+3
-0
scripts/build/release_publisher/publisher.go
+14
-2
scripts/build/release_publisher/publisher_test.go
+57
-10
No files found.
scripts/build/release_publisher/externalrelease.go
View file @
8f0d3ff7
...
@@ -16,10 +16,14 @@ type releaseFromExternalContent struct {
...
@@ -16,10 +16,14 @@ type releaseFromExternalContent struct {
func
(
re
releaseFromExternalContent
)
prepareRelease
(
baseArchiveUrl
,
whatsNewUrl
string
,
releaseNotesUrl
string
,
nightly
bool
)
(
*
release
,
error
)
{
func
(
re
releaseFromExternalContent
)
prepareRelease
(
baseArchiveUrl
,
whatsNewUrl
string
,
releaseNotesUrl
string
,
nightly
bool
)
(
*
release
,
error
)
{
version
:=
re
.
rawVersion
[
1
:
]
version
:=
re
.
rawVersion
[
1
:
]
isB
eta
:=
strings
.
Contains
(
version
,
"beta"
)
b
eta
:=
strings
.
Contains
(
version
,
"beta"
)
var
rt
ReleaseType
var
rt
ReleaseType
if
isB
eta
{
if
b
eta
{
rt
=
BETA
rt
=
BETA
}
else
if
nightly
{
rt
=
NIGHTLY
}
else
{
rt
=
STABLE
}
}
builds
:=
[]
build
{}
builds
:=
[]
build
{}
...
@@ -34,9 +38,9 @@ func (re releaseFromExternalContent) prepareRelease(baseArchiveUrl, whatsNewUrl
...
@@ -34,9 +38,9 @@ func (re releaseFromExternalContent) prepareRelease(baseArchiveUrl, whatsNewUrl
r
:=
release
{
r
:=
release
{
Version
:
version
,
Version
:
version
,
ReleaseDate
:
time
.
Now
()
.
UTC
(),
ReleaseDate
:
time
.
Now
()
.
UTC
(),
Stable
:
!
isBeta
&&
!
nightly
,
Stable
:
rt
.
stable
()
,
Beta
:
isBeta
,
Beta
:
rt
.
beta
()
,
Nightly
:
nightly
,
Nightly
:
rt
.
nightly
()
,
WhatsNewUrl
:
whatsNewUrl
,
WhatsNewUrl
:
whatsNewUrl
,
ReleaseNotesUrl
:
releaseNotesUrl
,
ReleaseNotesUrl
:
releaseNotesUrl
,
Builds
:
builds
,
Builds
:
builds
,
...
...
scripts/build/release_publisher/localrelease.go
View file @
8f0d3ff7
...
@@ -18,6 +18,9 @@ type releaseLocalSources struct {
...
@@ -18,6 +18,9 @@ type releaseLocalSources struct {
}
}
func
(
r
releaseLocalSources
)
prepareRelease
(
baseArchiveUrl
,
whatsNewUrl
string
,
releaseNotesUrl
string
,
nightly
bool
)
(
*
release
,
error
)
{
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
)
buildData
:=
r
.
findBuilds
(
baseArchiveUrl
)
rel
:=
release
{
rel
:=
release
{
...
...
scripts/build/release_publisher/publisher.go
View file @
8f0d3ff7
...
@@ -69,13 +69,25 @@ const (
...
@@ -69,13 +69,25 @@ const (
NIGHTLY
NIGHTLY
)
)
func
(
rt
ReleaseType
)
beta
()
bool
{
return
rt
==
BETA
}
func
(
rt
ReleaseType
)
stable
()
bool
{
return
rt
==
STABLE
}
func
(
rt
ReleaseType
)
nightly
()
bool
{
return
rt
==
NIGHTLY
}
type
buildArtifact
struct
{
type
buildArtifact
struct
{
os
string
os
string
arch
string
arch
string
urlPostfix
string
urlPostfix
string
}
}
func
(
t
buildArtifact
)
getUrl
(
baseArchiveUrl
,
version
string
,
r
t
ReleaseType
)
string
{
func
(
t
buildArtifact
)
getUrl
(
baseArchiveUrl
,
version
string
,
r
eleaseType
ReleaseType
)
string
{
prefix
:=
"-"
prefix
:=
"-"
rhelReleaseExtra
:=
""
rhelReleaseExtra
:=
""
...
@@ -83,7 +95,7 @@ func (t buildArtifact) getUrl(baseArchiveUrl, version string, rt ReleaseType) st
...
@@ -83,7 +95,7 @@ func (t buildArtifact) getUrl(baseArchiveUrl, version string, rt ReleaseType) st
prefix
=
"_"
prefix
=
"_"
}
}
if
r
t
==
BETA
&&
t
.
os
==
"rhel"
{
if
r
eleaseType
==
STABLE
&&
t
.
os
==
"rhel"
{
rhelReleaseExtra
=
"-1"
rhelReleaseExtra
=
"-1"
}
}
...
...
scripts/build/release_publisher/publisher_test.go
View file @
8f0d3ff7
...
@@ -5,23 +5,61 @@ import "testing"
...
@@ -5,23 +5,61 @@ import "testing"
func
TestPreparingReleaseFromRemote
(
t
*
testing
.
T
)
{
func
TestPreparingReleaseFromRemote
(
t
*
testing
.
T
)
{
cases
:=
[]
struct
{
cases
:=
[]
struct
{
version
string
version
string
expectedVersion
string
expectedVersion
string
whatsNewUrl
string
whatsNewUrl
string
relNotesUrl
string
relNotesUrl
string
expectedArch
string
nightly
bool
expectedOs
string
expectedBeta
bool
buildArtifacts
[]
buildArtifact
expectedStable
bool
expectedArch
string
expectedOs
string
expectedUrl
string
baseArchiveUrl
string
buildArtifacts
[]
buildArtifact
}{
}{
{
{
version
:
"v5.2.0-beta1"
,
version
:
"v5.2.0-beta1"
,
expectedVersion
:
"5.2.0-beta1"
,
expectedVersion
:
"5.2.0-beta1"
,
whatsNewUrl
:
"https://whatsnews.foo/"
,
whatsNewUrl
:
"https://whatsnews.foo/"
,
relNotesUrl
:
"https://relnotes.foo/"
,
relNotesUrl
:
"https://relnotes.foo/"
,
nightly
:
false
,
expectedBeta
:
true
,
expectedStable
:
false
,
expectedArch
:
"amd64"
,
expectedArch
:
"amd64"
,
expectedOs
:
"linux"
,
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"
,
expectedVersion
:
"5.2.3"
,
whatsNewUrl
:
"https://whatsnews.foo/"
,
relNotesUrl
:
"https://relnotes.foo/"
,
nightly
:
false
,
expectedBeta
:
false
,
expectedStable
:
true
,
expectedArch
:
"amd64"
,
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"
}},
},
{
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
:
"amd64"
,
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"
}},
},
}
}
for
_
,
test
:=
range
cases
{
for
_
,
test
:=
range
cases
{
...
@@ -32,10 +70,10 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
...
@@ -32,10 +70,10 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
artifactConfigurations
:
test
.
buildArtifacts
,
artifactConfigurations
:
test
.
buildArtifacts
,
}
}
rel
,
_
:=
builder
.
prepareRelease
(
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana"
,
test
.
whatsNewUrl
,
test
.
relNotesUrl
,
false
)
rel
,
_
:=
builder
.
prepareRelease
(
test
.
baseArchiveUrl
,
test
.
whatsNewUrl
,
test
.
relNotesUrl
,
test
.
nightly
)
if
!
rel
.
Beta
||
rel
.
Stable
{
if
rel
.
Beta
!=
test
.
expectedBeta
||
rel
.
Stable
!=
test
.
expected
Stable
{
t
.
Errorf
(
"%s should have been tagged as beta
(not stable), but wasn't ."
,
test
.
version
)
t
.
Errorf
(
"%s should have been tagged as beta
=%v, stable=%v."
,
test
.
version
,
test
.
expectedBeta
,
test
.
expectedStable
)
}
}
if
rel
.
Version
!=
test
.
expectedVersion
{
if
rel
.
Version
!=
test
.
expectedVersion
{
...
@@ -53,7 +91,11 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
...
@@ -53,7 +91,11 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
}
}
if
build
.
Os
!=
test
.
expectedOs
{
if
build
.
Os
!=
test
.
expectedOs
{
t
.
Errorf
(
"Expected arch to be %v, but it was %v"
,
test
.
expectedOs
,
build
.
Os
)
t
.
Errorf
(
"Expected os to be %v, but it was %v"
,
test
.
expectedOs
,
build
.
Os
)
}
if
build
.
Url
!=
test
.
expectedUrl
{
t
.
Errorf
(
"Expected url to be %v, but it was %v"
,
test
.
expectedUrl
,
build
.
Url
)
}
}
}
}
}
}
...
@@ -129,4 +171,9 @@ func TestPreparingReleaseFromLocal(t *testing.T) {
...
@@ -129,4 +171,9 @@ func TestPreparingReleaseFromLocal(t *testing.T) {
if
build
.
Os
!=
expectedOs
{
if
build
.
Os
!=
expectedOs
{
t
.
Fatalf
(
"Expected os to be %s, but was %s"
,
expectedOs
,
build
.
Os
)
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."
)
}
}
}
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