Adopt new-style AppCode update plugin
This commit is contained in:
parent
f488c077cd
commit
9878b6933d
52
.drone.yml
52
.drone.yml
@ -47,43 +47,25 @@ steps:
|
|||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
registry: gitea.scubbo.org
|
registry: gitea.scubbo.org
|
||||||
repo: gitea.scubbo.org/scubbo/blog_nginx
|
repo: gitea.scubbo.org/scubbo/blog_helm
|
||||||
tags: built_in_ci
|
tags: ${DRONE_COMMIT_SHA:0:10}
|
||||||
debug: true
|
debug: true
|
||||||
launch_debug: true
|
launch_debug: true
|
||||||
username: scubbo
|
username: scubbo
|
||||||
password:
|
password:
|
||||||
from_secret: gitea_password
|
from_secret: gitea_password
|
||||||
- name: update_blog_deployment
|
- name: auto-update-infra-repo
|
||||||
# I've tried using https://github.com/sinlead/drone-kubectl and
|
image: gitea.scubbo.org/scubbo/auto-repo-update-drone-plugin:latest
|
||||||
# https://github.com/honestbee/drone-kubernetes, but neither is built for arm64
|
settings:
|
||||||
image: busybox
|
branch: main
|
||||||
# Replicating the commands from
|
git_repo: https://gitea.scubbo.org/scubbo/blog-infrastructure
|
||||||
# https://github.com/sinlead/drone-kubectl/blob/master/init-kubectl
|
image_tag: ${DRONE_COMMIT_SHA:0:10}
|
||||||
commands:
|
destination_file: helm/deployed-images/prod
|
||||||
# https://github.com/bitnami/bitnami-docker-kubectl/issues/22 -
|
author_email: scubbojj@gmail.com
|
||||||
# there's no bitnami/kubectl image for arm64
|
author_name: Jack Jackson
|
||||||
- wget https://storage.googleapis.com/kubernetes-release/release/v1.19.2/bin/linux/arm64/kubectl
|
commit_message: "[Auto] Update Prod to ${DRONE_COMMIT_SHA:0:10}"
|
||||||
- chmod +x kubectl
|
access_token:
|
||||||
- echo "Echoing Kubernetes Server"
|
from_secret: gitea_pat
|
||||||
- echo $kubernetesServer
|
|
||||||
- ./kubectl config set-credentials default --token=$kubernetesToken
|
image_pull_secrets:
|
||||||
- echo $kubernetesCert | base64 -d > ca.crt
|
- dockerconfigjson
|
||||||
- ./kubectl config set-cluster default --server=$kubernetesServer --certificate-authority=ca.crt
|
|
||||||
- ./kubectl config set-context default --cluster=default --user=default
|
|
||||||
- ./kubectl config use-context default
|
|
||||||
- ./kubectl apply -f kubernetes-resources.yml
|
|
||||||
# This next line wouldn't be necessary if new tags were generated for each image
|
|
||||||
# (though then I'd have to dynamically plumb them into the yml file)
|
|
||||||
# TODO - research if there's a better way to do this. Note that this isn't done
|
|
||||||
# in the `honestbee` repo that I copied from - but I confirmed by `curl`-ing localhost
|
|
||||||
# that simply applying the yml leaves the definitions and the service's output
|
|
||||||
# unchanged, despite `imagePullPolicy: 'Always'`
|
|
||||||
- ./kubectl rollout restart -n blog deployment/blog-deployment
|
|
||||||
environment:
|
|
||||||
kubernetesServer:
|
|
||||||
from_secret: k8s_server
|
|
||||||
kubernetesCert:
|
|
||||||
from_secret: k8s_cert
|
|
||||||
kubernetesToken:
|
|
||||||
from_secret: k8s_token
|
|
@ -1,41 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: blog-svc
|
|
||||||
namespace: blog
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
role: app
|
|
||||||
ports:
|
|
||||||
- port: 8080
|
|
||||||
nodePort: 30080
|
|
||||||
type: LoadBalancer
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: blog-deployment
|
|
||||||
labels:
|
|
||||||
role: app
|
|
||||||
namespace: blog
|
|
||||||
spec:
|
|
||||||
replicas: 2
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
role: app
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
role: app
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
# Guidance on how to set up interaction with secure registry:
|
|
||||||
# https://github.com/k3s-io/k3s/issues/1148#issuecomment-641687668
|
|
||||||
# (Unique to rancher/k3s. On traditional k8s installs, I suspect https://github.com/kubernetes/kubernetes/issues/43924
|
|
||||||
# is the way)
|
|
||||||
- name: app
|
|
||||||
image: "gitea.scubbo.org/scubbo/blog_nginx:built_in_ci"
|
|
||||||
imagePullPolicy: 'Always'
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 10m
|
|
Loading…
x
Reference in New Issue
Block a user