{"id":366,"date":"2026-07-09T16:00:52","date_gmt":"2026-07-09T16:00:52","guid":{"rendered":"https:\/\/networkyy.com\/how-to-set-up-cicd-pipeline-from-scratch\/"},"modified":"2026-09-02T08:56:43","modified_gmt":"2026-09-02T08:56:43","slug":"how-to-set-up-cicd-pipeline-from-scratch","status":"publish","type":"post","link":"https:\/\/networkyy.com\/fr\/how-to-set-up-cicd-pipeline-from-scratch\/","title":{"rendered":"How to Set Up a CI\/CD Pipeline from Scratch"},"content":{"rendered":"<figure><img decoding=\"async\" src=\"https:\/\/images.pexels.com\/photos\/36825977\/pexels-photo-36825977.jpeg?auto=compress&#038;cs=tinysrgb&#038;dpr=2&#038;h=650&#038;w=940\" alt=\"How to Set Up a CI\/CD Pipeline from Scratch\" style=\"width:100%;height:auto;border-radius:8px;margin-bottom:24px;\" \/><figcaption>Photo by Mumtaz  Niazi on Pexels<\/figcaption><\/figure>\n<h1>How to Set Up a CI\/CD Pipeline from Scratch<\/h1>\n<p>Continuous Integration and Continuous Deployment (CI\/CD) has become an essential practice for modern software development teams. By automating the build, test, and deployment processes, CI\/CD pipelines help developers deliver code faster, more reliably, and with fewer errors. This comprehensive guide will walk you through setting up a complete CI\/CD pipeline from scratch, even if you&#8217;re new to the concept.<\/p>\n<h2>Table of Contents<\/h2>\n<ul>\n<li><a href=\"#what-is-cicd\">What is CI\/CD?<\/a><\/li>\n<li><a href=\"#prerequisites\">Prerequisites and Tools<\/a><\/li>\n<li><a href=\"#choosing-tools\">Choosing Your CI\/CD Tools<\/a><\/li>\n<li><a href=\"#repository-setup\">Setting Up Your Code Repository<\/a><\/li>\n<li><a href=\"#jenkins-setup\">Installing and Configuring Jenkins<\/a><\/li>\n<li><a href=\"#pipeline-creation\">Creating Your First Pipeline<\/a><\/li>\n<li><a href=\"#automated-testing\">Adding Automated Testing<\/a><\/li>\n<li><a href=\"#deployment-stage\">Configuring Deployment Stages<\/a><\/li>\n<li><a href=\"#best-practices\">Best Practices and Security<\/a><\/li>\n<\/ul>\n<h2 id=\"what-is-cicd\">What is CI\/CD?<\/h2>\n<p>CI\/CD stands for Continuous Integration and Continuous Deployment. Continuous Integration is the practice of automatically merging code changes from multiple developers into a shared repository several times a day. Each integration is verified by automated builds and tests to detect errors quickly.<\/p>\n<p>Continuous Deployment takes this further by automatically deploying all code changes that pass the testing phase to production. This automation eliminates manual steps, reduces human error, and allows teams to release updates more frequently and confidently.<\/p>\n<h2 id=\"prerequisites\">Prerequisites and Tools<\/h2>\n<p>Before building your CI\/CD pipeline, you&#8217;ll need to have a few things in place:<\/p>\n<ul>\n<li>A source code management system (Git)<\/li>\n<li>A server or cloud instance for your CI\/CD tool<\/li>\n<li>Basic knowledge of command line operations<\/li>\n<li>A test environment for your application<\/li>\n<li>Administrative access to your deployment environment<\/li>\n<\/ul>\n<p>For the server infrastructure, you&#8217;ll need a reliable hosting solution. <a href=\"https:\/\/kamatera.sjv.io\/engON1\" target=\"_blank\" rel=\"nofollow sponsored noopener\">Kamatera<\/a> offers flexible cloud infrastructure that&#8217;s perfect for hosting CI\/CD tools, with scalable resources that can grow with your pipeline needs.<\/p>\n<h2 id=\"choosing-tools\">Choosing Your CI\/CD Tools<\/h2>\n<p>Several excellent CI\/CD tools are available, each with unique strengths:<\/p>\n<h3>Jenkins<\/h3>\n<p>Jenkins is the most popular open-source automation server. It&#8217;s highly extensible with over 1,500 plugins and supports building, deploying, and automating any project. We&#8217;ll use Jenkins for this tutorial due to its flexibility and widespread adoption.<\/p>\n<h3>GitLab CI\/CD<\/h3>\n<p>GitLab provides integrated CI\/CD capabilities directly within its platform. It&#8217;s excellent if you&#8217;re already using GitLab for version control.<\/p>\n<h3>GitHub Actions<\/h3>\n<p>GitHub Actions offers CI\/CD functionality natively within GitHub repositories. It&#8217;s particularly convenient for projects already hosted on GitHub.<\/p>\n<h3>CircleCI and Travis CI<\/h3>\n<p>These are cloud-based CI\/CD platforms that integrate seamlessly with GitHub and Bitbucket, offering quick setup and minimal maintenance.<\/p>\n<h2 id=\"repository-setup\">Setting Up Your Code Repository<\/h2>\n<p>First, ensure your code is in a Git repository. If you haven&#8217;t initialized one yet, navigate to your project directory and run:<\/p>\n<pre><code>git init\ngit add .\ngit commit -m \"Initial commit\"\ngit remote add origin https:\/\/github.com\/yourusername\/yourproject.git\ngit push -u origin main<\/code><\/pre>\n<p>Your repository structure should include configuration files for your CI\/CD pipeline. Create a dedicated branch for pipeline development:<\/p>\n<pre><code>git checkout -b cicd-setup<\/code><\/pre>\n<h2 id=\"jenkins-setup\">Installing and Configuring Jenkins<\/h2>\n<p>Let&#8217;s install Jenkins on a Linux server. For Ubuntu\/Debian systems, execute these commands:<\/p>\n<pre><code>wget -q -O - https:\/\/pkg.jenkins.io\/debian-stable\/jenkins.io.key | sudo apt-key add -\nsudo sh -c 'echo deb https:\/\/pkg.jenkins.io\/debian-stable binary\/ > \/etc\/apt\/sources.list.d\/jenkins.list'\nsudo apt update\nsudo apt install jenkins -y\nsudo systemctl start jenkins\nsudo systemctl enable jenkins<\/code><\/pre>\n<p>Jenkins runs on port 8080 by default. Access it by navigating to <code>http:\/\/your-server-ip:8080<\/code>. Retrieve the initial admin password:<\/p>\n<pre><code>sudo cat \/var\/lib\/jenkins\/secrets\/initialAdminPassword<\/code><\/pre>\n<p>Complete the setup wizard, install suggested plugins, and create your admin user account.<\/p>\n<h2 id=\"pipeline-creation\">Creating Your First Pipeline<\/h2>\n<p>In Jenkins, create a new pipeline job:<\/p>\n<ol>\n<li>Click &#8220;New Item&#8221; from the dashboard<\/li>\n<li>Enter a name and select &#8220;Pipeline&#8221;<\/li>\n<li>Click OK to proceed<\/li>\n<\/ol>\n<p>Create a Jenkinsfile in your repository root. This file defines your pipeline stages:<\/p>\n<pre><code>pipeline {\n    agent any\n    \n    stages {\n        stage('Checkout') {\n            steps {\n                git branch: 'main', url: 'https:\/\/github.com\/yourusername\/yourproject.git'\n            }\n        }\n        \n        stage('Build') {\n            steps {\n                sh 'npm install'\n                sh 'npm run build'\n            }\n        }\n        \n        stage('Test') {\n            steps {\n                sh 'npm test'\n            }\n        }\n        \n        stage('Deploy') {\n            steps {\n                sh '.\/deploy.sh'\n            }\n        }\n    }\n    \n    post {\n        success {\n            echo 'Pipeline completed successfully!'\n        }\n        failure {\n            echo 'Pipeline failed. Please check the logs.'\n        }\n    }\n}<\/code><\/pre>\n<h2 id=\"automated-testing\">Adding Automated Testing<\/h2>\n<p>Automated testing is crucial for maintaining code quality. Your pipeline should run multiple test types:<\/p>\n<h3>Unit Tests<\/h3>\n<p>These test individual components in isolation. Configure them to run early in your pipeline to catch issues quickly.<\/p>\n<h3>Integration Tests<\/h3>\n<p>These verify that different parts of your application work together correctly.<\/p>\n<h3>Security Scans<\/h3>\n<p>Implement security scanning tools like OWASP Dependency Check or Snyk to identify vulnerabilities in your dependencies.<\/p>\n<p>If you&#8217;re looking to deepen your understanding of CI\/CD practices and DevOps principles, consider taking specialized courses on <a href=\"https:\/\/imp.i384100.net\/zxbRDr\" target=\"_blank\" rel=\"nofollow sponsored noopener\">Coursera<\/a>, where industry experts share practical knowledge and real-world scenarios.<\/p>\n<h2 id=\"deployment-stage\">Configuring Deployment Stages<\/h2>\n<p>A robust pipeline includes multiple deployment environments:<\/p>\n<h3>Development Environment<\/h3>\n<p>Deploy automatically on every commit to the development branch. This environment is for active development and rapid iteration.<\/p>\n<h3>Staging Environment<\/h3>\n<p>Create a production-like environment for final testing. Deploy here after all tests pass in the development environment.<\/p>\n<h3>Production Environment<\/h3>\n<p>Implement manual approval gates or deploy automatically after successful staging tests. Here&#8217;s an example deployment configuration:<\/p>\n<pre><code>stage('Deploy to Production') {\n    when {\n        branch 'main'\n    }\n    steps {\n        input message: 'Deploy to production?', ok: 'Deploy'\n        sh 'kubectl apply -f kubernetes\/production\/'\n        sh 'kubectl rollout status deployment\/my-app'\n    }\n}<\/code><\/pre>\n<h2 id=\"best-practices\">Best Practices and Security<\/h2>\n<p>Follow these best practices to maintain a secure and efficient pipeline:<\/p>\n<h3>Use Environment Variables<\/h3>\n<p>Never hardcode sensitive information. Store credentials and API keys as Jenkins credentials or environment variables:<\/p>\n<pre><code>environment {\n    DATABASE_URL = credentials('database-url')\n    API_KEY = credentials('api-key')\n}<\/code><\/pre>\n<h3>Implement Pipeline as Code<\/h3>\n<p>Keep your Jenkinsfile in version control alongside your application code. This ensures pipeline changes are tracked and reviewable.<\/p>\n<h3>Monitor and Log Everything<\/h3>\n<p>Configure proper logging and monitoring to quickly identify and resolve pipeline failures. Integrate tools like Prometheus and Grafana for visualization.<\/p>\n<h3>Keep Dependencies Updated<\/h3>\n<p>Regularly update your CI\/CD tools, plugins, and dependencies to benefit from security patches and new features.<\/p>\n<h3>Use Parallel Execution<\/h3>\n<p>Speed up your pipeline by running independent stages in parallel:<\/p>\n<pre><code>stage('Parallel Tests') {\n    parallel {\n        stage('Unit Tests') {\n            steps {\n                sh 'npm run test:unit'\n            }\n        }\n        stage('Integration Tests') {\n            steps {\n                sh 'npm run test:integration'\n            }\n        }\n    }\n}<\/code><\/pre>\n<h3>Implement Rollback Mechanisms<\/h3>\n<p>Always have a strategy to quickly roll back deployments if issues arise in production. Automate this process within your pipeline.<\/p>\n<p>Setting up a CI\/CD pipeline from scratch requires initial effort, but the long-term benefits far outweigh the investment. You&#8217;ll achieve faster development cycles, fewer bugs in production, and more confident deployments. Start simple, iterate based on your team&#8217;s needs, and gradually add more sophisticated features as you become comfortable with the workflow. Remember that CI\/CD is not just about tools\u2014it&#8217;s a culture of continuous improvement and automation that transforms how teams deliver software.<\/p>\n<div style=\"background:#1a1a2e;color:#fff;padding:24px;border-radius:10px;margin-top:32px;border-left:4px solid #00ff88;\">\n<h3 style=\"color:#00ff88;margin-top:0;\">Follow Networkyy<\/h3>\n<p>Join 125,000+ IT professionals:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.instagram.com\/networkyy\" target=\"_blank\" style=\"color:#00ff88;\" rel=\"noopener\">Instagram @networkyy<\/a><\/li>\n<li><a href=\"https:\/\/www.facebook.com\/ITnetworkyy\/\" target=\"_blank\" style=\"color:#00ff88;\" rel=\"noopener\">Facebook Networkyy<\/a><\/li>\n<li><a href=\"https:\/\/www.threads.com\/@networkyy\" target=\"_blank\" style=\"color:#00ff88;\" rel=\"noopener\">Threads @networkyy<\/a><\/li>\n<li><a href=\"https:\/\/medium.com\/@mattouchi6\" target=\"_blank\" style=\"color:#00ff88;\" rel=\"noopener\">Medium<\/a><\/li>\n<\/ul>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Learn how to set up a complete CI\/CD pipeline from scratch with this step-by-step guide. Includes tools, commands, and best practices.<\/p>","protected":false},"author":2,"featured_media":365,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":"","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"","_yoast_wpseo_focuskw":"","rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":""},"categories":[11],"tags":[],"class_list":["post-366","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-automation"],"contentshake_article_id":"","brizy_media":[],"_links":{"self":[{"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/posts\/366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/comments?post=366"}],"version-history":[{"count":1,"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/posts\/366\/revisions"}],"predecessor-version":[{"id":633,"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/posts\/366\/revisions\/633"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/media\/365"}],"wp:attachment":[{"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/media?parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/categories?post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/networkyy.com\/fr\/wp-json\/wp\/v2\/tags?post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}