2021-11-20 18:02:18 +01:00
|
|
|
---
|
2021-07-23 02:00:02 +02:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2021-11-20 18:02:18 +01:00
|
|
|
name: Code Quality
|
2021-07-23 02:00:02 +02:00
|
|
|
|
|
|
|
steps:
|
2021-11-20 18:02:18 +01:00
|
|
|
- name: static_check
|
|
|
|
image: golang:1.17
|
|
|
|
commands:
|
|
|
|
- go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
|
- staticcheck -checks all ./pkg/...
|
|
|
|
volumes:
|
|
|
|
- name: env_cache
|
|
|
|
path: /go
|
|
|
|
|
|
|
|
- name: lint
|
|
|
|
image: golang:1.17
|
|
|
|
commands:
|
|
|
|
- go install golang.org/x/lint/golint@latest
|
|
|
|
- golint -set_exit_status ./pkg/...
|
|
|
|
volumes:
|
|
|
|
- name: env_cache
|
|
|
|
path: /go
|
|
|
|
|
|
|
|
- name: vet
|
|
|
|
image: golang:1.17
|
|
|
|
commands:
|
|
|
|
- go vet ./pkg/...
|
|
|
|
volumes:
|
|
|
|
- name: env_cache
|
|
|
|
path: /go
|
2021-08-02 23:14:16 +02:00
|
|
|
|
|
|
|
volumes:
|
2021-11-20 18:02:18 +01:00
|
|
|
- name: env_cache
|
|
|
|
temp: {}
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: Test
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: modules_install
|
|
|
|
image: golang:1.17
|
|
|
|
commands:
|
|
|
|
- go mod tidy && go mod download
|
|
|
|
volumes:
|
|
|
|
- name: env_cache
|
|
|
|
path: /go
|
|
|
|
|
|
|
|
- name: build
|
|
|
|
image: golang:1.17
|
|
|
|
commands:
|
2021-11-21 17:52:57 +01:00
|
|
|
- go build -o /tmp/vegvisir pkg/main.go
|
2021-11-20 18:02:18 +01:00
|
|
|
volumes:
|
|
|
|
- name: tmp_cache
|
|
|
|
path: /tmp
|
2021-11-15 20:15:16 +01:00
|
|
|
- name: env_cache
|
2021-11-20 18:02:18 +01:00
|
|
|
path: /go
|
|
|
|
|
|
|
|
- name: run
|
|
|
|
image: golang:1.17
|
|
|
|
detach: true
|
|
|
|
commands:
|
|
|
|
- echo $(hostname) >> /tmp/server_hostname
|
|
|
|
- /tmp/vegvisir -c ./vegvisir.test.json
|
|
|
|
volumes:
|
|
|
|
- name: tmp_cache
|
|
|
|
path: /tmp
|
|
|
|
|
|
|
|
- name: test
|
|
|
|
image: golang:1.17
|
|
|
|
commands:
|
2021-11-21 17:52:57 +01:00
|
|
|
- while ! ls /tmp/server_hostname; do sleep 1; done
|
2021-11-21 18:12:11 +01:00
|
|
|
# - server_hostname=$(cat /tmp/server_hostname)
|
|
|
|
- curl -fsS http://$(cat /tmp/server_hostname):8080/health | grep OK
|
2021-11-21 17:52:57 +01:00
|
|
|
# - "[ $(curl -fsS http://$server_hostname:8080/health | grep OK | wc -l) = 0 ] && { echo 'Not running.'; return 1; } || { echo 'Vegvisir is running.'; return 0; }"
|
2021-11-20 18:02:18 +01:00
|
|
|
volumes:
|
2021-11-21 17:52:57 +01:00
|
|
|
- name: tmp_cache
|
|
|
|
path: /tmp
|
2021-11-20 18:02:18 +01:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: env_cache
|
|
|
|
temp: {}
|
|
|
|
- name: tmp_cache
|
|
|
|
temp: {}
|
2021-11-21 17:52:57 +01:00
|
|
|
|