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
65bacf2d
Unverified
Commit
65bacf2d
authored
Nov 21, 2019
by
Leonard Gram
Committed by
GitHub
Nov 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI: fix release script remove filtering (#20552)
parent
22edacd4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
16 deletions
+46
-16
scripts/build/release_publisher/main.go
+2
-2
scripts/build/release_publisher/publisher.go
+3
-3
scripts/build/release_publisher/publisher_test.go
+41
-11
No files found.
scripts/build/release_publisher/main.go
View file @
65bacf2d
...
...
@@ -45,9 +45,9 @@ func main() {
product
=
"grafana-enterprise"
baseURL
=
createBaseURL
(
archiveProviderRoot
,
"enterprise"
,
product
,
nightly
)
var
err
error
buildArtifacts
,
err
=
filterBuildArtifacts
([]
artifactFilter
{
buildArtifacts
,
err
=
filterBuildArtifacts
(
completeBuildArtifactConfigurations
,
Remove
,
[]
artifactFilter
{
{
os
:
"win-installer"
,
arch
:
"amd64"
},
}
,
Remove
)
})
if
err
!=
nil
{
log
.
Fatalf
(
"Could not filter to the selected build artifacts, err=%v"
,
err
)
...
...
scripts/build/release_publisher/publisher.go
View file @
65bacf2d
...
...
@@ -193,10 +193,10 @@ const (
Remove
filterType
=
"remove"
)
func
filterBuildArtifacts
(
filter
s
[]
artifactFilter
,
ft
filterType
)
([]
buildArtifact
,
error
)
{
func
filterBuildArtifacts
(
filter
From
[]
buildArtifact
,
ft
filterType
,
filters
[]
artifactFilter
)
([]
buildArtifact
,
error
)
{
var
artifacts
[]
buildArtifact
for
_
,
a
:=
range
completeBuildArtifactConfigurations
{
for
_
,
a
:=
range
filterFrom
{
matched
:=
false
var
match
buildArtifact
...
...
@@ -211,7 +211,7 @@ func filterBuildArtifacts(filters []artifactFilter, ft filterType) ([]buildArtif
if
matched
&&
ft
==
Add
{
artifacts
=
append
(
artifacts
,
match
)
}
else
if
!
matched
&&
ft
==
Remove
{
artifacts
=
append
(
artifacts
,
match
)
artifacts
=
append
(
artifacts
,
a
)
}
}
return
artifacts
,
nil
...
...
scripts/build/release_publisher/publisher_test.go
View file @
65bacf2d
package
main
import
"testing"
import
(
"reflect"
"testing"
)
func
TestPreparingReleaseFromRemote
(
t
*
testing
.
T
)
{
...
...
@@ -148,33 +151,60 @@ func (mockHTTPGetter) getContents(url string) (string, error) {
}
func
TestFilterBuildArtifacts
(
t
*
testing
.
T
)
{
buildArtifacts
,
_
:=
filterBuildArtifacts
([]
artifactFilter
{
buildArtifacts
,
_
:=
filterBuildArtifacts
(
completeBuildArtifactConfigurations
,
Add
,
[]
artifactFilter
{
{
os
:
"deb"
,
arch
:
"amd64"
},
{
os
:
"rhel"
,
arch
:
"amd64"
},
{
os
:
"linux"
,
arch
:
"amd64"
},
{
os
:
"win"
,
arch
:
"amd64"
},
}
,
Add
)
})
if
len
(
buildArtifacts
)
!=
4
{
t
.
Errorf
(
"Expected 4 build artifacts after filtering, but was %v"
,
len
(
buildArtifacts
))
}
buildArtifacts
,
err
:=
filterBuildArtifacts
([]
artifactFilter
{
{
os
:
"win-installer"
,
arch
:
"amd64"
},
},
Remove
)
buildArtifacts
,
err
:=
filterBuildArtifacts
([]
buildArtifact
{
{
os
:
"linux"
,
arch
:
"amd64"
,
},
{
os
:
"arm"
,
arch
:
"amd64"
,
},
{
os
:
"darwin"
,
arch
:
"amd64"
,
},
},
Remove
,
[]
artifactFilter
{
{
os
:
"darwin"
,
arch
:
"amd64"
},
})
if
err
!=
nil
{
t
.
Error
f
(
"Expected all artifacts except win-msi, not error=%v"
,
err
)
t
.
Error
(
)
}
if
len
(
buildArtifacts
)
!=
len
(
completeBuildArtifactConfigurations
)
-
1
{
t
.
Errorf
(
"Expected
%v artifacts but was %v"
,
completeBuildArtifactConfigurations
,
buildArtifacts
)
if
len
(
buildArtifacts
)
!=
2
{
t
.
Errorf
(
"Expected
2 artifacts, was %v"
,
len
(
buildArtifacts
)
)
}
for
_
,
ba
:=
range
buildArtifacts
{
if
ba
.
arch
==
"amd64"
&&
ba
.
os
==
"
win-installer
"
{
t
.
Errorf
(
"
win-installer
/amd64 should be gone due to filtering"
)
if
ba
.
arch
==
"amd64"
&&
ba
.
os
==
"
darwin
"
{
t
.
Errorf
(
"
darwin
/amd64 should be gone due to filtering"
)
}
}
left
:=
[]
buildArtifact
{
{
os
:
"linux"
,
arch
:
"amd64"
,
},
{
os
:
"arm"
,
arch
:
"amd64"
,
},
}
if
!
reflect
.
DeepEqual
(
left
,
buildArtifacts
)
{
t
.
Errorf
(
"Lists should have been equal but was, expected=%v, actual=%v"
,
left
,
buildArtifacts
)
}
}
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