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

View File

@ -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,8 +28,6 @@ steps:
- name: build_develop - name: build_develop
image: plugins/docker image: plugins/docker
commands: commands:
- sleep 5
#- env
- ./scripts/drone-build.sh - ./scripts/drone-build.sh
when: when:
branch: develop branch: develop
@ -49,16 +39,12 @@ 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
# - docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
# - docker push docker.pbiernat.dev/nginx-php:dev
- ./scripts/drone-publish.sh - ./scripts/drone-publish.sh
when: when:
branch: develop branch: develop
@ -71,10 +57,6 @@ steps:
- name: build_feature - name: build_feature
image: plugins/docker image: plugins/docker
commands: 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 - ./scripts/drone-build.sh
when: when:
branch: branch:
@ -89,17 +71,12 @@ steps:
- 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:
# - 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 - ./scripts/drone-publish.sh
when: when:
branch: develop branch: develop
@ -120,3 +97,4 @@ services:
volumes: volumes:
- name: docker-sock - name: docker-sock
temp: {} temp: {}

View File

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

View File

@ -20,13 +20,11 @@ source_branch=$DRONE_SOURCE_BRANCH
docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then
echo "PUSH FEATURE: $source_branch"
docker push docker.pbiernat.dev/nginx-php:$source_branch docker push docker.pbiernat.dev/nginx-php:$source_branch
return 0 return 0
fi fi
if { [ "$branch" = develop ] && [ "$event" = push ]; } ; then if { [ "$branch" = develop ] && [ "$event" = push ]; } ; then
echo "PUSH DEV: $branch"
docker push docker.pbiernat.dev/nginx-php:dev docker push docker.pbiernat.dev/nginx-php:dev
return 0 return 0
fi fi