Skip to content

Commit

Permalink
fix: migrate to kube-workflow (#70)
Browse files Browse the repository at this point in the history
* fix: migrate to kube-workflow

* fix
  • Loading branch information
Julien Bouquillon authored Apr 15, 2022
1 parent 56318de commit 4214c2d
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 91 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/preproduction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Preproduction

on:
push:
branches: [master]
branches:
- master
tags-ignore:
- v*

Expand All @@ -11,43 +12,30 @@ concurrency:
group: preproduction

jobs:

##############################################################################
## BUILD AND REGISTER DOCKER IMAGES
##############################################################################
register:
name: Build & Register application
runs-on: ubuntu-latest
steps:

- name: Get project name
run: |
echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Use autodevops build and register
uses: SocialGouv/actions/autodevops-build-register@v1
with:
environment: preprod
project: ${{ env.project }}
imagePackage: app
token: ${{ secrets.GITHUB_TOKEN }}
imageName: nos1000jours/les1000jours-landing

##############################################################################
## DEPLOY APPLICATION OVER KUBERNETES
##############################################################################
deploy:
runs-on: ubuntu-latest
name: Deploy application
runs-on: ubuntu-latest
needs: [register]
environment:
name: preproduction
url: https://nos1000jours-landing-preprod.dev.fabrique.social.gouv.fr
steps:

- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-helm-deploy@v1
- name: Use kube-workflow deployment
uses: SocialGouv/kube-workflow@v1
with:
environment: preprod
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
imageName: nos1000jours/les1000jours-landing
48 changes: 15 additions & 33 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,30 @@ concurrency:
cancel-in-progress: true

jobs:

##############################################################################
## BUILD AND REGISTER DOCKER IMAGE
##############################################################################
register:
name: Build & Register application
runs-on: ubuntu-latest
steps:
- name: Use autodevops build and register
uses: SocialGouv/actions/autodevops-build-register@v1
with:
environment: prod
imagePackage: app
token: ${{ secrets.GITHUB_TOKEN }}

- name: Get project name
run: |
echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Use autodevops build and register
uses: SocialGouv/actions/autodevops-build-register@v1
with:
environment: prod
project: ${{ env.project }}
token: ${{ secrets.GITHUB_TOKEN }}
imageName: nos1000jours/les1000jours-landing

##############################################################################
## DEPLOY PRODUCTION APPLICATION
##############################################################################
deploy:
name: Deploy application
runs-on: ubuntu-latest
needs: [register]
environment:
name: production
url: https://1000jours.fabrique.social.gouv.fr/
url: https://1000jours.fabrique.social.gouv.fr
steps:

- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-helm-deploy@v1
with:
environment: prod
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
imageName: nos1000jours/les1000jours-landing
projectName: "les1000jours-landing"
productionHost: "1000jours.fabrique.social.gouv.fr"
- name: Use kube-workflow deployment
uses: SocialGouv/kube-workflow@v1
with:
environment: prod
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherProjectId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }}
48 changes: 17 additions & 31 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Review

on:
push:
branches-ignore: [master]
branches-ignore:
- master
tags-ignore:
- v*

Expand All @@ -11,42 +12,27 @@ concurrency:
group: review-${{ github.ref }}

jobs:

##############################################################################
## BUILD AND REGISTER DOCKER IMAGES
##############################################################################
register:
name: Build & Register application
runs-on: ubuntu-latest
steps:
- name: Use autodevops build and register
uses: SocialGouv/actions/autodevops-build-register@v1
with:
environment: dev
imagePackage: app
token: ${{ secrets.GITHUB_TOKEN }}

- name: Get project name
run: |
echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Use autodevops build and register
uses: SocialGouv/actions/autodevops-build-register@v1
with:
project: ${{ env.project }}
token: ${{ secrets.GITHUB_TOKEN }}
imageName: nos1000jours/les1000jours-landing

##############################################################################
## DEPLOY APPLICATION OVER KUBERNETES
##############################################################################
deploy:
name: Deploy review branch
runs-on: ubuntu-latest
name: Deploy application
needs: [register]
steps:

- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-helm-deploy@v1
with:
environment: "dev"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
imageName: nos1000jours/les1000jours-landing
- name: Use kube-workflow deployment
uses: SocialGouv/kube-workflow@v1
with:
environment: dev
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherProjectId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }}
4 changes: 4 additions & 0 deletions .kube-workflow/prod/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
app:
enabled: true
host: 1000jours.fabrique.social.gouv.fr
certSecretName: les1000jours-landing-crt
3 changes: 3 additions & 0 deletions .kube-workflow/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
app:
enabled: true
containerPort: 8080
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ RUN yarn --production --frozen-lockfile --prefer-offline && yarn cache clean
RUN yarn build
RUN yarn export

FROM ghcr.io/socialgouv/docker/nginx:6.65.0

USER 101

ENV PORT=3000
FROM ghcr.io/socialgouv/docker/nginx:7.0.0

COPY --from=builder --chown=nginx:nginx /out /usr/share/nginx/html

0 comments on commit 4214c2d

Please sign in to comment.