merge dev/ci-docker-builder
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
e5aac88664
64
.drone.yml
64
.drone.yml
@ -3,43 +3,37 @@ 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:
|
||||||
- env
|
- sleep 5
|
||||||
- echo $CI_COMMIT_BRANCH ;branch=$(echo $CI_COMMIT_BRANCH | grep -v /) || echo $CI_COMMIT_BRANCH ;
|
- ./deploy/build_image.sh
|
||||||
p1=$(echo $CI_COMMIT_BRANCH | cut -d / -f1 -s) &&
|
|
||||||
p2=$(echo $CI_COMMIT_BRANCH | cut -d / -f2 -s) &&
|
|
||||||
tag=${branch:=$p1-$p2} &&
|
|
||||||
echo $tag
|
|
||||||
- ./test.sh
|
|
||||||
# - 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
|
||||||
@ -52,13 +46,7 @@ steps:
|
|||||||
DOCKER_PASSWORD:
|
DOCKER_PASSWORD:
|
||||||
from_secret: registry_password
|
from_secret: registry_password
|
||||||
commands:
|
commands:
|
||||||
- branch=$(echo $CI_COMMIT_BRANCH | grep -v '/') || echo $CI_COMMIT_BRANCH
|
- ./deploy/publish_image.sh
|
||||||
- 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
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker-sock
|
- name: docker-sock
|
||||||
path: /var/run
|
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
|
29
test.sh
29
test.sh
@ -1,29 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# set -e
|
|
||||||
# set -x
|
|
||||||
|
|
||||||
# BRANCH="dev/ci-docker-builder"
|
|
||||||
# BRANCH="develop"
|
|
||||||
BRANCH=$CI_COMMIT_BRANCH
|
|
||||||
|
|
||||||
branch=$(echo $BRANCH | grep -v /) || echo $BRANCH ;
|
|
||||||
p1=$(echo $BRANCH | cut -d / -f1 -s) &&
|
|
||||||
p2=$(echo $BRANCH | cut -d / -f2 -s) &&
|
|
||||||
tag=${branch:=$p1-$p2} &&
|
|
||||||
echo "tag:" $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