Skip to content

Julesdj/ci-cd-intro

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Intro to CI/CD πŸ’» ☁️

TLDR; This repository is a sample project demonstrating a basic continuous integration (CI) / continuous deployment (CD) setup. This project is in READ ONLY mode.

Continuous Deployment Workflow Continuous Integration Workflow Code scanning

Course attachement

This repository is best consumed while or after following the course attachment πŸ‘‡

Project structure

# You can generate this tree with:
# $ tree -a -I '.git|assets|.github|venv|node_modules|images|.DS_Store|*.tfvars|.terraform'
.
β”œβ”€β”€ .gitignore
β”œβ”€β”€ CODEOWNERS
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ infra
β”‚Β Β  β”œβ”€β”€ README.md
β”‚Β Β  └── instances
β”‚Β Β      β”œβ”€β”€ production
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ .terraform.lock.hcl
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ main.tf
β”‚Β Β      β”‚Β Β  └── terraform.auto.tfvars.example
β”‚Β Β      └── staging
β”‚Β Β          β”œβ”€β”€ .terraform.lock.hcl
β”‚Β Β          β”œβ”€β”€ create_staging_resource.sh
β”‚Β Β          β”œβ”€β”€ extra_staging.tf.example
β”‚Β Β          β”œβ”€β”€ main.tf
β”‚Β Β          └── terraform.tfvars.auto.example
└── web
    β”œβ”€β”€ README.md
    β”œβ”€β”€ app.js
    β”œβ”€β”€ bin
    β”‚Β Β  └── www
    β”œβ”€β”€ package-lock.json
    β”œβ”€β”€ package.json
    β”œβ”€β”€ public
    β”‚Β Β  β”œβ”€β”€ javascripts
    β”‚Β Β  └── stylesheets
    β”‚Β Β      └── style.css
    β”œβ”€β”€ routes
    β”‚Β Β  β”œβ”€β”€ index.js
    β”‚Β Β  └── users.js
    β”œβ”€β”€ tests
    β”‚Β Β  β”œβ”€β”€ app.test.js
    β”‚Β Β  └── routes.test.js
    └── views
        β”œβ”€β”€ error.jade
        β”œβ”€β”€ index.jade
        └── layout.jade

12 directories, 26 files
  • infra/images: contains Packer template to build our AWS EC2 AMI
  • infra/instances: contains our Terraform templates to setup our staging and production EC2 instances
  • web: contains our simple Express web application

Setup

Configure your GitHub repository to run the workflows

Click to expand
  1. Navigate to the Settings in your repository then to Environments 37EE1AFF-BDBC-405E-8D43-672E09CA87D5

  2. Add a new environment and call it staging (or anything else you like) F1BC0A94-3BB5-4409-B057-6E6FC241C78A

  3. Enable required reviewers and add your secrets 085BF9C1-552E-46C5-91D0-687A9634A885

  4. Enable branch protection on the main branch 2E8B02F5-CD8E-40C1-B03C-5FD7074C1C77 955A1F29-D628-46C4-86A4-8F614A712CFF

Test your setup

  1. Create a new branch from the main branch and make some changes to the app
  2. Push the new branch to GitHub
  3. Watch the CI workflow being triggered
  4. Troubleshoot issues as they rise

LICENSE

Copyright (c) 2021 Bassem Dghaidi (@Link-)

About

Intro to CI/CD πŸ’» ☁️

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 37.2%
  • JavaScript 32.7%
  • HCL 26.6%
  • Pug 2.4%
  • Other 1.1%