Skip to content

Commit

Permalink
fix(ci): fix preprod (#56)
Browse files Browse the repository at this point in the history
* chore(ci): fix preprod

* Update review.yml

* Update production.yml

* Update preproduction.yml

* Update preproduction.yml

* Update preproduction.yml

* Update production.yml
  • Loading branch information
Julien Bouquillon authored Dec 20, 2021
1 parent 8d0527b commit a7434ac
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 50 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/preproduction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Preproduction

on:
push:
branches:
- master

concurrency:
cancel-in-progress: true
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 }}
token: ${{ secrets.GITHUB_TOKEN }}
imageName: monsuivipsy/monsuivipsy-site

##############################################################################
## 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]
environment:
name: preproduction
url: https://monsuivipsy-site-preprod.dev.fabrique.social.gouv.fr
steps:
- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@v1
with:
environment: "preprod"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
59 changes: 11 additions & 48 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- v*

concurrency:
group: preproduction
group: production
cancel-in-progress: true

jobs:
Expand All @@ -26,70 +26,33 @@ jobs:
- name: Use autodevops build and register
uses: SocialGouv/actions/autodevops-build-register@master
with:
environment: prod
project: ${{ env.project }}
token: ${{ secrets.GITHUB_TOKEN }}
imageName: monsuivipsy/monsuivipsy-site

##############################################################################
## GENERATE PREPRODUCTION MANIFESTS
##############################################################################
manifests:
name: Preproduction manifests
runs-on: ubuntu-latest
steps:

- name: Use autodevops manifests generation
uses: SocialGouv/actions/autodevops-manifests@master
with:
environment: "preprod"

##############################################################################
## DEPLOY PREPRODUCTION APPLICATION
##############################################################################
deploy-preprod:
name: Deploy preproduction
runs-on: ubuntu-latest
needs: [register, manifests]
environment:
name: preproduction
url: https://${{ env.namespace }}.${{ env.SOCIALGOUV_BASE_DOMAIN }}
steps:

- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@master
with:
environment: "preprod"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.SOCIALGOUV_KUBE_CONFIG_DEV }}

##############################################################################
## GENERATE PRODUCTION MANIFESTS
##############################################################################
manifests-prod:
name: Production manifests
runs-on: ubuntu-latest
steps:

- name: Use autodevops manifests generation
uses: SocialGouv/actions/autodevops-manifests@master
with:
environment: "prod"

##############################################################################
## DEPLOY PRODUCTION APPLICATION
##############################################################################
deploy-prod:
name: Deploy production
runs-on: ubuntu-latest
needs: [deploy-preprod, manifests-prod]
needs: [register]
environment:
name: production
url: https://${{ env.namespace }}.${{ env.SOCIALGOUV_BASE_DOMAIN }}
url: https://monsuivipsy.fabrique.social.gouv.Fr
steps:

- name: Use autodevops manifests generation
uses: SocialGouv/actions/autodevops-manifests@master
with:
environment: "prod"
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@master
with:
environment: "prod"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.SOCIALGOUV_KUBE_CONFIG_PROD }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
4 changes: 2 additions & 2 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Review

on:
push:
branches:
- '**'
branches-ignore:
- master
tags-ignore:
- v*

Expand Down

0 comments on commit a7434ac

Please sign in to comment.