Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
(SDI-2036) Fix #1205 add darwin to binary release
Browse files Browse the repository at this point in the history
Currently we only build linux binaries. This update uses GOOS/GOARCH to
crosscompile for MacOS.

* remove dns update since we have multiple binaries
* follow s3/${GOOS}/${GOARCH}/file convention
* use helper.PluginFilePath to determine binary path
* change latest folder -> last git tag, latest_build folder -> last pr
  • Loading branch information
nanliu committed Sep 27, 2016
1 parent c644599 commit 676744b
Show file tree
Hide file tree
Showing 25 changed files with 204 additions and 253 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ _testmain.go
tmp/
*.tmp
scratch/
build/
*.swp
profile.cov
gin-bin
Expand All @@ -40,3 +39,8 @@ vendor/
.DS_Store

*.cov

# build and release artifacts
build/
s3/
release/
13 changes: 5 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sudo: false
language: go
go:
- 1.5.4
- 1.6.2
- 1.6.3
- 1.7.1
before_install:
- bash scripts/gitcookie.sh
- go get github.com/smartystreets/goconvey/convey
Expand All @@ -11,15 +11,14 @@ env:
global:
- SNAP_SOURCE=/home/travis/gopath/src/github.com/intelsdi-x/snap
- GO15VENDOREXPERIMENT=1
- secure: kSsbBOCrSRyWx6yhSwhTYIWRId4WNMkO9OhMphBPXb5kDEd+asanCybuBKdOSgzuqrzBbQsuQjzhw+iZwdiPoQInZyDxeVl7frroNvg94n+q4tpPQOPzJ6gN15MCHSq3m1lCk3XVrESGEBTqmdmUtZhY+RfxSXuq1xkDMesst2f+gONd5Bl+QFiboRqvjUXwGC+e3JnZI2LxWjYZspNh2ZS6c5mvbhufDPV5MD6+jlZppzHcNkHAtHOt3KNoTFai8X0U8MYiEax3mSIAHjYzQQayS5al54MfgcVo1r4gWmPOybkyb5+/DyNSUT4KY+XVIrxV68fSOuCnLxLEaQZ9W0c0WuetmUU1fOT8Iy9q0qLQq9IknXNnfsCEGdwB2XKfyNvKEtkWbi6b6idrok5d1y7b8Qt5olveczGx0cRbpXQ0BTZ/bnQMhL9tpUeRltbDey6dsSsTJjnatqH7CdeEAV0ZeY+LjBgTukps4TlEHTn0ddEzhR1rrRsQ3OB0kT59Y3BCJ4kstzpMsTFWKUTMr/75UR1g5XETfOt0BtXkM3I343AIjJt+MQg/bW26ZOTbqPbqVO3Z7eDf0MaRC4Mugm809ekMZARTLAmq4FMIutDsTTT741IgWZQrMDI37WUztDUE1WFDzcTkAk99yc6gBjZ+0dZd1Qc7RQR0RMBi4M4=
matrix:
- SNAP_TEST_TYPE=legacy
- SNAP_TEST_TYPE=small
- SNAP_TEST_TYPE=medium
- SNAP_TEST_TYPE=build
matrix:
exclude:
- go: 1.5.4
- go: 1.6.3
env: SNAP_TEST_TYPE=build
install:
- export TMPDIR=$HOME/tmp
Expand All @@ -42,12 +41,10 @@ deploy:
bucket: snap.ci.snap-telemetry.io
region: us-west-2
skip_cleanup: true
local-dir: build
local-dir: s3
upload-dir: snap
acl: public_read
on:
repo: intelsdi-x/snap
branch: master
condition: $SNAP_TEST_TYPE = build && $TRAVIS_GO_VERSION = "1.6.2"
after_deploy:
- "./scripts/post_deploy.sh"
condition: $SNAP_TEST_TYPE = build && $TRAVIS_GO_VERSION = "1.7.1"
6 changes: 3 additions & 3 deletions control/control_grpc_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ package control

