chore(ci): Streamline Drone CI configuration

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