Skip to content

Commit

Permalink
feat: add configurations for running db-migrate in deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ZavenArra committed Nov 5, 2021
1 parent e37c0d4 commit e664606
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/treetracker-api-build-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,9 @@ jobs:
token: ${{ secrets.DEV_DIGITALOCEAN_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save ${{ secrets.DEV_CLUSTER_NAME }}
- name: Delete completed migration jobs prior to deployment
run: kubectl -n ${{ secrets.K8S_NAMESPACE }} delete job --ignore-not-found=true db-migration-job
- name: Update kubernetes resources
run: kustomize build deployment/overlays/development | kubectl apply -n ${{ secrets.K8S_NAMESPACE }} --wait -f -
- name: Attempt to wait for migration job to complete
run: kubectl wait --for=condition=complete --timeout=45s job/db-migration-job
2 changes: 1 addition & 1 deletion deployment/base/database-migration-job.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: batch/v1
kind: Job
metadata:
name:database-migration-job
name: database-migration-job
spec:
backoffLimit: 1 # allow for one re-try of the migration
template:
Expand Down
16 changes: 9 additions & 7 deletions deployment/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
resources:
- deployment.yaml
- mapping.yaml
- service.yaml
- database-connection-sealed-secret.yaml
- cluster-role.yaml
- cluster-role-binding.yaml
- database-migration-job.yaml
- deployment.yaml
- mapping.yaml
- service.yaml
- database-connection-sealed-secret.yaml
- cluster-role.yaml
- cluster-role-binding.yaml
- database-migration-job.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

0 comments on commit e664606

Please sign in to comment.