Compare commits
No commits in common. "master" and "feature_test2" have entirely different histories.
master
...
feature_te
45
.drone.yml
45
.drone.yml
@ -6,6 +6,10 @@ name: Build
|
||||
steps:
|
||||
- name: build_release
|
||||
image: plugins/docker
|
||||
commands:
|
||||
- sleep 5
|
||||
- docker build -t docker.pbiernat.dev/nginx-php .
|
||||
- docker images | grep nginx-php
|
||||
when:
|
||||
event: tag
|
||||
volumes:
|
||||
@ -19,6 +23,10 @@ steps:
|
||||
from_secret: registry_username
|
||||
DOCKER_PASSWORD:
|
||||
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
|
||||
when:
|
||||
event: tag
|
||||
volumes:
|
||||
@ -28,10 +36,13 @@ steps:
|
||||
- name: build_develop
|
||||
image: plugins/docker
|
||||
commands:
|
||||
- ./scripts/drone-build.sh
|
||||
- sleep 5
|
||||
- docker build -t docker.pbiernat.dev/nginx-php:dev .
|
||||
- docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:dev
|
||||
when:
|
||||
branch: develop
|
||||
event:
|
||||
- pull_request
|
||||
- push
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
@ -39,17 +50,20 @@ steps:
|
||||
|
||||
- name: publish_develop
|
||||
image: plugins/docker
|
||||
privileged: true
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: registry_username
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: registry_password
|
||||
commands:
|
||||
- ./scripts/drone-publish.sh
|
||||
- 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
|
||||
when:
|
||||
branch: develop
|
||||
event:
|
||||
- push
|
||||
event: push
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
path: /var/run
|
||||
@ -57,31 +71,31 @@ steps:
|
||||
- name: build_feature
|
||||
image: plugins/docker
|
||||
commands:
|
||||
- ./scripts/drone-build.sh
|
||||
- sleep 5
|
||||
- docker build -t docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH .
|
||||
- docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:${CI_COMMIT_BRANCH}
|
||||
when:
|
||||
branch:
|
||||
- feature_*
|
||||
- develop
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
branch: feature_*
|
||||
event: push
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
path: /var/run
|
||||
|
||||
- name: publish_feature
|
||||
image: plugins/docker
|
||||
privileged: true
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: registry_username
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: registry_password
|
||||
commands:
|
||||
- ./scripts/drone-publish.sh
|
||||
- sleep 5
|
||||
- docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
- docker push docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH
|
||||
when:
|
||||
branch: develop
|
||||
event:
|
||||
- pull_request
|
||||
branch: feature_*
|
||||
event: push
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
path: /var/run
|
||||
@ -97,4 +111,3 @@ services:
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
temp: {}
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
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
|
||||
step_name=$DRONE_STEP_NAME
|
||||
|
||||
if { contains "$branch" "feature_" && [ "$event" = push ]; } ; then
|
||||
sleep 5
|
||||
docker build -t docker.pbiernat.dev/nginx-php:$branch .
|
||||
return 0
|
||||
fi
|
||||
|
||||
if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then
|
||||
sleep 5
|
||||
docker build -t docker.pbiernat.dev/nginx-php:$source_branch .
|
||||
return 0
|
||||
fi
|
||||
|
||||
if { [ "$branch" = develop ] && [ "$event" = push ] && [ "$step_name" != build_feature ]; } ; then
|
||||
sleep 5
|
||||
docker build -t docker.pbiernat.dev/nginx-php:dev .
|
||||
return 0
|
||||
fi
|
||||
|
@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
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
|
||||
docker push docker.pbiernat.dev/nginx-php:$source_branch
|
||||
return 0
|
||||
fi
|
||||
|
||||
if { [ "$branch" = develop ] && [ "$event" = push ]; } ; then
|
||||
docker push docker.pbiernat.dev/nginx-php:dev
|
||||
return 0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user