Traduction et idée question 3

This commit is contained in:
jarjar 2025-03-04 10:43:07 +00:00
parent 63ec323ef1
commit 8b4b51b9ef

View File

@ -1,44 +1,49 @@
# Installation et configuration Packer # DVOP2025_Exercise
## Installation : ## Packer installation :
```yay -S packer``` ```yay -S packer```
## Téléchargement des plugins : ## Download plugins :
```packer init NERD_Debian_Exercise.pkr.hcl``` ```packer init NERD_Debian_Exercise.pkr.hcl```
## Build de l'image pour virtualbox : ## Build image for virtualbox :
```packer build -only=virtualbox-iso.primary NERD_Debian_Exercise.pkr.hcl``` ```packer build -only=virtualbox-iso.primary NERD_Debian_Exercise.pkr.hcl```
Un message de succès apparait à la fin du build : A success message should appear at the end of the build:
Build 'virtualbox-iso.primary' finished after 14 minutes 25 seconds. > Build 'virtualbox-iso.primary' finished after 14 minutes 25 seconds.
L'output du build est disponible dans le repertoire "build" comme définis dans la configuration :
output_directory = "${local.build_directory}/packer-${local.name}-virtualbox"
Il suffit alors d'import l'ovf dans virtualbox.
La machine étant en NAT, pour pouvoir y accéder il faut faire du port fowarding. The build output is in the “build” directory as defined in the configuration :
Port 80 et 22 à utiliser. > output_directory = "${local.build_directory}/packer-${local.name}-virtualbox"
Pour pouvoir voir le job dans notre version de jenkins, il faut mettre à jour les plugins. Import the ovf into virtualbox.
# Réponses : Since the machine is in NAT mode, fowarding ports must be used to access it.
1. When is the last time the `test_app` job ran ? Use ports 80 and 22.
On peut voir dans l'interface Jenkins que le dernier build date du : 1 avr. 2019, 14:12:12
2. When building the job again, can you describe and explain what is going differently than the previous run ? To see the job in our version of jenkins, we need to update the Jenkins plugins.
Dans blue ocean pour avoir une meilleur visualisation, on voit que l'ancien build a eu un failure au niveau d'un test qui se nomme "TestSuite.WontWork".
Le nouveau build est en erreur au niveau de l'etape de build avec comme erreur : The source is not compiled in c++11 mode. # Answers :
Dans "test.cpp" on peut voir la condition avec la macro __cplusplus : **1. When is the last time the `test_app` job ran ?**
We can see in the Jenkins interface that the last build date is: Apr 1, 2019, 14:12:12
**2. When building the job again, can you describe and explain what is going differently than the previous run ?**
In blue ocean, for a better visualization, we see that the old build has failed a test called “TestSuite.WontWork”.
The new build has an error in the build step with the error :
> The source is not compiled in c++11 mode.
In the file “test.cpp” you can see the condition with the macro __cplusplus :
``` ```
#if __cplusplus != 201103L #if __cplusplus != 201103L
#error The source is not compiled in c++11 mode #error The source is not compiled in c++11 mode
#endif #endif
``` ```
Ce qui signifie que le code doit etre compilé avec la version c++11 sinon l'erreur est retourné. This means that the code must be compiled with the c++11 version, otherwise the error is returned.
Documentation de la macro : (https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros) Macro documentation : (https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros)
On peut voir qu'avec le cmake --version les version de cmake sont différentes entre les builds. We can see that with cmake --version, cmake versions are different between builds.
(Note perso) Si le CMakeLists n'a pas changé alors il faut voir au niveau de la version GCC (ou peut etre ailleurs) pour voir un potentiellement changement. (https://gcc.gnu.org/gcc-6/changes.html ou https://gcc.gnu.org/gcc-12/changes.html) (à delete) Si le CMakeLists n'a pas changé alors il faut voir au niveau de la version GCC (ou peut etre ailleurs) pour voir un potentiellement changement. (https://gcc.gnu.org/gcc-6/changes.html ou https://gcc.gnu.org/gcc-12/changes.html) ou alors le problème vient aussi d'ici : set(CMAKE_CXX_STANDARD_REQUIRED True)
3. Now that you have assessed the situation, make the necessary modifications to make sure the Job environment and/or Job executable behaves in the same manner as it was before.
Une des soltutions est de modifier le fichier "CMakeLists.txt" en forcant la compilation en c++11. **3. Now that you have assessed the situation, make the necessary modifications to make sure the Job environment and/or Job executable behaves in the same manner as it was before.**
Dans mon "CMakeLists", j'ai rajouté cette ligne : ```set(CMAKE_CXX_STANDARD 11)``` (Variable récupéré dans cette documenation : https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD) One solution is to modify the “CMakeLists.txt” file by forcing compilation in c++11.
J'ai donc fais la modification que j'ai mis sur ce repertoire git : https://gitea.jarodcajna.fr/jarjar/test_app.git In my “CMakeLists”, i'have added this line : ```set(CMAKE_CXX_STANDARD 11)``` (Variable retrieved from this documentation : https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD)
J'ai ensuite modifié la pipeline pour qu'elle aille récupérer mon répertoire git et qu'elle récupère la branche "main". So i made the modification and put it on this public git directory : https://gitea.jarodcajna.fr/jarjar/test_app
En relancant le job, nous avons le meme resultat que l'ancien build. La modification a donc fonctionné. Then i modified the pipeline to retrieve my git repository and the “main” branch.
When i restarted the job, i got the same result as the old build. So the modification worked.
_Explain in a few lines the steps you took and provide a package (git repository / patch files) containing your modifications and a note explaining your changes._ _Explain in a few lines the steps you took and provide a package (git repository / patch files) containing your modifications and a note explaining your changes._