Skip to content

Commit

Permalink
ci: 👷 deploy preprod with kube instead of terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-tobi committed Jul 22, 2023
1 parent 6e2cf0d commit af8d18f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/change-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
type: string
description: "Namespace name in kubernetes cluster"
default: "basegun"
domain:
required: true
type: string
description: "Nom de domaine utilisé par l'application"
default: "basegun.fr"
branch:
required: true
type: string
Expand Down Expand Up @@ -68,9 +73,14 @@ jobs:
- name: Update Infra Version
run: |
export TAG=$(make get-current-tag)
yq -i '.backend.image.tag = strenv(TAG)' ./infra/kube/basegun/values.yaml
yq -i '.frontend.image.tag = strenv(TAG)' ./infra/kube/basegun/values.yaml
export TAG=$(make get-current-tag)
yq -i '.backend.image.tag = strenv(TAG)' ./infra/kube/helm/values.yaml
yq -i '.frontend.image.tag = strenv(TAG)' ./infra/kube/helm/values.yaml
- name: Update ingress domaine
run: |
export DOMAIN="${{ inputs.domain }}"
yq -i '.ingress.hosts[0].host = strenv(DOMAIN)' ./infra/kube/helm/values.yaml
- name: Commit and push changes
uses: devops-infra/[email protected]
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/preprod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,31 @@ jobs:
organization: datalab-mi
container: basegun/basegun-backend
dry-run: false
untagged: true
prune-untagged: true
- name: Delete untagged images
uses: vlaurin/action-ghcr-prune@main
with:
token: ${{ secrets.PERSO_ACCESS_TOKEN }}
organization: datalab-mi
container: basegun/basegun-frontend
dry-run: false
untagged: true
prune-untagged: true

deploy-preprod:
uses: ./.github/workflows/deploy.yml
uses: ./.github/workflows/change-values.yml
needs: build-push
with:
image_version: "develop"
branch: ${{ github.ref_name }}
volume_size: 10
flavor: "s1-2"
workspace: "preprod"
namespace: basegun-preprod
domain: preprod.basegun.fr
secrets:
API_OVH_TOKEN: ${{ secrets.API_OVH_TOKEN }}
SERVER_IP: ${{ secrets.PREPROD_SERVER_IP }}
OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
OS_PROJECT_ID: ${{ secrets.OS_PROJECT_ID }}
OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
OS_USERNAME: ${{ secrets.OS_USERNAME }}
X_OVH_TOKEN: ${{ secrets.PREPROD_OVH_TOKEN }}
JOB_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KUBECONFIG: ${{ secrets.PREPROD_K8_CONFIG }}

test:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions infra/kube/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ingress:
#traefik.ingress.kubernetes.io/router.tls: "true"
#traefik.ingress.kubernetes.io/router.tls.certresolver: letsencrypt
hosts:
- host: kube.basegun.fr
- host: preprod.basegun.fr
paths:
- path: /
pathType: Prefix
Expand All @@ -34,7 +34,7 @@ backend:
repository: ghcr.io/datalab-mi/basegun/basegun-backend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "2.0"
tag: "3.0"
imagePullSecrets: []
podAnnotations: {}
podSecurityContext: {}
Expand Down Expand Up @@ -96,7 +96,7 @@ frontend:
repository: ghcr.io/datalab-mi/basegun/basegun-frontend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "2.0"
tag: "3.0"
imagePullSecrets: []
podAnnotations: {}
podSecurityContext: {}
Expand Down

0 comments on commit af8d18f

Please sign in to comment.