Skip to content

Commit fba1dcc

Browse files
kianjones4shrinandj
authored andcommitted
Add semaphore ci (#10)
* Add semaphore.yml * build * build * squashed commits * remove badge
1 parent 3d44568 commit fba1dcc

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

.semaphore/semaphore.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# For more Go information and examples, see
2+
# https://docs.semaphoreci.com/article/86-language-golang
3+
version: v1.0
4+
name: Upgrade Manager
5+
agent:
6+
machine:
7+
type: e1-standard-2
8+
# os_image: ubuntu1804
9+
containers:
10+
- name: main
11+
image: semaphoreci/golang:1.12.9
12+
blocks:
13+
- name: Setup
14+
task:
15+
jobs:
16+
- name: Setup
17+
commands:
18+
- checkout
19+
- source .semaphore/setup.sh
20+
- ls -l /packages
21+
22+
- name: Build
23+
task:
24+
prologue:
25+
commands:
26+
- cache restore $SEMAPHORE_PROJECT_NAME-dep
27+
- ls -l /packages
28+
- pushd /packages
29+
- sudo tar -xvf go1.12.7.linux-amd64.tar.gz
30+
- sudo cp go/bin/go /usr/local/bin
31+
- sudo rm -rf /usr/local/go
32+
- sudo mv go /usr/local
33+
- export os=$(go env GOOS)
34+
- export arch=$(go env GOARCH)
35+
- tar -xzvf kubebuilder_master_${os}_${arch}.tar.gz
36+
- sudo mv kubebuilder_master_${os}_${arch} /usr/local/kubebuilder
37+
- ls /usr/local/kubebuilder
38+
- export PATH=$PATH:/usr/local/kubebuilder/bin
39+
- popd
40+
- checkout
41+
jobs:
42+
- name: Docker Build
43+
commands:
44+
- make docker-build

.semaphore/setup.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cache restore $SEMAPHORE_PROJECT_NAME-dep
2+
3+
if [ ! -d '/packages' ]; then
4+
sudo mkdir -p /packages
5+
wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz
6+
sudo mv go1.12.7.linux-amd64.tar.gz /packages
7+
export os=$(go env GOOS)
8+
export arch=$(go env GOARCH)
9+
curl -sL https://go.kubebuilder.io/dl/latest/${os}/${arch} -o kubebuilder_master_${os}_${arch}.tar.gz
10+
sudo mv kubebuilder_master_${os}_${arch}.tar.gz /packages
11+
ls -l /packages
12+
cache store $SEMAPHORE_PROJECT_NAME-dep /packages
13+
fi

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ vet:
4343

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

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

0 commit comments

Comments
 (0)