2020-03-02 20:30:25 +01:00
|
|
|
---
|
2020-02-28 00:54:16 +01:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2020-07-13 16:30:09 +02:00
|
|
|
name: pull
|
|
|
|
|
|
|
|
clone:
|
|
|
|
disable: true
|
|
|
|
|
2020-10-03 21:00:19 +02:00
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
exclude: [push, pull_request]
|
|
|
|
|
2020-02-28 00:54:16 +01:00
|
|
|
steps:
|
2022-03-20 20:15:28 +01:00
|
|
|
- name: fedora-hugo
|
|
|
|
pull: always
|
2022-03-20 20:33:55 +01:00
|
|
|
image: immawanderer/fedora-hugo:linux-amd64
|
2022-03-20 20:15:28 +01:00
|
|
|
commands:
|
|
|
|
- uname -r
|
|
|
|
- cat /etc/fedora-release
|
|
|
|
|
|
|
|
- name: alpine-rsync
|
|
|
|
pull: always
|
|
|
|
image: immawanderer/alpine-rsync:latest
|
|
|
|
commands:
|
|
|
|
- uname -r
|
|
|
|
|
|
|
|
- name: hadolint
|
|
|
|
pull: always
|
2022-08-08 16:35:20 +02:00
|
|
|
image: hadolint/hadolint:2.10.0-alpine
|
2022-03-20 20:15:28 +01:00
|
|
|
commands:
|
|
|
|
- uname -r
|
|
|
|
- hadolint --version
|
2020-07-13 16:34:10 +02:00
|
|
|
|
2022-08-08 15:20:50 +02:00
|
|
|
- name: golang
|
|
|
|
pull: always
|
|
|
|
image: docker.io/library/golang:1.18.5-alpine3.16
|
|
|
|
commands:
|
|
|
|
- uname -r
|
|
|
|
- go version
|
|
|
|
|
2020-07-13 16:30:09 +02:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2020-09-25 20:57:33 +02:00
|
|
|
name: build
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
2020-07-13 16:30:09 +02:00
|
|
|
|
2020-10-03 21:00:19 +02:00
|
|
|
trigger:
|
|
|
|
branch: [master, testing]
|
|
|
|
event: pull_request
|
|
|
|
|
2020-07-13 16:30:09 +02:00
|
|
|
depends_on:
|
2022-03-20 20:15:28 +01:00
|
|
|
- pull
|
2020-07-13 16:30:09 +02:00
|
|
|
|
2022-08-08 15:20:50 +02:00
|
|
|
environment:
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
|
2020-07-13 16:30:09 +02:00
|
|
|
steps:
|
2022-03-20 20:15:28 +01:00
|
|
|
- name: hugo-extended
|
|
|
|
pull: if-not-exists
|
2022-03-20 20:33:55 +01:00
|
|
|
image: immawanderer/fedora-hugo:linux-amd64
|
2022-03-20 20:15:28 +01:00
|
|
|
commands:
|
|
|
|
- git submodule init
|
|
|
|
- git submodule update
|
|
|
|
- hugo version
|
|
|
|
- hugo --gc=true --minify
|
2020-09-25 20:57:33 +02:00
|
|
|
|
2022-08-08 15:20:50 +02:00
|
|
|
- name: go fmt
|
|
|
|
image: docker.io/library/golang:1.18.5-alpine3.16
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
depends_on:
|
|
|
|
- clone
|
|
|
|
commands:
|
|
|
|
- go fmt
|
|
|
|
|
|
|
|
- name: go vet
|
|
|
|
image: docker.io/library/golang:1.18.5-alpine3.16
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
depends_on:
|
|
|
|
- go fmt
|
|
|
|
commands:
|
|
|
|
- go vet
|
|
|
|
|
|
|
|
- name: go build
|
|
|
|
pull: if-not-exists
|
|
|
|
image: docker.io/library/golang:1.18.5-alpine3.16
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
depends_on:
|
|
|
|
- go vet
|
|
|
|
# wait until the site is output into './public'.
|
|
|
|
- hugo-extended
|
|
|
|
commands:
|
|
|
|
- go build -v -ldflags "-s -w -X main.Version=${DRONE_COMMIT}" .
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
temp: {}
|
|
|
|
|
|
|
|
|
2020-10-03 21:00:19 +02:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: docker-compose-build
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch: master
|
|
|
|
event: pull_request
|
|
|
|
|
|
|
|
depends_on:
|
2022-03-20 20:15:28 +01:00
|
|
|
- build
|
2020-10-03 21:00:19 +02:00
|
|
|
|
|
|
|
steps:
|
2022-03-20 20:15:28 +01:00
|
|
|
- name: hadolint
|
2022-08-08 16:35:20 +02:00
|
|
|
image: hadolint/hadolint:v2.10.0-alpine
|
2022-03-20 20:15:28 +01:00
|
|
|
commands:
|
|
|
|
- hadolint --version
|
|
|
|
- hadolint Dockerfile
|
|
|
|
|
|
|
|
- name: build
|
|
|
|
pull: always
|
|
|
|
image: tmaier/docker-compose:latest
|
|
|
|
volumes:
|
|
|
|
- name: s
|
|
|
|
path: /var/run/docker.sock
|
|
|
|
environment:
|
|
|
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
|
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
commands:
|
2022-08-08 16:51:03 +02:00
|
|
|
- docker-compose build --build-arg VCS_REF=${DRONE_COMMIT} --no-cache --pull
|
2020-10-03 21:00:19 +02:00
|
|
|
|
|
|
|
volumes:
|
2022-03-20 20:15:28 +01:00
|
|
|
- name: s
|
|
|
|
host:
|
|
|
|
path: /var/run/docker.sock
|
2020-10-03 21:00:19 +02:00
|
|
|
|
2020-09-25 20:57:33 +02:00
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2020-10-03 21:00:19 +02:00
|
|
|
name: deploy-staging
|
2020-09-25 20:57:33 +02:00
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
trigger:
|
2020-10-03 16:00:49 +02:00
|
|
|
branch:
|
2022-03-20 20:15:28 +01:00
|
|
|
- testing
|
2020-09-25 20:57:33 +02:00
|
|
|
event:
|
2020-10-03 21:00:19 +02:00
|
|
|
exclude: [pull_request, tag]
|
2020-09-25 20:57:33 +02:00
|
|
|
|
|
|
|
depends_on:
|
2022-03-20 20:15:28 +01:00
|
|
|
- build
|
2020-09-25 20:57:33 +02:00
|
|
|
|
|
|
|
steps:
|
2022-03-20 20:15:28 +01:00
|
|
|
- name: hugo-extended
|
|
|
|
pull: if-not-exists
|
2022-03-20 20:33:55 +01:00
|
|
|
image: immawanderer/fedora-hugo:linux-amd64
|
2022-03-20 20:15:28 +01:00
|
|
|
commands:
|
|
|
|
- git submodule init
|
|
|
|
- git submodule update
|
|
|
|
- hugo version
|
|
|
|
- hugo --gc=true --minify
|
|
|
|
|
|
|
|
- name: deploy
|
|
|
|
pull: if-not-exists
|
2022-03-20 22:04:56 +01:00
|
|
|
image: alpine:3.15.0
|
2022-03-20 20:15:28 +01:00
|
|
|
when:
|
|
|
|
status:
|
|
|
|
- success
|
|
|
|
branch:
|
|
|
|
- testing
|
|
|
|
depends_on:
|
|
|
|
- hugo-extended
|
|
|
|
environment:
|
|
|
|
OL:
|
|
|
|
from_secret: hugo_user
|
|
|
|
OL_P:
|
|
|
|
from_secret: hugo_passwd
|
|
|
|
OL_D:
|
|
|
|
from_secret: hugo_dir
|
|
|
|
commands:
|
2022-03-20 22:04:56 +01:00
|
|
|
- apk update
|
|
|
|
- apk -U upgrade --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
|
|
|
|
- apk add --no-cache ca-certificates rsync openssh-client sshpass --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
|
2022-03-20 20:15:28 +01:00
|
|
|
- echo $OL_P > nupass
|
|
|
|
- export RSYNC_RSH='sshpass -f ./nupass ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
|
|
|
|
- rsync -av --delete --chown $OL public/ $OL@dotya.ml:$OL_D
|
2020-03-10 01:24:45 +01:00
|
|
|
|
|
|
|
|
2020-10-03 21:00:19 +02:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: deploy
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch:
|
2022-03-20 20:15:28 +01:00
|
|
|
- master
|
2020-10-03 21:00:19 +02:00
|
|
|
event:
|
|
|
|
exclude: [pull_request, tag]
|
|
|
|
|
2021-03-09 10:17:14 +01:00
|
|
|
environment:
|
|
|
|
# ref: https://www.docker.com/blog/faster-builds-in-compose-thanks-to-buildkit-support/
|
|
|
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
|
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
|
2020-10-15 16:43:29 +02:00
|
|
|
node:
|
|
|
|
r: main
|
|
|
|
|
2020-10-03 21:00:19 +02:00
|
|
|
depends_on:
|
2022-03-20 20:15:28 +01:00
|
|
|
- build
|
2020-10-03 21:00:19 +02:00
|
|
|
|
2022-08-08 15:20:50 +02:00
|
|
|
environment:
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
|
2020-10-03 21:00:19 +02:00
|
|
|
steps:
|
2022-03-20 20:15:28 +01:00
|
|
|
- name: hugo-extended
|
|
|
|
pull: if-not-exists
|
2022-03-20 20:33:55 +01:00
|
|
|
image: immawanderer/fedora-hugo:linux-amd64
|
2022-03-20 20:15:28 +01:00
|
|
|
commands:
|
|
|
|
- git submodule init
|
|
|
|
- git submodule update
|
|
|
|
- hugo version
|
|
|
|
- hugo --gc=true --minify
|
|
|
|
|
2022-03-20 20:18:45 +01:00
|
|
|
- name: hadolint
|
2022-08-08 16:35:20 +02:00
|
|
|
image: hadolint/hadolint:v2.10.0-alpine
|
2022-03-20 20:18:45 +01:00
|
|
|
depends_on:
|
|
|
|
- clone
|
|
|
|
commands:
|
|
|
|
- hadolint --version
|
|
|
|
- hadolint Dockerfile
|
|
|
|
|
2022-08-08 15:20:50 +02:00
|
|
|
- name: go fmt
|
|
|
|
image: docker.io/library/golang:1.18.5-alpine3.16
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
depends_on:
|
|
|
|
- clone
|
|
|
|
commands:
|
|
|
|
- go fmt
|
|
|
|
|
|
|
|
- name: go vet
|
|
|
|
image: docker.io/library/golang:1.18.5-alpine3.16
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
depends_on:
|
|
|
|
- go fmt
|
2022-08-08 15:27:27 +02:00
|
|
|
# wait until the site is output into './public'.
|
|
|
|
- hugo-extended
|
2022-08-08 15:20:50 +02:00
|
|
|
commands:
|
|
|
|
- go vet
|
|
|
|
|
|
|
|
- name: go build
|
|
|
|
image: docker.io/library/golang:1.18.5-alpine3.16
|
|
|
|
volumes:
|
|
|
|
- name: gopath
|
|
|
|
path: /go
|
|
|
|
depends_on:
|
|
|
|
- go vet
|
|
|
|
commands:
|
|
|
|
- go build -v -ldflags "-s -w -X main.Version=${DRONE_COMMIT}" .
|
|
|
|
|
2022-08-08 15:27:27 +02:00
|
|
|
- name: rm-intermediate
|
|
|
|
pull: if-not-exists
|
|
|
|
image: immawanderer/fedora-hugo:linux-amd64
|
|
|
|
depends_on:
|
|
|
|
- go build
|
|
|
|
commands:
|
|
|
|
- rm -rf ./public
|
|
|
|
|
2022-03-20 20:15:28 +01:00
|
|
|
- name: build
|
|
|
|
pull: always
|
|
|
|
image: tmaier/docker-compose:latest
|
|
|
|
depends_on:
|
|
|
|
- rm-intermediate
|
2022-03-20 20:18:45 +01:00
|
|
|
- hadolint
|
2022-08-08 15:20:50 +02:00
|
|
|
- go fmt
|
|
|
|
- go vet
|
|
|
|
- go build
|
2022-03-20 20:15:28 +01:00
|
|
|
volumes:
|
|
|
|
- name: s
|
|
|
|
path: /var/run/docker.sock
|
|
|
|
commands:
|
2022-08-08 16:51:03 +02:00
|
|
|
- docker-compose build --build-arg VCS_REF=${DRONE_COMMIT} --no-cache
|
2022-03-20 20:15:28 +01:00
|
|
|
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 -p ${DRONE_REPO_NAME} up -d --remove-orphans --scale homepage=4
|
|
|
|
when:
|
|
|
|
branch: master
|
|
|
|
status: success
|
2020-10-03 21:00:19 +02:00
|
|
|
|
|
|
|
volumes:
|
2022-03-20 20:15:28 +01:00
|
|
|
- name: s
|
|
|
|
host:
|
|
|
|
path: /var/run/docker.sock
|
2022-08-08 15:20:50 +02:00
|
|
|
- name: gopath
|
|
|
|
temp: {}
|
2020-10-03 21:00:19 +02:00
|
|
|
|
|
|
|
|
2020-03-02 20:25:56 +01:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
name: notifications
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
clone:
|
|
|
|
disable: true
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch:
|
2022-03-20 20:15:28 +01:00
|
|
|
- master
|
|
|
|
- testing
|
2020-03-02 20:25:56 +01:00
|
|
|
event:
|
2022-03-20 20:15:28 +01:00
|
|
|
- push
|
|
|
|
- tag
|
2020-03-02 20:25:56 +01:00
|
|
|
status:
|
2022-03-20 20:15:28 +01:00
|
|
|
- success
|
|
|
|
- failure
|
2020-03-02 20:25:56 +01:00
|
|
|
|
2020-10-03 21:00:19 +02:00
|
|
|
depends_on: [deploy, deploy-staging]
|
2020-03-08 05:11:26 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: discord
|
2020-04-22 11:57:51 +02:00
|
|
|
pull: if-not-exists
|
|
|
|
image: appleboy/drone-discord:latest
|
2020-03-08 05:11:26 +01:00
|
|
|
settings:
|
2020-06-10 15:15:42 +02:00
|
|
|
message: >
|
2020-07-09 12:51:43 +02:00
|
|
|
{{#success build.status}}
|
2020-06-10 15:15:42 +02:00
|
|
|
✅ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` has been successfully deployed.
|
|
|
|
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 to deploy.
|
|
|
|
event: **`${DRONE_BUILD_EVENT}`**
|
2020-07-09 09:38:50 +02:00
|
|
|
failed stage(s): **`${DRONE_FAILED_STAGES}`**
|
2020-06-10 15:15:42 +02:00
|
|
|
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
|
2020-07-09 09:38:50 +02:00
|
|
|
```{{commit.message}}```
|
2020-06-10 15:15:42 +02:00
|
|
|
{{/success}}
|
2020-03-08 05:11:26 +01:00
|
|
|
webhook_id:
|
|
|
|
from_secret: discord_webhook_id
|
|
|
|
webhook_token:
|
|
|
|
from_secret: discord_webhook_token
|
2020-04-22 11:41:28 +02:00
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
2020-07-09 09:38:50 +02:00
|
|
|
name: notifications-cron
|
2020-04-22 11:41:28 +02:00
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
clone:
|
|
|
|
disable: true
|
|
|
|
|
|
|
|
trigger:
|
2020-10-03 22:41:21 +02:00
|
|
|
event: cron
|
|
|
|
cron: [hourly, nightly]
|
|
|
|
status: [success, failure]
|
2020-04-22 11:41:28 +02:00
|
|
|
|
2020-10-03 22:44:03 +02:00
|
|
|
depends_on: [deploy]
|
2020-04-22 11:41:28 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: discord
|
|
|
|
pull: always
|
2020-04-22 11:57:51 +02:00
|
|
|
image: appleboy/drone-discord:latest
|
2020-04-22 11:41:28 +02:00
|
|
|
settings:
|
2020-06-10 15:15:42 +02:00
|
|
|
message: >
|
|
|
|
{{#success build.status}}
|
2020-10-03 22:41:21 +02:00
|
|
|
✅ [Cron build #{{build.number}}]({{build.link}}) of `{{repo.name}}` has been successfully deployed.
|
2020-06-10 15:15:42 +02:00
|
|
|
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}}
|
2020-10-03 22:41:21 +02:00
|
|
|
❌ [Cron build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed to deploy.
|
2020-06-10 15:15:42 +02:00
|
|
|
event: **`${DRONE_BUILD_EVENT}`**
|
2020-07-09 09:38:50 +02:00
|
|
|
failed stage(s): **`${DRONE_FAILED_STAGES}`**
|
2020-06-10 15:15:42 +02:00
|
|
|
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
|
2020-07-09 09:38:50 +02:00
|
|
|
```{{commit.message}}```
|
2020-06-10 15:15:42 +02:00
|
|
|
{{/success}}
|
2020-04-22 11:41:28 +02:00
|
|
|
webhook_id:
|
|
|
|
from_secret: discord_webhook_hourly_id
|
|
|
|
webhook_token:
|
|
|
|
from_secret: discord_webhook_hourly_token
|