fsfe-website/.drone.yml
Darragh Elliott 2e59cc52f5
All checks were successful
continuous-integration/drone/pr Build is passing
feat: do a full build when triggered by cron
2025-04-30 15:21:30 +01:00

113 lines
3.6 KiB
YAML

---
kind: pipeline
type: docker
name: default
clone:
depth: 150
steps:
- name: check-python
image: ghcr.io/astral-sh/ruff:latest
command: [ "check", "." ]
- name: check-custom
image: debian:bookworm
commands:
- apt update
# Install required packages
- apt install --yes --no-install-recommends coreutils sed grep libxml2-utils git findutils perl-base file mediainfo curl
# Check whether non-EN news item would appear on front-page
- bash tools/check-non-en-frontpage.sh news
# Run pre-commit checks
- bash tools/githooks/pre-commit ci-pr
# Check syntax for all files as a safety net
- find . -type f \( -iname "*.xhtml" -o -iname "*.xml" -o -iname "*.xsl" \) -exec xmllint --noout {} +
- name: deploy-master
image: docker:27.4.1
environment:
# Environment variables necessary for rootless Docker
XDG_RUNTIME_DIR: "/run/user/1001"
DOCKER_HOST: "unix:///run/user/1001/docker.sock"
# Target bunsen directly, and use ipv4 proxies for noddack and gahn, as ipv6 broken.
TARGET: "www@bunsen.fsfeurope.org:fsfe.org/global/,www@proxy.noris.fsfeurope.org:fsfe.org/global/?10322,www@proxy.plutex.fsfeurope.org:fsfe.org/global/?10322"
KEY_PRIVATE:
from_secret: KEY_PRIVATE
KEY_PASSWORD:
from_secret: KEY_PASSWORD
GIT_TOKEN:
from_secret: BUILD_TOKEN
VOLUME:
website-cached-master
volumes:
# Mounting Docker socket of rootless docker user
- name: dockersock
path: /run/user/1001/docker.sock
commands:
- docker ps && echo "tampered with"
# If we are in a cron job, then do a full rebuild
# Ideally the cron would set the flag itself, but drone does not support that.
- if [ "$DRONE_BUILD_EVENT" = "cron" ]; then EXTRA_FLAGS="--full"; fi
- docker compose -p fsfe-website run --remove-orphans --build build --target "$TARGET" $EXTRA_FLAGS
when:
branch:
- master
event:
exclude:
- pull_request
- name: deploy-test
image: docker:27.4.1
environment:
# Environment variables necessary for rootless Docker
XDG_RUNTIME_DIR: "/run/user/1001"
DOCKER_HOST: "unix:///run/user/1001/docker.sock"
# Target bunsen directly, and use ipv4 proxies for noddack and gahn, as ipv6 broken.
TARGET: "www@bunsen.fsfeurope.org:test.fsfe.org/global/,www@proxy.noris.fsfeurope.org:test.fsfe.org/global/?10322,www@proxy.plutex.fsfeurope.org:test.fsfe.org/global/?10322"
KEY_PRIVATE:
from_secret: KEY_PRIVATE
KEY_PASSWORD:
from_secret: KEY_PASSWORD
GIT_TOKEN:
from_secret: BUILD_TOKEN
volumes:
# Mounting Docker socket of rootless docker user
- name: dockersock
path: /run/user/1001/docker.sock
commands:
- docker ps && echo "tampered with"
# If we are in a cron job, then do a full rebuild
# Ideally the cron would set the flag itself, but drone does not support that.
- if [ "$DRONE_BUILD_EVENT" = "cron" ]; then EXTRA_FLAGS="--full"; fi
- docker compose -p fsfe-website run --remove-orphans --build build --target "$TARGET" $EXTRA_FLAGS
when:
branch:
- test
event:
exclude:
- pull_request
trigger:
branch:
- master
- test
event:
- cron
- custom
- pull_request
- push
node:
cont2: noris
volumes:
# Define Docker socket of rootless docker user
- name: dockersock
host:
path: /run/user/1001/docker.sock
---
kind: signature
hmac: 1f8d1a3a595b66777a095a331964f64d83c9326ce7cc023d6830e15e715a50dc
...