Merge branch 'dev/ci-docker-builder' into develop
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
commit
7438d94ee1
57
.drone.yml
57
.drone.yml
@ -32,15 +32,13 @@ steps:
|
|||||||
- name: build_image
|
- name: build_image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
commands:
|
commands:
|
||||||
- echo "develop" | grep -s '/'
|
- ./test.sh
|
||||||
- echo "develop/fix" | grep -s '/'
|
# - branch=$(echo $CI_COMMIT_BRANCH | grep -v '/') || echo $CI_COMMIT_BRANCH
|
||||||
- echo "develop" | grep -s -v '/'
|
# - p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s)
|
||||||
- echo "develop/fix" | grep -s -v '/'
|
# - p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s)
|
||||||
# - simple=$(echo $CI_COMMIT_BRANCH | grep '/') ;
|
# - tag=${branch:-$p1-$p2}
|
||||||
# p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s) &&
|
# - echo $tag
|
||||||
# p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s) &&
|
# - docker build -t git.pbiernat.dev/golang/vegvisir:$tag -f Dockerfile.build .
|
||||||
# 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
|
||||||
@ -53,48 +51,11 @@ steps:
|
|||||||
DOCKER_PASSWORD:
|
DOCKER_PASSWORD:
|
||||||
from_secret: registry_password
|
from_secret: registry_password
|
||||||
commands:
|
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: gopath
|
|
||||||
path: /go
|
|
||||||
|
|
||||||
- name: build_image
|
|
||||||
image: plugins/docker
|
|
||||||
commands:
|
|
||||||
- branch=$(echo $CI_COMMIT_BRANCH | grep -v '/') || echo $CI_COMMIT_BRANCH
|
- branch=$(echo $CI_COMMIT_BRANCH | grep -v '/') || echo $CI_COMMIT_BRANCH
|
||||||
- p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s)
|
- p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1 -s)
|
||||||
- p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s)
|
- p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2 -s)
|
||||||
- tag=${branch:-$p1-$p2}
|
- tag=${branch:=$p1-$p2}
|
||||||
- docker build -t git.pbiernat.dev/golang/vegvisir:$tag -f Dockerfile.build .
|
- echo $tag
|
||||||
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 '/') || echo $CI_COMMIT_BRANCH
|
|
||||||
- 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 &&
|
- echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin &&
|
||||||
- docker push git.pbiernat.dev/golang/vegvisir:$tag
|
- docker push git.pbiernat.dev/golang/vegvisir:$tag
|
||||||
volumes:
|
volumes:
|
||||||
|
28
test.sh
Executable file
28
test.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/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