import (
"net"
"path"
"testing"

"github.com/intelsdi-x/gomit"
Expand All @@ -38,6 +37,7 @@ import (
"github.com/intelsdi-x/snap/grpc/common"
"github.com/intelsdi-x/snap/grpc/controlproxy/rpc"
"github.com/intelsdi-x/snap/pkg/rpcutil"
"github.com/intelsdi-x/snap/plugin/helper"
. "github.com/smartystreets/goconvey/convey"
)

Expand Down Expand Up @@ -99,7 +99,7 @@ func TestGRPCServerScheduler(t *testing.T) {
})
})
<-lpe.done
passthru, err := core.NewRequestedPlugin(path.Join(fixtures.SnapPath, "plugin", "snap-plugin-processor-passthru"))
passthru, err := core.NewRequestedPlugin(helper.PluginFilePath("snap-plugin-processor-passthru"))
if err != nil {
log.Fatal(err)
}
Expand All @@ -115,7 +115,7 @@ func TestGRPCServerScheduler(t *testing.T) {
typeName: catalogedPassthru.TypeName(),
}
<-lpe.done
filepub, err := core.NewRequestedPlugin(path.Join(fixtures.SnapPath, "plugin", "snap-plugin-publisher-mock-file"))
filepub, err := core.NewRequestedPlugin(helper.PluginFilePath("snap-plugin-publisher-mock-file"))
if err != nil {
log.Fatal(err)
}
Expand Down
27 changes: 14 additions & 13 deletions control/control_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/intelsdi-x/snap/core/control_event"
"github.com/intelsdi-x/snap/core/ctypes"
"github.com/intelsdi-x/snap/core/serror"
"github.com/intelsdi-x/snap/plugin/helper"
)

