chore(ci): Streamline Drone CI configuration
All checks were successful
continuous-integration/drone/push Build is passing

This change simplifies the Drone CI configuration by removing redundant
steps and environment variables, enhancing the tagging strategy for
Docker images, and improving SSH key handling during deployment. Without
this change, the CI pipeline would be more complex and less efficient,
with potential issues in Docker image tagging and SSH key management.

- Remove unused 'environment' field from 'debug'

Signed-off-by: Glenn <glenux@glenux.net>
This commit is contained in:
Glenn Y. Rolland 2025-03-20 23:08:11 +01:00
parent fde03cba6f
commit c1848d6089

View file

@ -6,8 +6,6 @@ name: default
steps: steps:
- name: debug - name: debug
image: alpine image: alpine
environment:
commands: commands:
- 'echo "Repository: glenux/service-monica"' - 'echo "Repository: glenux/service-monica"'
- 'echo "Git commit: ${DRONE_COMMIT_SHA:0:8}"' - 'echo "Git commit: ${DRONE_COMMIT_SHA:0:8}"'
@ -25,24 +23,12 @@ steps:
from_secret: DOCKERHUB_USERNAME from_secret: DOCKERHUB_USERNAME
password: password:
from_secret: DOCKERHUB_PASSWORD from_secret: DOCKERHUB_PASSWORD
cache_from: "glenux/service-monica:latest_${DRONE_BRANCH/\\//-}" cache_from: "glenux/service-monica:${DRONE_BRANCH/\\//-}_latest"
repo: glenux/service-monica repo: glenux/service-monica
tags: "${DRONE_COMMIT_SHA:0:8}" tags:
purge: false - "${DRONE_BRANCH/\\//-}_${DRONE_COMMIT_SHA:0:8}"
- "${DRONE_BRANCH/\\//-}_latest"
- name: publish:commit_branch - "latest"
image: plugins/docker
# volumes:
# - name: cache
# path: /stupid
settings:
username:
from_secret: DOCKERHUB_USERNAME
password:
from_secret: DOCKERHUB_PASSWORD
cache_from: "glenux/service-monica:latest_${DRONE_BRANCH/\\//-}"
repo: glenux/service-monica
tags: "latest_${DRONE_BRANCH/\\//-}"
purge: false purge: false
when: when:
branch: branch:
@ -50,21 +36,6 @@ steps:
- "develop" - "develop"
- "feature/*" - "feature/*"
- name: publish:latest
image: plugins/docker
settings:
username:
from_secret: DOCKERHUB_USERNAME
password:
from_secret: DOCKERHUB_PASSWORD
cache_from: "glenux/service-monica:latest_${DRONE_BRANCH/\\//-}"
repo: glenux/service-monica
tags: latest
purge: false
when:
branch:
- master
- name: deploy:dokku - name: deploy:dokku
image: alpine image: alpine
when: when:
@ -85,12 +56,15 @@ steps:
- mkdir -p ~/.ssh && chmod 700 ~/.ssh - mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo "$SSH_PRIVATE_KEY" | base64 -d > ~/.ssh/deploy_key - echo "$SSH_PRIVATE_KEY" | base64 -d > ~/.ssh/deploy_key
- chmod 600 ~/.ssh/deploy_key - chmod 600 ~/.ssh/deploy_key
- | - ssh-keygen -f ~/.ssh/deploy_key -y > ~/.ssh/deploy_key.pub
ssh -o StrictHostKeyChecking=no \ - "cat ~/.ssh/deploy_key.pub | cut -f3 -d' '"
-i ~/.ssh/deploy_key \ - ssh -o StrictHostKeyChecking=no
"$SSH_USER@$SSH_HOST" \ -i ~/.ssh/deploy_key
git:from-image prm \ "$SSH_USER@$SSH_HOST"
"glenux/service-monica:${DRONE_COMMIT_SHA:0:8}" git:from-image prm
"glenux/service-monica:${DRONE_BRANCH/\\//-}_${DRONE_COMMIT_SHA:0:8}"
#
- echo "SUCCESS"
# volumes: # volumes:
# - name: cache # - name: cache