Merge branch 'dev/ci-docker-builder' into develop
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
d84cf47b01
63
.drone.yml
63
.drone.yml
@ -3,42 +3,37 @@ type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
# - name: static_check
|
||||
# image: golang:1.18
|
||||
# commands:
|
||||
# - go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||
# - staticcheck ./pkg/...
|
||||
# volumes:
|
||||
# - name: gopath
|
||||
# path: /go
|
||||
- name: static_check
|
||||
image: golang:1.18
|
||||
commands:
|
||||
- go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||
- staticcheck ./pkg/...
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
# - name: lint
|
||||
# image: golang:1.18
|
||||
# commands:
|
||||
# - go install golang.org/x/lint/golint@latest
|
||||
# - golint -set_exit_status ./pkg/...
|
||||
# volumes:
|
||||
# - name: gopath
|
||||
# path: /go
|
||||
- name: lint
|
||||
image: golang:1.18
|
||||
commands:
|
||||
- go install golang.org/x/lint/golint@latest
|
||||
- golint -set_exit_status ./pkg/...
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
# - name: vet
|
||||
# image: golang:1.18
|
||||
# commands:
|
||||
# - go vet ./pkg/...
|
||||
# volumes:
|
||||
# - name: gopath
|
||||
# path: /go
|
||||
- name: vet
|
||||
image: golang:1.18
|
||||
commands:
|
||||
- go vet ./pkg/...
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
- name: build_image
|
||||
image: plugins/docker
|
||||
commands:
|
||||
- ./test.sh
|
||||
# - branch=$(echo $CI_COMMIT_BRANCH | grep -v '/') || echo $CI_COMMIT_BRANCH
|
||||
# - p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s)
|
||||
# - p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s)
|
||||
# - tag=${branch:-$p1-$p2}
|
||||
# - echo $tag
|
||||
# - docker build -t git.pbiernat.dev/golang/vegvisir:$tag -f Dockerfile.build .
|
||||
- sleep 5
|
||||
- ./deploy/build_image.sh
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
path: /var/run
|
||||
@ -51,13 +46,7 @@ steps:
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: registry_password
|
||||
commands:
|
||||
- branch=$(echo $CI_COMMIT_BRANCH | grep -v '/') || echo $CI_COMMIT_BRANCH
|
||||
- p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s)
|
||||
- p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s)
|
||||
- tag=${branch:=$p1-$p2}
|
||||
- echo $tag
|
||||
- echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin &&
|
||||
- docker push git.pbiernat.dev/golang/vegvisir:$tag
|
||||
- ./deploy/publish_image.sh
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
path: /var/run
|
||||
|
15
deploy/build_image.sh
Executable file
15
deploy/build_image.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# BRANCH="dev/ci-docker-builder"
|
||||
# BRANCH="develop"
|
||||
# BRANCH=$CI_COMMIT_BRANCH
|
||||
|
||||
branch=$(echo $CI_COMMIT_BRANCH | grep -v /) || echo $CI_COMMIT_BRANCH ;
|
||||
p1=$(echo $CI_COMMIT_BRANCH | cut -d / -f1 -s) &&
|
||||
p2=$(echo $CI_COMMIT_BRANCH | cut -d / -f2 -s) &&
|
||||
tag=${branch:=$p1-$p2} &&
|
||||
echo "Building" $tag
|
||||
|
||||
docker build -t git.pbiernat.dev/golang/vegvisir:$tag -f deploy/Dockerfile.build .
|
17
deploy/publish_image.sh
Executable file
17
deploy/publish_image.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# BRANCH="dev/ci-docker-builder"
|
||||
# BRANCH="develop"
|
||||
# BRANCH=$CI_COMMIT_BRANCH
|
||||
|
||||
|
||||
branch=$(echo $CI_COMMIT_BRANCH | grep -v /) || echo $CI_COMMIT_BRANCH ;
|
||||
p1=$(echo $CI_COMMIT_BRANCH | cut -d / -f1 -s) &&
|
||||
p2=$(echo $CI_COMMIT_BRANCH | cut -d / -f2 -s) &&
|
||||
tag=${branch:=$p1-$p2} &&
|
||||
echo "Publishing" $tag
|
||||
|
||||
echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin &&
|
||||
docker push git.pbiernat.dev/golang/vegvisir:$tag
|
28
test.sh
28
test.sh
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# BRANCH="dev/ci-docker-builder"
|
||||
BRANCH="develop"
|
||||
|
||||
simple=$(echo $BRANCH | grep -v '/') || echo $BRANCH
|
||||
p1=$(echo $BRANCH | cut -d '/' -f1 -s)
|
||||
p2=$(echo $BRANCH | cut -d '/' -f2 -s)
|
||||
tag=${simple:-$p1-$p2}
|
||||
echo $tag
|
||||
|
||||
# p1=$(echo "develop" | grep -s '/') && echo "1: $p1"
|
||||
# p2=$(echo "develop/fix" | grep -s '/') && echo "2: $p2"
|
||||
# p3=$(echo "develop" | grep -s -v '/') && echo "3: $p3"
|
||||
# p4=$(echo "develop/fix" | grep -s -v '/') && echo "4: $p4"
|
||||
|
||||
# echo $p1 $p2 $p3 $p4
|
||||
# echo "DONE"
|
||||
|
||||
|
||||
#simple=$(echo $BRANCH | grep -v '/') ;
|
||||
#p1=$(echo $BRANCH | cut -d '/' -f1 -s) ;
|
||||
#p2=$(echo $BRANCH | cut -d '/' -f2 -s) ;
|
||||
#tag=${simple:=$p1-$p2} &&
|
||||
|
||||
#echo "TAG:" $tag
|
Loading…
Reference in New Issue
Block a user