Aller au contenu

Gitops Workflow : new release#

Contexte#

Il s'agit de configurer une nouvelle release pour Gitops Workflow.

CAASCHR Template#

Champ Description
Titre [STG]/[PRD] Gitops Workflow : New release <new_release>
Zones NGOT client zones (see list below)
Durée En général, il faut au moins 1h

Dans la description, bien revoir ces points:

  • les objectifs ;
  • la procédure de vérification.

Le ticket CAASCHR doit contenir les Merge Requests suivantes:

  • templates-ci;
  • templates-clients;
  • gitops-tools.

Description#

h1. Zones
{code}
export ZONES=(<client1> <client2> ... )
{code}
Clients list has been obtained with the following command:

{code}
export LINE=<staging|prod>
readarray -t array < <(sd get zones | jq -cr '.|map(select(.product == "ngot" and .subtype == "monitoring-stack-client" and .metadata.line == "${LINE}") | .name) | .[]'|sed 's/svc-monitoring-stack-client/obs/g')
for r in "${array[@]}"; do echo "$r" |tr '\n' ' ';done
{code}

h1. Objective

* the reference branch of the templates-ci repository becomes: "templates-ci-<new_release>"
* the reference branch of the templates_clients repository is "main" with the new tag "templates-client-<new_release>"
* update client repositories to use the <new_release> release. 

h1. Procedure

* Merge {{templates-ci}} MR into {{templates-ci-<new_release>}} branch.
* Merge {{templates-client}} MR into main branch.
* Create the tag {{templates-client-<new_release>}} on main branch.
* Update {{.gitlab-ci.yml}} file in one client repository (example: {{test03}} for staging and {{pf}} for production line).

    To do this use the `gitops-tools` scripts :
    {code} 
    export PROD_LINE=<prd|stg>
    export GT_BRANCH=<branch_name>
    cd ~/git/caascad/applications/gitops-tools/ngot
    git switch ${GT_BRANCH} && git pull
    ./update-version-branch.py -c configs/comet-${PROD_LINE}.yaml -C <test03|pf>
    {code}
* Check that the branch name has been updated in {{.gitlab-ci.yml}} file of the client repository. 
* Add a new dashboard/probe/prometheus-rule in client repository. Each new commit in *main* branch will launch the deployment pipelines. Check the following points:
    ** pipeline should be in `Passed` state, menu *Build* > *Pipelines*;
    ** check the presence of the new dashboard/probe/prometheus-rules in client Grafana;
    ** after validation the previous check, do the cleanup:

        - remove the test files in client repository main branch;
        - launch *uninstall:all* job that was in {{Blocked}} state; 
        - check that the new dashboard/probe/prometheus-rules have disappeared from client Grafana.

* Update {{.gitlab-ci.yml}} file in all client repositories.

    To do this use the {{gitops-tools}} scripts :
    {code} 
    export PROD_LINE=<prd|stg>
    export GT_BRANCH=<branch_name>
    cd ~/git/caascad/applications/gitops-tools/ngot
    git switch ${GT_BRANCH} && git pull
    for i in "${ZONES[@]}"; do
       echo $i && ./update-version-branch.py -c configs/comet-${PROD_LINE}.yaml -C $i
    done
    {code}
* Check in one of the NGOT client repository (randomly choosen) that the branch name has been updated in {{.gitlab-ci.yml}} file. 

    Depending on your production line deployment, chose one of the following:

    - [staging|https://sourcehub.orange-business.com/cs-factory-stg/cs-factory-environments/obs-${CLIENT}/-/blob/main/.gitlab-ci.yml?ref_type=heads#L4]
    - [production|https://sourcehub.orange-business.com/cs-factory/cs-factory-environments/obs-${CLIENT}/-/blob/main/.gitlab-ci.yml?ref_type=heads#L4]

* mark the new branch {{templates-ci-<new_release>}} in {{Templates CI}} repository as **default** one. Go to {{Templates CI}} repository settings menu and choose the new release branch from dropdown menu:

- [staging|https://sourcehub.orange-business.com/cs-factory-stg/templates-ci/-/settings/repository];
- [production|https://sourcehub.orange-business.com/cs-factory/templates-ci/-/settings/repository].  

h1. Merge

If everything went fine, merge {{gitops-tools}} MR.