diff --git a/.github/workflows/preproduction.yml b/.github/workflows/preproduction.yml index ec26ad0..b72241f 100644 --- a/.github/workflows/preproduction.yml +++ b/.github/workflows/preproduction.yml @@ -4,33 +4,25 @@ on: push: branches: - master + tags-ignore: + - v* 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 }} + environment: preprod + imagePackage: app token: ${{ secrets.GITHUB_TOKEN }} - imageName: monsuivipsy/monsuivipsy-site - ############################################################################## - ## DEPLOY APPLICATION OVER KUBERNETES - ############################################################################## deploy: name: Deploy application runs-on: ubuntu-latest @@ -39,13 +31,11 @@ jobs: name: preproduction url: https://monsuivipsy-site-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" + 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: monsuivipsy/monsuivipsy-site diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index dc2c07d..103d972 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -10,47 +10,30 @@ concurrency: cancel-in-progress: true jobs: - - ############################################################################## - ## BUILD AND REGISTER APPLICATION 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@master - with: - environment: prod - project: ${{ env.project }} - token: ${{ secrets.GITHUB_TOKEN }} - imageName: monsuivipsy/monsuivipsy-site - - - ############################################################################## - ## DEPLOY PRODUCTION APPLICATION - ############################################################################## - deploy-prod: - name: Deploy production + - name: Use autodevops build and register + uses: SocialGouv/actions/autodevops-build-register@v1 + with: + environment: prod + imagePackage: app + token: ${{ secrets.GITHUB_TOKEN }} + + deploy: + name: Deploy application runs-on: ubuntu-latest needs: [register] environment: name: production url: https://monsuivipsy.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.SOCIALGOUV_KUBE_CONFIG_PROD }} - rancherId: ${{ secrets.RANCHER_PROJECT_ID }} - rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }} - imageName: monsuivipsy/monsuivipsy-site - productionHost: monsuivipsy.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 }} diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 85a04d2..8efbdc1 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -8,46 +8,31 @@ on: - v* concurrency: - group: ${{ github.ref }} cancel-in-progress: true + group: review-${{ github.ref }} jobs: - - ############################################################################## - ## BUILD AND REGISTER APPLICATION 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: 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@master - with: - project: ${{ env.project }} - token: ${{ secrets.GITHUB_TOKEN }} - imageName: monsuivipsy/monsuivipsy-site - - ############################################################################## - ## DEPLOY APPLICATION OVER KUBERNETES - ############################################################################## deploy: - name: Deploy application + name: Deploy review branch runs-on: ubuntu-latest needs: [register] steps: - - - name: Use autodevops deployment - uses: SocialGouv/actions/autodevops-helm-deploy@v1 - with: - environment: "dev" - token: ${{ secrets.GITHUB_TOKEN }} - kubeconfig: ${{ secrets.SOCIALGOUV_KUBE_CONFIG_DEV }} - rancherId: ${{ secrets.RANCHER_PROJECT_ID }} - rancherProjectName: ${{ secrets.RANCHER_PROJECT_NAME }} - socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }} - imageName: monsuivipsy/monsuivipsy-site + - 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 }} diff --git a/.kube-workflow/common/values.yaml b/.kube-workflow/common/values.yaml new file mode 100644 index 0000000..8fa24a9 --- /dev/null +++ b/.kube-workflow/common/values.yaml @@ -0,0 +1,3 @@ +app: + enabled: true + probesPath: /api/healthz diff --git a/.socialgouv/environments/dev/monsuivipsy-site.sealed-secret.yaml b/.kube-workflow/env/dev/templates/monsuivipsy-site.sealed-secret.yaml similarity index 100% rename from .socialgouv/environments/dev/monsuivipsy-site.sealed-secret.yaml rename to .kube-workflow/env/dev/templates/monsuivipsy-site.sealed-secret.yaml diff --git a/.socialgouv/environments/preprod/monsuivipsy-site.sealed-secret.yaml b/.kube-workflow/env/preprod/templates/monsuivipsy-site.sealed-secret.yaml similarity index 100% rename from .socialgouv/environments/preprod/monsuivipsy-site.sealed-secret.yaml rename to .kube-workflow/env/preprod/templates/monsuivipsy-site.sealed-secret.yaml diff --git a/.socialgouv/environments/prod/monsuivipsy-site.sealed-secret.yaml b/.kube-workflow/env/prod/templates/monsuivipsy-site.sealed-secret.yaml similarity index 100% rename from .socialgouv/environments/prod/monsuivipsy-site.sealed-secret.yaml rename to .kube-workflow/env/prod/templates/monsuivipsy-site.sealed-secret.yaml diff --git a/.kube-workflow/env/prod/values.yaml b/.kube-workflow/env/prod/values.yaml new file mode 100644 index 0000000..9430a42 --- /dev/null +++ b/.kube-workflow/env/prod/values.yaml @@ -0,0 +1,2 @@ +app: + host: monsuivipsy.fabrique.social.gouv.fr diff --git a/.socialgouv/config.json b/.socialgouv/config.json deleted file mode 100644 index fca177f..0000000 --- a/.socialgouv/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "app", - "name": "monsuivipsy-site", - "registry": "ghcr", - "project": "monsuivipsy" -} diff --git a/.socialgouv/environments/prod/yaml/redirect.yaml b/.socialgouv/environments/prod/yaml/redirect.yaml deleted file mode 100644 index 6de3e7d..0000000 --- a/.socialgouv/environments/prod/yaml/redirect.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - annotations: - kubernetes.io/ingress.class: nginx - nginx.ingress.kubernetes.io/permanent-redirect: https://monsuivipsy.fabrique.social.gouv.fr$request_uri - cert-manager.io/cluster-issuer: letsencrypt-prod - kubernetes.io/tls-acme: "true" - labels: - component: app - name: www-redirect - namespace: monsuivipsy-site -spec: - rules: - - host: www.monsuivipsy.fr - - host: monsuivipsy.fr - tls: - - hosts: - - www.monsuivipsy.fr - - monsuivipsy.fr - secretName: www-redirect