Skip to content

Instantly share code, notes, and snippets.

@phil-lgr
Last active June 11, 2019 19:38
Show Gist options
  • Save phil-lgr/1fba34126d480afc09d50773c631a837 to your computer and use it in GitHub Desktop.
Save phil-lgr/1fba34126d480afc09d50773c631a837 to your computer and use it in GitHub Desktop.
Renovate on Bitbucket
#
# Renovate cronjob
#
apiVersion: batch/v1beta1
kind: CronJob
metadata:
namespace: renovate
name: renovate
spec:
schedule: '@hourly'
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
containers:
- name: renovate
# Update this to the latest available and then enable Renovate on the manifest
image: renovate/renovate:16.10.3
# Environment Variables
env:
- name: RENOVATE_PLATFORM
valueFrom:
secretKeyRef:
name: renovate-env
key: renovate-platform
- name: RENOVATE_ENDPOINT
valueFrom:
secretKeyRef:
name: renovate-env
key: renovate-endpoint
- name: RENOVATE_USERNAME
valueFrom:
secretKeyRef:
name: renovate-env
key: renovate-username
- name: RENOVATE_PASSWORD
valueFrom:
secretKeyRef:
name: renovate-env
key: renovate-password
- name: RENOVATE_AUTODISCOVER
valueFrom:
secretKeyRef:
name: renovate-env
key: renovate-autodiscover
- name: RENOVATE_REPOSITORIES
value: 'sportlogiqteam/erp-app'
restartPolicy: Never

Setup Renovate

Blog post

Consult the renovate docs

Create an AppPassword on Bitbucket

Create a file named renovate-bot.secret.yaml with:

#
# Define namespace for renovate
#
apiVersion: v1
kind: Namespace
metadata:
    name: renovate
---
#
# Create secrets for renovate bot
#
apiVersion: v1
kind: Secret
metadata:
    namespace: renovate
    name: renovate-env
type: Opaque
stringData:
    renovate-platform: 'bitbucket'
    renovate-endpoint: 'https://api.bitbucket.org/2.0/'
    renovate-username: '<bot-username>'
    renovate-password: '<app-password>'
    renovate-autodiscover: 'false'

then apply it:

kubectl apply -f config/kubernetes-aws/renovate-bot.secret.yaml
kubectl get secrets --namespace renovate

Create the cron job with:

kubectl apply -f config/kubernetes-aws/renovate-bot.yaml

Make sure the cronjob is showing up:

kubectl get cronjob --namespace renovate

To run the cronjob manually:

kubectl create job --from=cronjob/renovate renovate-test-run --namespace renovate

Troubleshooting

kubectl get pods --namespace renovate
kubectl logs <pod-name> --namespace renovate
kubectl describe pods <pod-name> --namespace renovate

Cleanup

kubectl delete job renovate-test-run --namespace renovate
kubectl delete -f config/kubernetes-aws/renovate-bot.yaml
kubectl delete -f config/kubernetes-aws/renovate-bot.secret.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment