Merge branch 'dev/ci-docker-builder' into develop
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Piotr Biernat 2022-04-17 12:55:30 +02:00
commit 3685ffb4a9

View File

@ -3,38 +3,44 @@ type: docker
name: default name: default
steps: steps:
- name: static_check # - name: static_check
image: golang:1.18 # image: golang:1.18
commands: # commands:
- go install honnef.co/go/tools/cmd/staticcheck@latest # - go install honnef.co/go/tools/cmd/staticcheck@latest
- staticcheck ./pkg/... # - staticcheck ./pkg/...
volumes: # volumes:
- name: gopath # - name: gopath
path: /go # path: /go
- name: lint # - name: lint
image: golang:1.18 # image: golang:1.18
commands: # commands:
- go install golang.org/x/lint/golint@latest # - go install golang.org/x/lint/golint@latest
- golint -set_exit_status ./pkg/... # - golint -set_exit_status ./pkg/...
volumes: # volumes:
- name: gopath # - name: gopath
path: /go # path: /go
- name: vet # - name: vet
image: golang:1.18 # image: golang:1.18
commands: # commands:
- go vet ./pkg/... # - go vet ./pkg/...
volumes: # volumes:
- name: gopath # - name: gopath
path: /go # path: /go
- name: build_image - name: build_image
image: plugins/docker image: plugins/docker
commands: commands:
- p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1) && - echo "develop" | grep -s '/'
p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2) && - echo "develop/fix" | grep -s '/'
docker build -t git.pbiernat.dev/golang/vegvisir:$p1-$p2 -f Dockerfile.build . - echo "develop" | grep -s -v '/'
- echo "develop/fix" | grep -s -v '/'
# - 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: volumes:
- name: docker-sock - name: docker-sock
path: /var/run path: /var/run
@ -47,10 +53,12 @@ steps:
DOCKER_PASSWORD: DOCKER_PASSWORD:
from_secret: registry_password from_secret: registry_password
commands: commands:
- p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1) && - simple=$(echo $CI_COMMIT_BRANCH | grep '/') ;
p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2) && p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s) &&
docker login git.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD && p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s) &&
docker push git.pbiernat.dev/golang/vegvisir:$p1-$p2 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: volumes:
- name: docker-sock - name: docker-sock
path: /var/run path: /var/run