Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
feat(ci): use kube-workflow (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
achauve authored May 12, 2022
1 parent c5777d6 commit 9f0e28e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 103 deletions.
39 changes: 6 additions & 33 deletions .github/workflows/preproduction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +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 }}
imageName: fabrique/ressourcerie
imagePackage: app
token: ${{ secrets.GITHUB_TOKEN }}

##############################################################################
## GENERATE KUBERNETES MANIFESTS
##############################################################################
manifests:
name: Generate k8s manifests
runs-on: ubuntu-latest
steps:

- name: Use autodevops manifests generation
uses: SocialGouv/actions/autodevops-manifests@v1
with:
environment: preprod
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}

##############################################################################
## DEPLOY APPLICATION OVER KUBERNETES
##############################################################################
deploy:
name: Deploy application
runs-on: ubuntu-latest
needs: [register, manifests]
needs: [register]
environment:
name: preproduction
url: https://ressourcerie-preprod.dev.fabrique.social.gouv.fr
steps:
- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-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 }}
32 changes: 5 additions & 27 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,17 @@ concurrency:
cancel-in-progress: true

jobs:

##############################################################################
## BUILD AND REGISTER DOCKER IMAGE
##############################################################################
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: prod
project: ${{ env.project }}
imageName: fabrique/ressourcerie
imagePackage: app
token: ${{ secrets.GITHUB_TOKEN }}

##############################################################################
## DEPLOY PRODUCTION APPLICATION
##############################################################################
deploy:
name: Deploy application
runs-on: ubuntu-latest
Expand All @@ -42,20 +29,11 @@ jobs:
name: production
url: https://ressourcerie.fabrique.social.gouv.fr
steps:

- name: Use autodevops manifests generation
uses: SocialGouv/actions/autodevops-manifests@v1
with:
environment: prod
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
env:
NODE_OPTIONS: '--max_old_space_size=4096'

- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@v1
- name: Use kube-workflow deployment
uses: SocialGouv/kube-workflow@v1
with:
environment: prod
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }}
43 changes: 7 additions & 36 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,28 @@ concurrency:
group: review-${{ github.ref }}

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: dev
imageName: fabrique/ressourcerie
project: ${{ env.project }}
imagePackage: app
token: ${{ secrets.GITHUB_TOKEN }}

##############################################################################
## GENERATE KUBERNETES MANIFESTS
##############################################################################
manifests:
name: Generate k8s manifests
runs-on: ubuntu-latest
steps:

- name: Use autodevops manifests generation
uses: SocialGouv/actions/autodevops-manifests@v1
with:
environment: dev
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
env:
NODE_OPTIONS: '--max_old_space_size=4096'

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

- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@v1
- name: Use kube-workflow deployment
uses: SocialGouv/kube-workflow@v1
with:
environment: dev
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectId: ${{ secrets.RANCHER_PROJECT_ID }}
rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }}
4 changes: 4 additions & 0 deletions .kube-workflow/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
app:
enabled: true
imagePackage: app
probesPath: /healthz
7 changes: 0 additions & 7 deletions .socialgouv/config.json

This file was deleted.

2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ RUN yarn build
FROM node:lts as runner
WORKDIR /my-project
ENV NODE_ENV production
USER 1001

# If you are using a custom next.config.js file, uncomment this line.
# COPY --from=builder /my-project/next.config.js ./
COPY --from=builder /my-project/public ./public
Expand Down

0 comments on commit 9f0e28e

Please sign in to comment.