0% ont trouvé ce document utile (0 vote)
32 vues34 pages

TP 2 Devops

Ce document présente un compte rendu sur la mise en œuvre de CI/CD avec GitLab CI, GitHub Actions et Jenkins. Il couvre des concepts clés tels que les tests CI, les étapes de build, les environnements de staging, et les différences entre Continuous Delivery et Continuous Deployment. De plus, il fournit des instructions pratiques pour configurer un projet, créer un dépôt Git, et mettre en place des pipelines CI/CD.

Transféré par

Maryem Khammar
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PPTX, PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
32 vues34 pages

TP 2 Devops

Ce document présente un compte rendu sur la mise en œuvre de CI/CD avec GitLab CI, GitHub Actions et Jenkins. Il couvre des concepts clés tels que les tests CI, les étapes de build, les environnements de staging, et les différences entre Continuous Delivery et Continuous Deployment. De plus, il fournit des instructions pratiques pour configurer un projet, créer un dépôt Git, et mettre en place des pipelines CI/CD.

Transféré par

Maryem Khammar
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PPTX, PDF, TXT ou lisez en ligne sur Scribd

TP2 Part 1 : Hands-on CI/CD

with GitLab CI, GitHub


Actions, and Jenkins
Compte_rendu
Mariem Khammar
MP1GL
3 Quick quiz
• 1. What happens if a test fails in CI ?
Si un test échoue en CI, le pipeline s'arrête et empêche le
déploiement pour éviter d'introduire un bug en production.
• 2. What is the purpose of a build step in CI ?
L'étape de build compile et assemble le code source en un
exécutable ou un package déployable.
• 3. True or False: CI tests must be run in the same environment as the prod ?
Faux, les tests CI peuvent être exécutés dans un
environnement similaire mais pas forcément identique à la
production.
• 4. What’s the point of a staging environment in CD?
Un environnement de staging permet de tester l'application dans des conditions
proches de la production avant le déploiement final.

• 5. What does rollback mean in the CD context ?


Un rollback consiste à revenir à une version précédente d’une application en cas
de problème après un déploiement.
• 6. Why are artifacts (e.g. .jar) stored after the build ?
Les artefacts sont stockés pour garantir un déploiement cohérent sans nécessiter
une recompilation à chaque fois.

• 7. Which Git command generally triggers a CI pipeline ?


La commande git push déclenche généralement un pipeline CI.

• 8. What’s the difference between Continuous Delivery and Continuous Deploy ment ?
Continuous Delivery signifie que le code est toujours prêt à être déployé
manuellement, tandis que
Continuous Deployment pousse automatiquement chaque changement validé
en production.
4 Project Setup: The hello-devops Folder
Folder Structure
[Link]: A simple Python script that prints "Hello, CI/CD!".

test_app.py: A basic unit test for your application.


[Link]: List any Python dependencies
5 Setting Up a Git Repository
1. Create a new repository on GitHub or GitLab (e.g., name it devops-tp).
2. Clone the repository locally
3. Create the hello-devops folder and add the files from the
previous step.

FOLDER STRUCTURE
4. Commit and push your changes:
Files are pushed
2. Commit and push the file.
6.2 GitHub Actions
• 1. In your GitHub repository, create a file at .github/workflows/[Link]
Le fichier [Link]
Vérifier que le fichier existe
2. Commit and push the changes
3. Check the Actions tab in GitHub for workflow results.
6.3 JenkinsPipeline(withDocke)
• Step1: Install Docker
• Step2:Run Jenkins Using Docker
Run the Jenkins container:

Then, retrievetheinitialadminpassword:
Retrieve the initial adminpassword:
Step 3: Set Up GitHub Authentication in Jenkins
Follow the on-screen instructions at [Link] to
install recommended plugins
Plugins installé et jenkins est prêt
2. Add the Credentials to Jenkins

Credential ajouté
Step 4: Ensure Python Is Installed

Verify that Python is available in the Jenkins environment.


Step 5: Configure a Jenkins Pipeline
Job
1. In Jenkins, click on New Item → Enter CI/CD-Pipeline → Select Pipeline → Click OK. 2. In the Pipeline
configuration, under Pipeline script, add:
3. Click Save and then Build Now to run the pipeline

Build programmé

4. View the Console Output for build details


Part 2 : Advanced Topics and Further
Exploration
1 Transforming the Application into a Web API

[Link]
1.1 Dependencies ([Link])

1.2 Tests (test_app.py)


2 Advanced Git: Branch
Management and MR/PR
Modify [Link] to add a new route (/status),
push the branch
Pull Request
Pull Request
3 PipelineConfiguration
3.2 GitHubActions

2. Sending notifications onSlack(simulated)


Commit et pousser les modifications

Vous aimerez peut-être aussi