// Mock Executor used to test
Expand Down Expand Up @@ -1460,7 +1461,7 @@ func TestPublishMetrics(t *testing.T) {
time.Sleep(1 * time.Second)

// Load plugin
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-publisher-mock-file"))
_, err := load(c, helper.PluginFilePath("snap-plugin-publisher-mock-file"))
So(err, ShouldBeNil)
<-lpe.done
So(len(c.pluginManager.all()), ShouldEqual, 1)
Expand Down Expand Up @@ -1508,7 +1509,7 @@ func TestProcessMetrics(t *testing.T) {
c.Config.Plugins.Processor.Plugins["passthru"] = newPluginConfigItem(optAddPluginConfigItem("test", ctypes.ConfigValueBool{Value: true}))

// Load plugin
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-processor-passthru"))
_, err := load(c, helper.PluginFilePath("snap-plugin-processor-passthru"))
So(err, ShouldBeNil)
<-lpe.done
So(len(c.pluginManager.all()), ShouldEqual, 1)
Expand Down Expand Up @@ -1590,7 +1591,7 @@ func TestMetricSubscriptionToNewVersion(t *testing.T) {
lpe := newListenToPluginEvents()
c.eventManager.RegisterHandler("TestMetricSubscriptionToNewVersion", lpe)
c.Start()
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock1"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-mock1"))
<-lpe.load
So(err, ShouldBeNil)
So(len(c.pluginManager.all()), ShouldEqual, 1)
Expand Down Expand Up @@ -1625,7 +1626,7 @@ func TestMetricSubscriptionToNewVersion(t *testing.T) {
})
Convey("Loading v2 of that plugin should move subscriptions to newer version", func() {
// Load version snap-plugin-collector-mock2
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock2"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-mock2"))
So(err, ShouldBeNil)
select {
// Wait on subscriptionMovedEvent
Expand Down Expand Up @@ -1662,7 +1663,7 @@ func TestMetricSubscriptionToOlderVersion(t *testing.T) {
lpe := newListenToPluginEvents()
c.eventManager.RegisterHandler("TestMetricSubscriptionToOlderVersion", lpe)
c.Start()
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock2"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-mock2"))
<-lpe.load
So(err, ShouldBeNil)
So(len(c.pluginManager.all()), ShouldEqual, 1)
Expand Down Expand Up @@ -1693,7 +1694,7 @@ func TestMetricSubscriptionToOlderVersion(t *testing.T) {
mockv2 := pc[0]
Convey("Loading v1 of that plugin and unloading v2 should move subscriptions to older version", func() {
// Load version snap-plugin-collector-mock1
_, err = load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock1"))
_, err = load(c, helper.PluginFilePath("snap-plugin-collector-mock1"))
<-lpe.load
So(err, ShouldBeNil)
// Unload version snap-plugin-collector-mock2
Expand Down Expand Up @@ -1746,7 +1747,7 @@ func TestDynamicMetricSubscriptionLoad(t *testing.T) {
lpe := newListenToPluginEvents()
c.eventManager.RegisterHandler("TestDynamicMetricSubscriptionLoad", lpe)
c.Start()
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock1"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
So(len(c.pluginManager.all()), ShouldEqual, 1)
lp, err2 := c.pluginManager.get("collector" + core.Separator + "mock" + core.Separator + "1")
Expand Down Expand Up @@ -1787,7 +1788,7 @@ func TestDynamicMetricSubscriptionLoad(t *testing.T) {
})
Convey("Loading mock plugin in version 2 should swap subscriptions to latest version", func() {
// Load version snap-plugin-collector-mock2
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock2"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-mock2"))
So(err, ShouldBeNil)
<-lpe.load // wait for load event
<-lpe.sub // wait for subscription event
Expand All @@ -1813,7 +1814,7 @@ func TestDynamicMetricSubscriptionLoad(t *testing.T) {
})
Convey("Loading another plugin should add subscriptions", func() {
// Load version snap-plugin-collector-anothermock1
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-anothermock1"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-anothermock1"))
So(err, ShouldBeNil)
<-lpe.load // wait for load event
<-lpe.sub // wait for subscription event
Expand Down Expand Up @@ -1845,9 +1846,9 @@ func TestDynamicMetricSubscriptionUnload(t *testing.T) {
lpe := newListenToPluginEvents()
c.eventManager.RegisterHandler("TestDynamicMetricSubscriptionUnload", lpe)
c.Start()
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock1"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
_, err = load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-anothermock1"))
_, err = load(c, helper.PluginFilePath("snap-plugin-collector-anothermock1"))
So(err, ShouldBeNil)
So(len(c.pluginManager.all()), ShouldEqual, 2)
lpMock, err2 := c.pluginManager.get("collector" + core.Separator + "mock" + core.Separator + "1")
Expand Down Expand Up @@ -1928,7 +1929,7 @@ func TestDynamicMetricSubscriptionLoadLessMetrics(t *testing.T) {
lpe := newListenToPluginEvents()
c.eventManager.RegisterHandler("TestDynamicMetricSubscriptionLoadLessMetrics", lpe)
c.Start()
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock1"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
So(len(c.pluginManager.all()), ShouldEqual, 1)
lp, err2 := c.pluginManager.get("collector" + core.Separator + "mock" + core.Separator + "1")
Expand Down Expand Up @@ -1970,7 +1971,7 @@ func TestDynamicMetricSubscriptionLoadLessMetrics(t *testing.T) {
})
Convey("Loading higher plugin version with less metrics", func() {
// Load version snap-plugin-collector-mock2
_, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock2"))
_, err := load(c, helper.PluginFilePath("snap-plugin-collector-mock2"))
So(err, ShouldBeNil)
<-lpe.load // wait for load event
<-lpe.sub // wait for subscription event
Expand Down
9 changes: 4 additions & 5 deletions control/fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,20 @@ package fixtures

import (
"encoding/json"
"os"
"path"
"time"

"github.com/intelsdi-x/snap/core"
"github.com/intelsdi-x/snap/core/cdata"
"github.com/intelsdi-x/snap/plugin/helper"
)

var (
PluginName = "snap-plugin-collector-mock2"
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
PluginPath = path.Join(SnapPath, "plugin", PluginName)
SnapPath = helper.BuildPath
PluginPath = helper.PluginFilePath(PluginName)

JSONRPCPluginName = "snap-plugin-collector-mock1"
JSONRPCPluginPath = path.Join(SnapPath, "plugin", JSONRPCPluginName)
JSONRPCPluginPath = helper.PluginFilePath(JSONRPCPluginName)
)

// mocks a metric type
Expand Down
Loading

0 comments on commit 676744b

Please sign in to comment.