From a7434acdc5cae565265dd00ad1a72d29b3a1d54c Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Mon, 20 Dec 2021 15:47:25 +0100 Subject: [PATCH] fix(ci): fix preprod (#56) * chore(ci): fix preprod * Update review.yml * Update production.yml * Update preproduction.yml * Update preproduction.yml * Update preproduction.yml * Update production.yml --- .github/workflows/preproduction.yml | 62 +++++++++++++++++++++++++++++ .github/workflows/production.yml | 59 +++++---------------------- .github/workflows/review.yml | 4 +- 3 files changed, 75 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/preproduction.yml diff --git a/.github/workflows/preproduction.yml b/.github/workflows/preproduction.yml new file mode 100644 index 0000000..abb2347 --- /dev/null +++ b/.github/workflows/preproduction.yml @@ -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 }} diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 2a02e84..e3e88ec 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -6,7 +6,7 @@ on: - v* concurrency: - group: preproduction + group: production cancel-in-progress: true jobs: @@ -26,54 +26,11 @@ 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 @@ -81,15 +38,21 @@ jobs: 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 }} diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 915aabe..ee0e470 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -2,8 +2,8 @@ name: Review on: push: - branches: - - '**' + branches-ignore: + - master tags-ignore: - v*