This commit is contained in:
111
.drone.yml
111
.drone.yml
@@ -1,34 +1,95 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: Build and Deploy Pipeline
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
path: /drone/mail-autoconfig
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-and-push
|
- name: Build and Publish Docker Image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
repo: registry.your-gitea.com/your-org/mail-autoconfig
|
auto_tag: true
|
||||||
tags: latest
|
repo: git.mifi.dev/mifi/mail-autoconfig
|
||||||
username:
|
registry: git.mifi.dev
|
||||||
from_secret: GITEA_USERNAME
|
username: <token>
|
||||||
password:
|
password:
|
||||||
from_secret: GITEA_TOKEN
|
from_secret: gitea_package_token
|
||||||
|
secrets: [gitea_package_token]
|
||||||
|
|
||||||
- name: deploy-to-portainer
|
- name: Deploy Container
|
||||||
image: curlimages/curl:7.85.0
|
image: plugins/webhook
|
||||||
environment:
|
settings:
|
||||||
PORTAINER_URL: https://portainer.mail.mifi.holdings
|
urls: ttps://portainer.mifi.dev/api/stacks/webhooks/f7e63722-cafd-4970-8729-9f1936c6a070
|
||||||
PORTAINER_API_KEY:
|
|
||||||
from_secret: PORTAINER_API_KEY
|
- name: Send Deploy Status Notification
|
||||||
ENDPOINT_ID:
|
image: plugins/webhook
|
||||||
from_secret: PORTAINER_ENDPOINT_ID # e.g. "1"
|
settings:
|
||||||
STACK_ID:
|
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||||
from_secret: PORTAINER_STACK_ID # the ID of your mailconfig stack
|
content_type: application/json
|
||||||
commands:
|
template: |
|
||||||
- >
|
{
|
||||||
curl -s -X POST "$PORTAINER_URL/api/stacks/$STACK_ID/file?endpointId=$ENDPOINT_ID&method=string"
|
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
|
||||||
-H "Authorization: Bearer $PORTAINER_API_KEY"
|
"text": "[{{ repo.name }} - Build # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||||
-F "file=@docker-compose.yml"
|
"username":"DroneBot"
|
||||||
|
}
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: dockerconfig
|
||||||
|
host:
|
||||||
|
path: /volume1/docker/dockerconfig.json
|
||||||
|
- name: dockersock
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: Production Deploy Pipeline
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
path: /drone/mail-autoconfig
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy to Production
|
||||||
|
image: plugins/webhook
|
||||||
|
settings:
|
||||||
|
urls: https://portainer.mail.mifi.holdings/api/stacks/webhooks/WEBHOOK_ID_HERE
|
||||||
|
|
||||||
|
- name: Send Production Deploy Status
|
||||||
|
image: plugins/webhook
|
||||||
|
settings:
|
||||||
|
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||||
|
content_type: application/json
|
||||||
|
template: |
|
||||||
|
{
|
||||||
|
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
|
||||||
|
"text": "[{{ repo.name }} - Build # {{ build.number }}] Production Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||||
|
"username":"DroneBot"
|
||||||
|
}
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- Build and Deploy Pipeline
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- production
|
||||||
|
|||||||
Reference in New Issue
Block a user