Compare commits
19 Commits
feature_te
...
master
Author | SHA1 | Date | |
---|---|---|---|
1180a2a1bf | |||
dc20068bc8 | |||
f8f8388665 | |||
cb28a8b31a | |||
3bc5132764 | |||
3f61272b80 | |||
f9f6cbc02a | |||
89683874f4 | |||
1b7028562c | |||
f254ef8eba | |||
ec29e7f7fe | |||
bb03f89057 | |||
b90b14e271 | |||
065735999d | |||
197cfeba33 | |||
6bc615549f | |||
d8ce78bf0e | |||
1ed108bef3 | |||
b674704a31 |
45
.drone.yml
45
.drone.yml
@ -6,10 +6,6 @@ name: Build
|
|||||||
steps:
|
steps:
|
||||||
- name: build_release
|
- name: build_release
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
commands:
|
|
||||||
- sleep 5
|
|
||||||
- docker build -t docker.pbiernat.dev/nginx-php .
|
|
||||||
- docker images | grep nginx-php
|
|
||||||
when:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
volumes:
|
volumes:
|
||||||
@ -23,10 +19,6 @@ steps:
|
|||||||
from_secret: registry_username
|
from_secret: registry_username
|
||||||
DOCKER_PASSWORD:
|
DOCKER_PASSWORD:
|
||||||
from_secret: registry_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:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
volumes:
|
volumes:
|
||||||
@ -36,13 +28,10 @@ steps:
|
|||||||
- name: build_develop
|
- name: build_develop
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
commands:
|
commands:
|
||||||
- sleep 5
|
- ./scripts/drone-build.sh
|
||||||
- docker build -t docker.pbiernat.dev/nginx-php:dev .
|
|
||||||
- docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:dev
|
|
||||||
when:
|
when:
|
||||||
branch: develop
|
branch: develop
|
||||||
event:
|
event:
|
||||||
- pull_request
|
|
||||||
- push
|
- push
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker-sock
|
- name: docker-sock
|
||||||
@ -50,20 +39,17 @@ steps:
|
|||||||
|
|
||||||
- name: publish_develop
|
- name: publish_develop
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
privileged: true
|
|
||||||
environment:
|
environment:
|
||||||
DOCKER_USERNAME:
|
DOCKER_USERNAME:
|
||||||
from_secret: registry_username
|
from_secret: registry_username
|
||||||
DOCKER_PASSWORD:
|
DOCKER_PASSWORD:
|
||||||
from_secret: registry_password
|
from_secret: registry_password
|
||||||
commands:
|
commands:
|
||||||
- sleep 5
|
- ./scripts/drone-publish.sh
|
||||||
- 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:
|
when:
|
||||||
branch: develop
|
branch: develop
|
||||||
event: push
|
event:
|
||||||
|
- push
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker-sock
|
- name: docker-sock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
@ -71,31 +57,31 @@ steps:
|
|||||||
- name: build_feature
|
- name: build_feature
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
commands:
|
commands:
|
||||||
- sleep 5
|
- ./scripts/drone-build.sh
|
||||||
- docker build -t docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH .
|
|
||||||
- docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:${CI_COMMIT_BRANCH}
|
|
||||||
when:
|
when:
|
||||||
branch: feature_*
|
branch:
|
||||||
event: push
|
- feature_*
|
||||||
|
- develop
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker-sock
|
- name: docker-sock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
|
|
||||||
- name: publish_feature
|
- name: publish_feature
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
privileged: true
|
|
||||||
environment:
|
environment:
|
||||||
DOCKER_USERNAME:
|
DOCKER_USERNAME:
|
||||||
from_secret: registry_username
|
from_secret: registry_username
|
||||||
DOCKER_PASSWORD:
|
DOCKER_PASSWORD:
|
||||||
from_secret: registry_password
|
from_secret: registry_password
|
||||||
commands:
|
commands:
|
||||||
- sleep 5
|
- ./scripts/drone-publish.sh
|
||||||
- docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
|
||||||
- docker push docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH
|
|
||||||
when:
|
when:
|
||||||
branch: feature_*
|
branch: develop
|
||||||
event: push
|
event:
|
||||||
|
- pull_request
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker-sock
|
- name: docker-sock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
@ -111,3 +97,4 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- name: docker-sock
|
- name: docker-sock
|
||||||
temp: {}
|
temp: {}
|
||||||
|
|
||||||
|
36
scripts/drone-build.sh
Executable file
36
scripts/drone-build.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/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
|
||||||
|
|
29
scripts/drone-publish.sh
Executable file
29
scripts/drone-publish.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/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