merge develop #20
45
.drone.yml
45
.drone.yml
@ -25,8 +25,8 @@ steps:
|
||||
from_secret: registry_password
|
||||
commands:
|
||||
- sleep 5
|
||||
- docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
- docker push docker.pbiernat.dev/nginx-php
|
||||
# - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
# - docker push docker.pbiernat.dev/nginx-php
|
||||
when:
|
||||
event: tag
|
||||
volumes:
|
||||
@ -37,12 +37,11 @@ steps:
|
||||
image: plugins/docker
|
||||
commands:
|
||||
- sleep 5
|
||||
- docker build -t docker.pbiernat.dev/nginx-php:dev .
|
||||
- docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:dev
|
||||
#- env
|
||||
- ./scripts/drone-build.sh
|
||||
when:
|
||||
branch: develop
|
||||
event:
|
||||
- pull_request
|
||||
- push
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
@ -50,7 +49,7 @@ steps:
|
||||
|
||||
- name: publish_develop
|
||||
image: plugins/docker
|
||||
privileged: true
|
||||
# privileged: true
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: registry_username
|
||||
@ -58,12 +57,13 @@ steps:
|
||||
from_secret: registry_password
|
||||
commands:
|
||||
- sleep 5
|
||||
- docker build -t docker.pbiernat.dev/nginx-php:dev .
|
||||
- docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
- docker push docker.pbiernat.dev/nginx-php:dev
|
||||
# - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
# - docker push docker.pbiernat.dev/nginx-php:dev
|
||||
- ./scripts/drone-publish.sh
|
||||
when:
|
||||
branch: develop
|
||||
event: push
|
||||
event:
|
||||
- push
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
path: /var/run
|
||||
@ -71,31 +71,40 @@ steps:
|
||||
- name: build_feature
|
||||
image: plugins/docker
|
||||
commands:
|
||||
- env
|
||||
- sleep 5
|
||||
- docker build -t docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH .
|
||||
- docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:${CI_COMMIT_BRANCH}
|
||||
#- docker build -t docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH .
|
||||
#- docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:${CI_COMMIT_BRANCH}
|
||||
- ./scripts/drone-build.sh
|
||||
when:
|
||||
branch: feature_*
|
||||
event: push
|
||||
branch:
|
||||
- feature_*
|
||||
- develop
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
path: /var/run
|
||||
|
||||
- name: publish_feature
|
||||
image: plugins/docker
|
||||
privileged: true
|
||||
# privileged: true
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: registry_username
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: registry_password
|
||||
commands:
|
||||
# - env
|
||||
- sleep 5
|
||||
- docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
- docker push docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH
|
||||
#- docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
#- docker push docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH
|
||||
- ./scripts/drone-publish.sh
|
||||
when:
|
||||
branch: develop
|
||||
event: pull_request
|
||||
event:
|
||||
- pull_request
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
path: /var/run
|
||||
|
BIN
scripts/.drone-build.sh.swp
Normal file
BIN
scripts/.drone-build.sh.swp
Normal file
Binary file not shown.
39
scripts/drone-build.sh
Executable file
39
scripts/drone-build.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
# - docker build -t docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH .
|
||||
# - docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:${CI_COMMIT_BRANCH}
|
||||
|
||||
|
||||
contains() {
|
||||
string="$1"
|
||||
substring="$2"
|
||||
if test "${string#*$substring}" != "$string"
|
||||
then
|
||||
return 0 # $substring is in $string
|
||||
else
|
||||
return 1 # $substring is not in $string
|
||||
fi
|
||||
}
|
||||
|
||||
branch=$CI_COMMIT_BRANCH
|
||||
event=$CI_BUILD_EVENT
|
||||
source_branch=$DRONE_SOURCE_BRANCH
|
||||
|
||||
if { contains "$branch" "feature_" && [ "$event" = push ]; } ; then
|
||||
echo "BUILD FEATURE: $branch"
|
||||
docker build -t docker.pbiernat.dev/nginx-php:$branch .
|
||||
return 0
|
||||
fi
|
||||
|
||||
if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then
|
||||
echo "BUILD FEATURE(FROM DEV): $source_branch"
|
||||
docker build -t docker.pbiernat.dev/nginx-php:$source_branch .
|
||||
return 0
|
||||
fi
|
||||
|
||||
if { [ "$branch" = develop ] && [ "$event" = push ]; } ; then
|
||||
echo "BUILD DEV"
|
||||
docker build -t docker.pbiernat.dev/nginx-php:dev .
|
||||
return 0
|
||||
fi
|
||||
|
33
scripts/drone-publish.sh
Executable file
33
scripts/drone-publish.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
# docker push docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH
|
||||
|
||||
contains() {
|
||||
string="$1"
|
||||
substring="$2"
|
||||
if test "${string#*$substring}" != "$string"
|
||||
then
|
||||
return 0 # $substring is in $string
|
||||
else
|
||||
return 1 # $substring is not in $string
|
||||
fi
|
||||
}
|
||||
|
||||
branch=$CI_COMMIT_BRANCH
|
||||
event=$CI_BUILD_EVENT
|
||||
source_branch=$DRONE_SOURCE_BRANCH
|
||||
|
||||
docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
|
||||
if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then
|
||||
echo "PUSH FEATURE: $source_branch"
|
||||
docker push docker.pbiernat.dev/nginx-php:$source_branch
|
||||
return 0
|
||||
fi
|
||||
|
||||
if { [ "$branch" = develop ] && [ "$event" = push ]; } ; then
|
||||
echo "PUSH DEV: $branch"
|
||||
docker push docker.pbiernat.dev/nginx-php:dev
|
||||
return 0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user