-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CD-CI #1
Merged
+117
−0
Merged
CD-CI #1
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
.go | ||
.idea | ||
/trafficmirror | ||
vendor | ||
trafficmirror |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
variables: | ||
GL_URL: github.com/rb3ckers | ||
GO_PROJECT_NAMESPACE: trafficmirror | ||
IMAGE_FAMILY: stackstate/trafficmirror | ||
CI_REGISTRY: docker.io | ||
|
||
.prep_go: &prep_go | ||
before_script: | ||
- echo export GO_PROJECT_PATH="$GOPATH/src/$GL_URL/$GO_PROJECT_NAMESPACE" | ||
- export GO_PROJECT_PATH="$GOPATH/src/$GL_URL/$GO_PROJECT_NAMESPACE" | ||
- rm -rf $GOPATH/src/$GL_URL | ||
- mkdir -p $GOPATH/src/$GL_URL | ||
- echo ln -s $(pwd) $GO_PROJECT_PATH | ||
- ln -s $(pwd) $GO_PROJECT_PATH | ||
- cd $GO_PROJECT_PATH | ||
|
||
stages: | ||
- build | ||
- docker_build | ||
|
||
go_build: | ||
<<: *prep_go | ||
stage: build | ||
image: golang:1.11 | ||
script: | ||
- go get github.com/golang/dep/cmd/dep | ||
- dep ensure | ||
- mkdir -p build | ||
- env GOOS=linux GOARCH=amd64 go build -o build/trafficmirror | ||
- ls -la $GO_PROJECT_PATH/ | ||
artifacts: | ||
paths: | ||
- build | ||
expire_in: 1 week | ||
|
||
docker_build: | ||
stage: docker_build | ||
image: docker:latest | ||
dependencies: | ||
- go_build | ||
services: | ||
- docker:dind | ||
script: | ||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY | ||
- docker build -t $IMAGE_FAMILY:${CI_COMMIT_TAG:-dirty} . | ||
- echo docker push $IMAGE_FAMILY:${CI_COMMIT_TAG:-dirty} | ||
- docker push $IMAGE_FAMILY:${CI_COMMIT_TAG:-dirty} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM debian:stretch | ||
|
||
ADD build/trafficmirror /trafficmirror | ||
ADD ./init.sh /init | ||
RUN chmod +x /init | ||
|
||
CMD ["/init"] | ||
|
||
EXPOSE 8080 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
|
||
[[constraint]] | ||
name = "github.com/sony/gobreaker" | ||
version = "0.4.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, some much needed dependency management. |
||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SHELL := /bin/bash | ||
|
||
clean: | ||
rm -rf build | ||
|
||
build: | ||
source build-env.sh && \ | ||
cd $(GO_PROJECT_PATH) && \ | ||
dep ensure && \ | ||
mkdir -p build && \ | ||
GOOS=linux GOARCH=amd64 go build -o build/trafficmirror |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# use with source | ||
export GL_URL=github.com/rb3ckers | ||
export GO_PROJECT_NAMESPACE=trafficmirror | ||
if [ ! -d $(pwd)/.go ] | ||
then | ||
mkdir -p $(pwd)/.go/src/$GL_URL | ||
ln -s $(pwd) $(pwd)/.go/src/$GL_URL/$GO_PROJECT_NAMESPACE | ||
fi | ||
export GOPATH=$(pwd)/.go | ||
export GOBIN=$GOPATH/bin | ||
export PATH=$GOBIN:$PATH | ||
export GO_PROJECT_PATH=$(pwd)/.go/src/$GL_URL/$GO_PROJECT_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
LISTEN_PORT=${LISTEN_PORT:-7077} | ||
MAIN=${MAIN:-localhost:8888} | ||
EXTRA_PARAMS=$1 | ||
|
||
echo /trafficmirror /trafficmirror -listen ":${LISTEN_PORT}" -main=${MAIN} $EXTRA_PARAMS | ||
/trafficmirror -listen ":${LISTEN_PORT}" -main=${MAIN} $EXTRA_PARAMS |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example block is not needed