docs/.drone.yml

100 lines
3.1 KiB
YAML
Raw Normal View History

2023-04-17 14:11:49 +00:00
---
kind: pipeline
type: docker
2023-07-17 16:03:15 +00:00
name: amd64
platform:
arch: amd64
steps:
- name: Build image
image: gcr.io/kaniko-project/executor:debug
network_mode: host
commands:
- |
echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $GITEA_USER $GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json
/kaniko/executor \
--destination "$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_$${IMAGE_TAG}" \
--context "$${BUILD_CONTEXT}"
environment:
GITEA_USER: prskr
GITEA_TOKEN:
from_secret: gitea_token
IMAGE_REPO: code.icb4dc0.de/buildr/docs
IMAGE_TAG: x86_64
BUILD_CONTEXT: .
---
kind: pipeline
type: docker
name: arm64
platform:
arch: arm64
2023-04-17 14:11:49 +00:00
steps:
- name: Build image
image: gcr.io/kaniko-project/executor:debug
2023-04-17 14:48:24 +00:00
network_mode: host
2023-04-17 14:11:49 +00:00
commands:
- |
echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $GITEA_USER $GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json
/kaniko/executor \
2023-07-17 16:03:15 +00:00
--destination "$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_$${IMAGE_TAG}" \
--context "$${BUILD_CONTEXT}"
environment:
GITEA_USER: prskr
GITEA_TOKEN:
from_secret: gitea_token
IMAGE_REPO: code.icb4dc0.de/buildr/docs
IMAGE_TAG: arm64
BUILD_CONTEXT: .
---
kind: pipeline
type: docker
name: deploy
depends_on:
- amd64
- arm64
steps:
- name: manifest
image: quay.io/buildah/stable
network_mode: host
privileged: true
commands:
- buildah login "$${IMAGE_REGISTRY}" --username "$${GITEA_USER}" --password "$${GITEA_TOKEN}"
- buildah manifest create "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}"
- buildah manifest add "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_x86_64"
- buildah manifest add "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_arm64"
- buildah manifest push --all "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}"
2023-04-17 14:11:49 +00:00
environment:
GITEA_USER: prskr
GITEA_TOKEN:
2023-04-18 06:24:19 +00:00
from_secret: gitea_token
2023-07-17 16:03:15 +00:00
IMAGE_REGISTRY: code.icb4dc0.de
IMAGE_REPO: buildr/docs
2023-04-18 06:24:19 +00:00
- name: Deploy docs
image: code.icb4dc0.de/prskr/ci-images/kustomize:latest
network_mode: host
commands:
- cd deploy/k8s
- kustomize edit set image buildr-docs=code.icb4dc0.de/buildr/docs:$DRONE_COMMIT_SHA
- kubectl config set-cluster hetzner --server=$K8S_API_URL --insecure-skip-tls-verify=true
- kubectl config set-credentials drone-deploy --token=$K8S_TOKEN
- kubectl config set-context hetzner --user=drone-deploy --namespace=buildr --cluster hetzner
- kubectl config use-context hetzner
- kubectl apply -k .
environment:
K8S_TOKEN:
from_secret: k8s_token
K8S_API_URL:
from_secret: k8s_api_url
when:
ref:
include:
- refs/tags/**
- refs/heads/main