Skip to content
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

Add semaphore ci #10

Merged
merged 6 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# For more Go information and examples, see
# https://docs.semaphoreci.com/article/86-language-golang
version: v1.0
name: Upgrade Manager
agent:
machine:
type: e1-standard-2
# os_image: ubuntu1804
containers:
- name: main
image: semaphoreci/golang:1.12.9
blocks:
- name: Setup
task:
jobs:
- name: Setup
commands:
- checkout
- source .semaphore/setup.sh
- ls -l /packages

- name: Build
task:
prologue:
commands:
- cache restore $SEMAPHORE_PROJECT_NAME-dep
- ls -l /packages
- pushd /packages
- sudo tar -xvf go1.12.7.linux-amd64.tar.gz
- sudo cp go/bin/go /usr/local/bin
- sudo rm -rf /usr/local/go
- sudo mv go /usr/local
- export os=$(go env GOOS)
- export arch=$(go env GOARCH)
- tar -xzvf kubebuilder_master_${os}_${arch}.tar.gz
- sudo mv kubebuilder_master_${os}_${arch} /usr/local/kubebuilder
- ls /usr/local/kubebuilder
- export PATH=$PATH:/usr/local/kubebuilder/bin
- popd
- checkout
jobs:
- name: Docker Build
commands:
- make docker-build
13 changes: 13 additions & 0 deletions .semaphore/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cache restore $SEMAPHORE_PROJECT_NAME-dep

if [ ! -d '/packages' ]; then
sudo mkdir -p /packages
wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz
sudo mv go1.12.7.linux-amd64.tar.gz /packages
export os=$(go env GOOS)
export arch=$(go env GOARCH)
curl -sL https://go.kubebuilder.io/dl/latest/${os}/${arch} -o kubebuilder_master_${os}_${arch}.tar.gz
sudo mv kubebuilder_master_${os}_${arch}.tar.gz /packages
ls -l /packages
cache store $SEMAPHORE_PROJECT_NAME-dep /packages
fi
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ vet:

# Generate code
generate: controller-gen
$(CONTROLLER_GEN) --help
$(CONTROLLER_GEN) object:headerFile=./hack/boilerplate.go.txt paths=./api/...

# Build the docker image
Expand All @@ -60,6 +61,8 @@ docker-push:
# download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
export GO111MODULE=off # https://stackoverflow.com/questions/54415733/getting-gopath-error-go-cannot-use-pathversion-syntax-in-gopath-mode-in-ubun
go clean -modcache
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.0-beta.2
CONTROLLER_GEN=$(shell go env GOPATH)/bin/controller-gen
else
Expand Down