2023-02-17 14:19:49 +00:00
|
|
|
---
|
2023-02-17 14:48:16 +00:00
|
|
|
# ----------------------------------------------
|
|
|
|
# -- Build the site and push it to the registry
|
|
|
|
# ----------------------------------------------
|
2023-02-17 14:19:49 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
|
|
|
name: Build badhouseplants.net
|
|
|
|
|
2023-02-17 14:48:16 +00:00
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
|
2023-02-17 14:19:49 +00:00
|
|
|
steps:
|
|
|
|
- name: Publish the Helm chart
|
|
|
|
image: alpine/helm
|
|
|
|
environment:
|
|
|
|
GITEA_TOKEN:
|
|
|
|
from_secret: GITEA_TOKEN
|
|
|
|
commands:
|
|
|
|
- helm plugin install https://github.com/chartmuseum/helm-push
|
|
|
|
- helm package chart -d chart-package
|
|
|
|
- helm repo add --username allanger --password $GITEA_TOKEN allanger-charts https://git.badhouseplants.net/api/packages/allanger/helm
|
|
|
|
- helm cm-push "./chart-package/$(ls chart-package)" allanger-charts
|
|
|
|
|
2023-02-17 14:48:16 +00:00
|
|
|
- name: Init git submodules with themes
|
2023-02-17 14:19:49 +00:00
|
|
|
image: alpine/git
|
|
|
|
commands:
|
|
|
|
- git submodule update --init --recursive
|
|
|
|
|
2023-02-25 16:54:23 +00:00
|
|
|
- name: Test a build
|
2023-02-25 17:34:44 +00:00
|
|
|
image: git.badhouseplants.net/badhouseplants/hugo-builder
|
2023-02-25 16:54:23 +00:00
|
|
|
commands:
|
|
|
|
- hugo
|
|
|
|
|
2023-02-17 14:19:49 +00:00
|
|
|
- name: Build and push the docker image
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
registry: git.badhouseplants.net
|
|
|
|
username: allanger
|
|
|
|
password:
|
|
|
|
from_secret: GITEA_TOKEN
|
|
|
|
repo: git.badhouseplants.net/allanger/badhouseplants-net
|
2023-02-25 11:44:29 +00:00
|
|
|
tags: ${DRONE_COMMIT_SHA}
|
2023-02-17 14:19:49 +00:00
|
|
|
|
2023-02-25 18:28:00 +00:00
|
|
|
- name: Deploy a preview ApplicationSet
|
2023-02-25 18:36:04 +00:00
|
|
|
image: alpine/k8s:1.24.10
|
2023-02-25 18:28:00 +00:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
exclude:
|
|
|
|
- main
|
|
|
|
environment:
|
|
|
|
KUBECONFIG_CONTENT:
|
|
|
|
from_secret: KUBECONFIG_CONTENT
|
|
|
|
commands:
|
|
|
|
- mkdir $HOME/.kube
|
|
|
|
- echo $KUBECONFIG_CONTENT | base64 -d > $HOME/.kube/config
|
|
|
|
- apk update --no-cache && apk add yq gettext
|
2023-02-25 18:38:32 +00:00
|
|
|
- export ARGO_APP_CHART_VERSION=`cat chart/Chart.yaml | yq '.version'`
|
2023-02-25 18:36:04 +00:00
|
|
|
- export ARGO_APP_BRANCH=$DRONE_BRANCH
|
|
|
|
- export ARGO_APP_HOSTNAME="${DRONE_BRANCH}-dev.badhouseplants.net"
|
|
|
|
- export ARGO_APP_IMAGE_TAG=$DRONE_COMMIT_SHA
|
2023-02-25 18:44:05 +00:00
|
|
|
- kubectl get -f ./kube/applicationset.yaml -o yaml > /tmp/old_appset.yaml
|
2023-02-25 19:01:22 +00:00
|
|
|
- yq "del(.spec.generators[].list.elements[] | select(.name == \"$ARGO_APP_BRANCH\"))" /tmp/old_appset.yaml > /tmp/clean_appset.yaml
|
2023-02-25 18:28:00 +00:00
|
|
|
- envsubst < ./kube/template.yaml > /tmp/elements.yaml
|
2023-02-25 18:54:33 +00:00
|
|
|
- yq '.spec.generators[].list.elements += load("/tmp/elements.yaml")' /tmp/clean_appset.yaml > /tmp/new_appset.yaml
|
2023-02-25 18:28:00 +00:00
|
|
|
- kubectl apply -f /tmp/new_appset.yaml
|
|
|
|
|
2023-02-25 19:37:04 +00:00
|
|
|
- name: Sync application
|
|
|
|
image: argoproj/argocd
|
|
|
|
environment:
|
|
|
|
ARGOCD_SERVER:
|
|
|
|
from_secret: ARGOCD_SERVER
|
|
|
|
ARGOCD_AUTH_TOKEN:
|
|
|
|
from_secret: ARGOCD_AUTH_TOKEN
|
|
|
|
commands:
|
|
|
|
- argocd app sync -l app=badhouseplants -l branch=$DRONE_BRANCH
|
2023-02-25 19:47:34 +00:00
|
|
|
- argocd app wait -l app=badhouseplants -l branch=$DRONE_BRANCH
|
2023-02-25 19:37:04 +00:00
|
|
|
|
2023-02-17 14:19:49 +00:00
|
|
|
---
|
2023-02-17 14:48:16 +00:00
|
|
|
# ----------------------------------------------
|
|
|
|
# -- Upload a newer version of my CV
|
|
|
|
# ----------------------------------------------
|
2023-02-17 14:19:49 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
|
|
|
name: CV Builder
|
2023-02-17 14:48:16 +00:00
|
|
|
|
|
|
|
trigger:
|
2023-02-17 14:19:49 +00:00
|
|
|
branch:
|
|
|
|
- main
|
2023-02-17 14:48:16 +00:00
|
|
|
event:
|
|
|
|
- push
|
|
|
|
|
2023-02-17 14:19:49 +00:00
|
|
|
steps:
|
|
|
|
- name: Build the CV
|
|
|
|
image: ghcr.io/puppeteer/puppeteer
|
|
|
|
commands:
|
|
|
|
- cp -R ./content/cv/* $HOME
|
|
|
|
- cd $HOME
|
|
|
|
- npm install md-to-pdf
|
|
|
|
- npx md-to-pdf index.md
|
|
|
|
- mkdir $DRONE_WORKSPACE/cv
|
|
|
|
- mv index.pdf $DRONE_WORKSPACE/cv/n.rodionov.pdf
|
|
|
|
|
|
|
|
- name: Upload the CV
|
|
|
|
image: rclone/rclone:latest
|
|
|
|
environment:
|
|
|
|
RCLONE_CONFIG_CONTENT:
|
|
|
|
from_secret: RCLONE_CONFIG_CONTENT_PRIVATE
|
|
|
|
RCLONE_CONFIG: /tmp/rclone.conf
|
|
|
|
commands:
|
|
|
|
- echo "$RCLONE_CONFIG_CONTENT" > $RCLONE_CONFIG
|
|
|
|
- rclone copy -P $DRONE_WORKSPACE/cv badhouseplants-minio:/public-download
|