Compare commits

..

No commits in common. "e5aac8866410efad172e93cf88772ec7308dc23f" and "7f8f91565327d977cf99701fff99efba64b5a566" have entirely different histories.

6 changed files with 67 additions and 58 deletions

View File

@ -3,37 +3,43 @@ 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:
- sleep 5 - env
- ./deploy/build_image.sh - echo $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 $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
@ -46,7 +52,13 @@ steps:
DOCKER_PASSWORD: DOCKER_PASSWORD:
from_secret: registry_password from_secret: registry_password
commands: commands:
- ./deploy/publish_image.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
# - 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

View File

@ -1,15 +0,0 @@
#!/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 .

View File

@ -1,17 +0,0 @@
#!/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 Executable file
View File

@ -0,0 +1,29 @@
#!/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