...
- Esiste un git repo (xxx) unico sia per la parte controller che per la parte compute con 2 branch:
- Il branch 'main' viene usato nella cloud di produzione (environment 'production' di puppet)
- Il branch 'testing' viene usato nella cloud di test (environment 'testing' di puppet
- Il codice puppet che viene usato sta in cld-config. ma non si deve MAI modificare i sorgenti puppet direttamente su cld-config
- Modifiche al codice vanno implementate come pull request lavorando sulla propria postazione di lavoro. Una volta che sono approvate (e quindi mergiate nel branch main/testing) queste vengono automaticamente "scaricate" in cld-config
Setup iniziale dell'ambiente
...
sulla propria postazione di lavoro
Installazione git-
...
Copiare da cld-confi
xxxx
Verifica preliminare obbligatoria
Verificare che i repo di test e di produzione siano aggiornati
- cd /var/puppet/puppet_caracal_env_test/
- git status
- se c'e' qualcosa non committato nel repo centrale (web) va chiesto a chi ha fatto le modifiche e in caso committato
- git pull
- cd /var/puppet/puppet_caracal
- git status
- se c'e' qualcosa non committato nel repo centrale (web) va chiesto a chi ha fatto le modifiche e in caso committato
- git pull
Per modifiche in env test
Se devi modificare file nell'ambiente di test
...
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 (serve gcc-c++ e openssl-devel):
| Code Block |
|---|
git clone |
git push WARNING: Since August 2021 for the commit is required the personal token instead of the password! Follow this instruction to create a personal token and remember to save it. Then use the token instead of the old password otherwise you will get the message:
...
https://github.com |
...
/AGWA/git-crypt.git
make
make install PREFIX=/usr/local |
Download del repo git
| Code Block |
|---|
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/
...
Per modifiche in env di produzione
Se devi modificare file nell'ambiente di produzione
...
git push WARNING: Since August 2021 for the commit is required the personal token instead of the password! Follow this instruction to create a personal token and remember to save it. Then use the token instead of the old password otherwise you will get the message:
...
KeyRepoEpoxyTesting e copiarlo ad esempio in ~/Workdir
Modifica del codice per la cloud di test
Mi accerto che la copia locale del mio repo (branch testing) sia aggiornata:
| Code Block |
|---|
$ cd ~/Workdir/puppet_epoxy/
$ git checkout testing
branch 'testing' set up to track 'origin/testing'.
Switched to a new branch '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):
| Code Block |
|---|
git crypt unlock ~/Workdir/KeyRepoEpoxyTesting |
A questo punto creo un nuovo branch e qua ci faccio le modifiche che committo e pusho:
| Code Block |
|---|
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 'testing'. In compare deve esserci il nome del branch creato
Metti una breve descrizione e clicca su "Create pull request"
...