surtur
9ec93b4352
All checks were successful
continuous-integration/drone/push Build is passing
there was an issue where https://git.dotya.ml/dotya.ml/homepage containers were getting orphaned when this project was deployed. messages like the following were printed: Removing orphan container "src_homepage_2" Removing orphan container "src_homepage_4" Removing orphan container "src_reverse-proxy_1" Removing orphan container "src_homepage_3" Removing orphan container "src_homepage_1" The author of the accepted answer of a related SO thread links to docker-compose documentation, explaining how setting a project variable should resolve this. the COMPOSE_PROJECT_NAME environment variable is likely the same for both projects in question here (homepage and docs) as they're both being deployed by drone from the /drone/src directory, which is also set by drone as the WORKDIR). basename - here src - is used as the project name if not specified otherwise. to conclude, running both [compose deployments] with a unique project name should fix the issue. refs: https://stackoverflow.com/a/59173539 https://docs.docker.com/compose/reference/overview/#use--p-to-specify-a-project-name https://docs.docker.com/compose/reference/envvars/#compose_project_name fix #1
164 lines
3.0 KiB
YAML
164 lines
3.0 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: pull
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
trigger:
|
|
event:
|
|
exclude: [push, pull_request]
|
|
|
|
steps:
|
|
- name: fedora-hugo
|
|
pull: always
|
|
image: immawanderer/fedora-hugo:latest
|
|
commands:
|
|
- uname -r
|
|
- cat /etc/fedora-release
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: build
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
trigger:
|
|
branch: master
|
|
event: [push, pull_request]
|
|
|
|
depends_on:
|
|
- pull
|
|
|
|
steps:
|
|
- name: hugo-extended
|
|
pull: if-not-exists
|
|
image: immawanderer/fedora-hugo:latest
|
|
commands:
|
|
- git submodule init
|
|
- git submodule update
|
|
- hugo version
|
|
- hugo --gc=true --minify
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
event:
|
|
exclude: [pull_request, tag]
|
|
|
|
environment:
|
|
# ref: https://www.docker.com/blog/faster-builds-in-compose-thanks-to-buildkit-support/
|
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
node:
|
|
r: main
|
|
|
|
depends_on:
|
|
- build
|
|
|
|
steps:
|
|
- name: hugo-extended
|
|
pull: if-not-exists
|
|
image: immawanderer/fedora-hugo:latest
|
|
commands:
|
|
- git submodule init
|
|
- git submodule update
|
|
- hugo version
|
|
- hugo --gc=true --minify
|
|
|
|
- name: rm-intermediate
|
|
pull: if-not-exists
|
|
image: immawanderer/fedora-hugo:latest
|
|
depends_on:
|
|
- hugo-extended
|
|
commands:
|
|
- rm -rf ./public
|
|
|
|
- name: build
|
|
pull: always
|
|
image: tmaier/docker-compose:latest
|
|
depends_on:
|
|
- rm-intermediate
|
|
volumes:
|
|
- name: s
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- docker-compose build --no-cache
|
|
when:
|
|
branch: master
|
|
status: success
|
|
|
|
- name: deploy
|
|
pull: always
|
|
image: tmaier/docker-compose:latest
|
|
depends_on:
|
|
- build
|
|
volumes:
|
|
- name: s
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- docker-compose up -d --remove-orphans -p ${DRONE_REPO_NAME}
|
|
when:
|
|
branch: master
|
|
status: success
|
|
|
|
volumes:
|
|
- name: s
|
|
host:
|
|
path: /var/run/docker.sock
|
|
|
|
---
|
|
kind: pipeline
|
|
name: notifications
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
trigger:
|
|
branch: master
|
|
event: [push, tag, pull_request]
|
|
status: [success, failure]
|
|
|
|
depends_on: [build]
|
|
|
|
steps:
|
|
- name: discord
|
|
pull: if-not-exists
|
|
image: appleboy/drone-discord:latest
|
|
settings:
|
|
message: >
|
|
{{#success build.status}}
|
|
✅ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` succeeded.
|
|
event: **`{{build.event}}`**
|
|
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
|
|
{{else}}
|
|
❌ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.
|
|
event: **`${DRONE_BUILD_EVENT}`**
|
|
failed stage(s): **`${DRONE_FAILED_STAGES}`**
|
|
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
|
|
```{{commit.message}}```
|
|
{{/success}}
|
|
webhook_id:
|
|
from_secret: discord_webhook_id
|
|
webhook_token:
|
|
from_secret: discord_webhook_token
|
|
|