Skip to content

Demander un site web GRAV #20

Demander un site web GRAV

Demander un site web GRAV #20

Workflow file for this run

name: Demander un site web GRAV
on:
workflow_dispatch:
inputs:
domaine:
type: string
required: true
description: Domaine à utiliser (eg cedille.etsmtl.ca)
nom_club:
type: string
required: true
description: Nom du club. Pas de caractères spéciaux ou d'espaces outre - et _
contexte:
type: string
required: false
description: Contexte sur la demande
jobs:
create_pr:
runs-on: ubuntu-latest
env:
j2_vars: |
deployment_prefix=${{inputs.nom_club}}
repo_name=${{inputs.domaine}}
repo_url=https://github.com/ClubCedille/${{inputs.domaine}}.git
namespace=${{inputs.nom_club}}-grav
hostname=${{inputs.domaine}}
requester=${{github.event.sender.name}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create folders
run: mkdir -p apps/${{inputs.nom_club}}/grav/prod
- name: Create kustomize
uses: cuchi/[email protected]
with:
template: bases/grav/prod-templates/kustomization.yaml.jinja2
output_file: apps/${{inputs.nom_club}}/grav/prod/kustomization.yaml
strict: true
variables: ${{ env.j2_vars }}
- name: Create vault-patch
uses: cuchi/[email protected]
with:
template: bases/grav/prod-templates/vault-patch.yaml.jinja2
output_file: apps/${{inputs.nom_club}}/grav/prod/vault-patch.yaml
strict: true
variables: ${{ env.j2_vars }}
- name: Create terraform repo
uses: cuchi/[email protected]
with:
template: bases/grav/prod-templates/grav-repo.tf.jinja2
output_file: terraform/github/apps-repos/${{inputs.nom_club}}-grav.tf
strict: true
variables: ${{ env.j2_vars }}
- name: Create GH auth set
uses: cuchi/[email protected]
with:
template: bases/grav/prod-templates/gh-role.yaml.jinja2
output_file: system/vault/configs/gh-roles/${{inputs.nom_club}}-grav.yaml
strict: true
variables: ${{ env.j2_vars }}
- name: Create argo app
uses: cuchi/[email protected]
with:
template: bases/grav/prod-templates/argo.yaml.jinja2
output_file: apps/${{inputs.nom_club}}/grav/argo.yaml
strict: true
variables: ${{ env.j2_vars }}
- name: Update kustomize files
run: |
cd $GITHUB_WORKSPACE/apps/${{inputs.nom_club}}/grav
kustomize create --resources argo.yaml
cd $GITHUB_WORKSPACE/system/vault/configs/gh-roles
kustomize edit add resource ${{inputs.nom_club}}-grav.yaml
cd $GITHUB_WORKSPACE/apps/argo-apps
kustomize edit add resource ../${{inputs.nom_club}}/grav/
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: Create a GRAV website for ${{inputs.nom_club}}
branch: grav/${{inputs.nom_club}}
body: |
Nom du club: ${{inputs.nom_club}}
Domaine: ${{inputs.domaine}}
Contexte: ${{inputs.contexte}}
Mot de passe par defaut:
> `kubectl port-forward -n vault svc/vault-ui 8200`
> https://localhost:8200/ui/vault/secrets/kv/show/${{inputs.nom_club}}-grav/default/grav/${{inputs.nom_club}}-grav-init-pwd