PR 'feature_cicd_fix' #18

Merged
keedosn merged 2 commits from feature_cicd_fix into develop 2021-11-23 22:47:20 +01:00
3 changed files with 4 additions and 28 deletions
Showing only changes of commit 3f61272b80 - Show all commits

View File

@ -6,10 +6,6 @@ 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:
@ -23,10 +19,6 @@ 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:
@ -36,8 +28,6 @@ steps:
- name: build_develop
image: plugins/docker
commands:
- sleep 5
#- env
- ./scripts/drone-build.sh
when:
branch: develop
@ -49,16 +39,12 @@ steps:
- name: publish_develop
image: plugins/docker
# privileged: true
environment:
DOCKER_USERNAME:
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:dev
- ./scripts/drone-publish.sh
when:
branch: develop
@ -71,10 +57,6 @@ 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}
- ./scripts/drone-build.sh
when:
branch:
@ -89,17 +71,12 @@ steps:
- name: publish_feature
image: plugins/docker
# 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
- ./scripts/drone-publish.sh
when:
branch: develop
@ -120,3 +97,4 @@ services:
volumes:
- name: docker-sock
temp: {}

View File

@ -21,19 +21,19 @@ source_branch=$DRONE_SOURCE_BRANCH
step_name=$DRONE_STEP_NAME
if { contains "$branch" "feature_" && [ "$event" = push ]; } ; then
echo "BUILD FEATURE: $branch"
sleep 5
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"
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
echo "BUILD DEV"
sleep 5
docker build -t docker.pbiernat.dev/nginx-php:dev .
return 0
fi

View File

@ -20,13 +20,11 @@ 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