Work in progress



Overview


Usiamo un meccanismo di CI/CD per cui:




Setup iniziale dell'ambiente sulla propria postazione di lavoro


Installazione git-crypt


Va installato git-crypt

Per i sistemi RHEL compliant esiste in EPEL (quindi 'yum install git-crypt')

Se non c'e' il pacchetto per la propria distribuzione, si puo' installare da sorgente (dipendenze: gcc-c++ e openssl-devel):



git clone https://github.com/AGWA/git-crypt.git
make
make install PREFIX=/usr/local



Download del repo git



mkdir ~/Workdir
cd ~/Workdir
git clone https://github.com/CloudPadovana/puppet_epoxy.git




Scaricare la chiave per il crypting dei file params.pp


Scarico da cld-config il file /var/puppet/KeyRepoEpoxyTesting e copiarlo ad esempio in ~/Workdir



Modifica del codice puppet per la cloud di test

Mi accerto che la copia locale del mio repo (branch testing) sia aggiornata:


$ cd ~/Workdir/puppet_epoxy/


$ git checkout testing
Switched to branch 'testing'
Your branch is up to date with 'origin/testing'.

$ git pull
Already up to date.


Se serve modificare anche un file params.pp, farne prima il decrypt (decrypt che avviene solo locamente: sul repo i file restano cryptati):


git crypt unlock ~/Workdir/KeyRepoEpoxyTesting



A questo punto faccio le modifiche sul branch testing, che poi committo e pusho:


 # fai modifiche 
git add <files modificati> 
git commit -m "Messaggio" <files modificati> git push


Modifica del codice puppet per la cloud di produzione


Mi accerto che la copia locale del mio repo (branch main) sia aggiornata:



$ cd ~/Workdir/puppet_epoxy/


$ git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.

$ git pull
Already up to date.



Se serve modificare anche un file params.pp, farne prima il decrypt (decrypt che avviene solo locamente: sul repo i file restano cryptati):


git crypt unlock ~/Workdir/KeyRepoEpoxyTesting


A questo punto creo un nuovo branch e qua ci faccio le modifiche che committo e pusho:


git checkout -b <nome-del-branch>
# fai modifiche
git add <files modificati>
git commit -m "Messaggio" <files modificati>
git push origin <nome-del-branch>



Creo la pull request:


Vado in: https://github.com/CloudPadovana → Pull requests

Dovrebbe appparire un bottone "Compare & Pull Request" con il nome del branch: cliccaci 


Come base specifica il branch 'main'. In compare deve esserci il nome del branch creato

Metti una breve descrizione e clicca su "Create pull request"


Sincronizzazione tra main e testing


La "sincronizzazione" (ove opportuna) tra main e testing va gestita "a mana"


Per vedere i file che differiscono:


$ git diff --stat main..testing 
 .gitattributes                              | 3 +++
 README.md                                   | 1 -
 compute_epoxy/manifests/neutron.pp          | 1 +
 compute_epoxy/manifests/nova.pp             | 1 +
 controller_epoxy/manifests/configure_ec2.pp | 1 +
 5 files changed, 6 insertions(+), 1 deletion(-)






Per vedere le differenze in un file:



$ git diff main..testing controller_epoxy/manifests/configure_ec2.pp
diff --git a/controller_epoxy/manifests/configure_ec2.pp b/controller_epoxy/manifests/configure_ec2.pp
index abcbb1a..5bc9adf 100644
--- a/controller_epoxy/manifests/configure_ec2.pp
+++ b/controller_epoxy/manifests/configure_ec2.pp
@@ -8,6 +8,7 @@ class controller_epoxy::configure_ec2 inherits controller_epoxy::params {
 
 ##
 # FF aggiungo questa riga di test
+# e anche un'altra
 ##
 
 file { ['/var/lib/ec2-api',