Compare commits

..

No commits in common. "b90b14e2716c879bba5a563b421def9e3039c9c2" and "6bc615549f2945bed757cc0dd3a24efe1dd4327a" have entirely different histories.

3 changed files with 19 additions and 100 deletions

View File

@ -25,8 +25,8 @@ steps:
from_secret: registry_password from_secret: registry_password
commands: commands:
- sleep 5 - sleep 5
# - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
# - docker push docker.pbiernat.dev/nginx-php - docker push docker.pbiernat.dev/nginx-php
when: when:
event: tag event: tag
volumes: volumes:
@ -37,11 +37,12 @@ steps:
image: plugins/docker image: plugins/docker
commands: commands:
- sleep 5 - sleep 5
#- env - docker build -t docker.pbiernat.dev/nginx-php:dev .
- ./scripts/drone-build.sh - 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
@ -49,7 +50,7 @@ steps:
- name: publish_develop - name: publish_develop
image: plugins/docker image: plugins/docker
# privileged: true privileged: true
environment: environment:
DOCKER_USERNAME: DOCKER_USERNAME:
from_secret: registry_username from_secret: registry_username
@ -57,13 +58,12 @@ steps:
from_secret: registry_password from_secret: registry_password
commands: commands:
- sleep 5 - sleep 5
# - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - docker build -t docker.pbiernat.dev/nginx-php:dev .
# - docker push docker.pbiernat.dev/nginx-php:dev - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- ./scripts/drone-publish.sh - docker push docker.pbiernat.dev/nginx-php:dev
when: when:
branch: develop branch: develop
event: event: push
- push
volumes: volumes:
- name: docker-sock - name: docker-sock
path: /var/run path: /var/run
@ -71,40 +71,31 @@ steps:
- name: build_feature - name: build_feature
image: plugins/docker image: plugins/docker
commands: commands:
- env
- sleep 5 - sleep 5
#- docker build -t docker.pbiernat.dev/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} - docker images --format "{{.Repository}}:{{.Tag}}" | grep nginx-php:${CI_COMMIT_BRANCH}
- ./scripts/drone-build.sh
when: when:
branch: branch: feature_*
- feature_* event: push
- 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 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:
# - env
- sleep 5 - sleep 5
#- docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
#- docker push docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH - docker push docker.pbiernat.dev/nginx-php:$CI_COMMIT_BRANCH
- ./scripts/drone-publish.sh
when: when:
branch: develop branch: feature_*
event: event: pull_request
- pull_request
volumes: volumes:
- name: docker-sock - name: docker-sock
path: /var/run path: /var/run

View File

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

View File

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