2021-07-23 02:00:02 +02:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
2021-08-02 23:14:16 +02:00
|
|
|
- name: static_check
|
2022-04-16 14:42:59 +02:00
|
|
|
image: golang:1.18
|
2021-07-23 02:00:02 +02:00
|
|
|
commands:
|
2022-04-16 14:42:59 +02:00
|
|
|
- go install honnef.co/go/tools/cmd/staticcheck@latest
|
2021-08-02 23:14:16 +02:00
|
|
|
- staticcheck ./pkg/...
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
|
|
|
|
- name: lint
|
2022-04-16 14:42:59 +02:00
|
|
|
image: golang:1.18
|
2021-08-02 23:14:16 +02:00
|
|
|
commands:
|
2022-04-16 14:42:59 +02:00
|
|
|
- go install golang.org/x/lint/golint@latest
|
2021-08-02 23:14:16 +02:00
|
|
|
- golint -set_exit_status ./pkg/...
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
|
|
|
|
- name: vet
|
2022-04-16 14:42:59 +02:00
|
|
|
image: golang:1.18
|
2021-08-02 23:14:16 +02:00
|
|
|
commands:
|
|
|
|
- go vet ./pkg/...
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
2022-04-16 18:57:59 +02:00
|
|
|
|
|
|
|
- name: build_image
|
|
|
|
image: plugins/docker
|
|
|
|
commands:
|
|
|
|
- simple=$(echo $CI_COMMIT_BRANCH | grep '/') ;
|
|
|
|
p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s) &&
|
|
|
|
p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s) &&
|
|
|
|
tag=${simple:-$p1-$p2} &&
|
|
|
|
docker build -t git.pbiernat.dev/golang/vegvisir:$tag -f Dockerfile.build .
|
|
|
|
volumes:
|
|
|
|
- name: docker-sock
|
|
|
|
path: /var/run
|
|
|
|
|
|
|
|
- name: push_image
|
|
|
|
image: plugins/docker
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME:
|
|
|
|
from_secret: registry_username
|
|
|
|
DOCKER_PASSWORD:
|
|
|
|
from_secret: registry_password
|
|
|
|
commands:
|
|
|
|
- simple=$(echo $CI_COMMIT_BRANCH | grep '/') ;
|
|
|
|
p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s) &&
|
|
|
|
p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s) &&
|
|
|
|
tag=${simple:=$p1-$p2} &&
|
|
|
|
echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin &&
|
|
|
|
docker push git.pbiernat.dev/golang/vegvisir:$tag
|
|
|
|
volumes:
|
|
|
|
- name: docker-sock
|
|
|
|
path: /var/run
|
|
|
|
|
|
|
|
services:
|
|
|
|
- name: docker
|
|
|
|
image: docker:dind
|
|
|
|
privileged: true
|
|
|
|
volumes:
|
|
|
|
- name: docker-sock
|
|
|
|
path: /var/run
|
2021-08-02 23:14:16 +02:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
2022-04-16 18:57:59 +02:00
|
|
|
temp: {}
|
|
|
|
- name: docker-sock
|
|
|
|
temp: {}
|