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
84832cb6
Commit
84832cb6
authored
Nov 19, 2018
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: releaser supports releasing only some artifacts.
parent
87707c96
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
15 deletions
+83
-15
.circleci/config.yml
+3
-0
scripts/build/publish.sh
+3
-1
scripts/build/release_publisher/main.go
+25
-12
scripts/build/release_publisher/publisher.go
+27
-1
scripts/build/release_publisher/publisher_test.go
+25
-1
No files found.
.circleci/config.yml
View file @
84832cb6
...
...
@@ -359,6 +359,9 @@ jobs:
-
run
:
name
:
deploy to gcp
command
:
'
/opt/google-cloud-sdk/bin/gsutil
cp
./enterprise-dist/*
gs://$GCP_BUCKET_NAME/enterprise/release'
-
run
:
name
:
Deploy to Grafana.com
command
:
'
./scripts/build/publish.sh
--enterprise'
deploy-master
:
docker
:
...
...
scripts/build/publish.sh
View file @
84832cb6
...
...
@@ -2,6 +2,8 @@
# no relation to publish.go
EXTRA_OPTS
=
"
$@
"
# Right now we hack this in into the publish script.
# Eventually we might want to keep a list of all previous releases somewhere.
_releaseNoteUrl
=
"https://community.grafana.com/t/release-notes-v5-3-x/10244"
...
...
@@ -11,4 +13,4 @@ _whatsNewUrl="http://docs.grafana.org/guides/whats-new-in-v5-3/"
--wn
${
_whatsNewUrl
}
\
--rn
${
_releaseNoteUrl
}
\
--version
${
CIRCLE_TAG
}
\
--apikey
${
GRAFANA_COM_API_KEY
}
--apikey
${
GRAFANA_COM_API_KEY
}
${
EXTRA_OPTS
}
scripts/build/release_publisher/main.go
View file @
84832cb6
...
...
@@ -41,30 +41,43 @@ func main() {
var
builder
releaseBuilder
var
product
string
archiveProviderRoot
:=
"https://s3-us-west-2.amazonaws.com"
buildArtifacts
:=
completeBuildArtifactConfigurations
if
enterprise
{
product
=
"grafana-enterprise"
baseUrl
=
createBaseUrl
(
archiveProviderRoot
,
"grafana-enterprise-releases"
,
product
,
nightly
)
var
err
error
buildArtifacts
,
err
=
filterBuildArtifacts
([]
artifactFilter
{
{
os
:
"deb"
,
arch
:
"amd64"
},
{
os
:
"rpm"
,
arch
:
"amd64"
},
{
os
:
"linux"
,
arch
:
"amd64"
},
{
os
:
"windows"
,
arch
:
"amd64"
},
})
if
err
!=
nil
{
log
.
Fatalf
(
"Could not filter to the selected build artifacts, err=%v"
,
err
)
}
}
else
{
product
=
"grafana"
baseUrl
=
createBaseUrl
(
archiveProviderRoot
,
"grafana-releases"
,
product
,
nightly
)
}
if
fromLocal
{
path
,
_
:=
os
.
Getwd
()
builder
=
releaseLocalSources
{
path
:
path
,
artifactConfigurations
:
buildArtifact
Configuration
s
,
artifactConfigurations
:
buildArtifacts
,
}
}
else
{
builder
=
releaseFromExternalContent
{
getter
:
getHttpContents
{},
rawVersion
:
version
,
artifactConfigurations
:
buildArtifact
Configuration
s
,
artifactConfigurations
:
buildArtifacts
,
}
}
archiveProviderRoot
:=
"https://s3-us-west-2.amazonaws.com"
if
enterprise
{
product
=
"grafana-enterprise"
baseUrl
=
createBaseUrl
(
archiveProviderRoot
,
"grafana-enterprise-releases"
,
product
,
nightly
)
}
else
{
product
=
"grafana"
baseUrl
=
createBaseUrl
(
archiveProviderRoot
,
"grafana-releases"
,
product
,
nightly
)
}
p
:=
publisher
{
apiKey
:
apiKey
,
apiUri
:
"https://grafana.com/api"
,
...
...
scripts/build/release_publisher/publisher.go
View file @
84832cb6
...
...
@@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/pkg/errors"
"io/ioutil"
"log"
"net/http"
...
...
@@ -103,7 +104,7 @@ func (t buildArtifact) getUrl(baseArchiveUrl, version string, releaseType Releas
return
url
}
var
b
uildArtifactConfigurations
=
[]
buildArtifact
{
var
completeB
uildArtifactConfigurations
=
[]
buildArtifact
{
{
os
:
"deb"
,
arch
:
"arm64"
,
...
...
@@ -161,6 +162,31 @@ var buildArtifactConfigurations = []buildArtifact{
},
}
type
artifactFilter
struct
{
os
string
arch
string
}
func
filterBuildArtifacts
(
filters
[]
artifactFilter
)
([]
buildArtifact
,
error
)
{
var
artifacts
[]
buildArtifact
for
_
,
f
:=
range
filters
{
matched
:=
false
for
_
,
a
:=
range
completeBuildArtifactConfigurations
{
if
f
.
os
==
a
.
os
&&
f
.
arch
==
a
.
arch
{
artifacts
=
append
(
artifacts
,
a
)
matched
=
true
break
}
}
if
!
matched
{
return
nil
,
errors
.
New
(
fmt
.
Sprintf
(
"No buildArtifact for os=%v, arch=%v"
,
f
.
os
,
f
.
arch
))
}
}
return
artifacts
,
nil
}
func
newBuild
(
baseArchiveUrl
string
,
ba
buildArtifact
,
version
string
,
rt
ReleaseType
,
sha256
string
)
build
{
return
build
{
Os
:
ba
.
os
,
...
...
scripts/build/release_publisher/publisher_test.go
View file @
84832cb6
...
...
@@ -115,7 +115,7 @@ func TestPreparingReleaseFromLocal(t *testing.T) {
testDataPath
:=
"testdata"
builder
=
releaseLocalSources
{
path
:
testDataPath
,
artifactConfigurations
:
b
uildArtifactConfigurations
,
artifactConfigurations
:
completeB
uildArtifactConfigurations
,
}
relAll
,
_
:=
builder
.
prepareRelease
(
"https://s3-us-west-2.amazonaws.com/grafana-enterprise-releases/master/grafana-enterprise"
,
whatsNewUrl
,
relNotesUrl
,
true
)
...
...
@@ -176,3 +176,27 @@ func TestPreparingReleaseFromLocal(t *testing.T) {
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"
},
{
os
:
"rhel"
,
arch
:
"amd64"
},
{
os
:
"linux"
,
arch
:
"amd64"
},
{
os
:
"win"
,
arch
:
"amd64"
},
})
if
len
(
buildArtifacts
)
!=
4
{
t
.
Errorf
(
"Expected 4 build artifacts after filtering, but was %v"
,
len
(
buildArtifacts
))
}
_
,
err
:=
filterBuildArtifacts
([]
artifactFilter
{
{
os
:
"foobar"
,
arch
:
"amd64"
},
})
if
err
==
nil
{
t
.
Errorf
(
"Expected an error as a we tried to filter on a nonexiststant os."
)
}
}
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