Giter Site home page Giter Site logo

circleci-learn's Introduction

CircleCI learning path

My work on online cource about CircleCI

Guidance

Lesson 1: Creating a simple workflow

Principle 1

TODO: write prefrace Something about CI/CD and CircleCI

Practice 1

Create your first first pipeline in CircleCI that will combine a few simple jobs

Lab 1.1: Setup your first project

  • connect github to CircleCI
  • create new repo
  • create simple config file (.circleci/config.yml)
  • use docker image and echo some text
  • set working_directory

Lab 1.2: Create jobs and workflow

  • create workflow with 3 jobs: test build deploy
  • create simple bash script that will echo some text and create file
  • add checkout step
  • add step where you execute your script

Lab 1.3: Use built-in env variables

  • print: workflow id, branch name and number of the build

Lab 1.4: Create env variables

  • add an environment variable in project settings
  • add a job that will print your environment variable

Retrospective

Question 1:

What is the difference between Organization, Project and Job environment variabls scopes?

Question 2:

Can you use pipeline values outside of job context. Can you use them for example in your shell script?


Lesson 2: Persisting data in Workflows

Read about persisting data in CircleCI

Principle 1

Caching is particularly useful with package dependency managers Caching persists data between the same job in different Workflow builds.

Practice 1

Lab 2.1: Cache dependencies

  • create python virtual environment
  • install packages
  • Use the save_cache step to cache virtual environment and installed packages
  • Use the restore_cache step to restore cached files or directories.

Principle 2

Workspaces persist data between jobs in a single Workflow. Unlike caching, workspaces are not shared between runs as they no longer exists once a workflow is complete.

Practice 2

Lab 2.2: Use workspaces

  • 1
  • 2

Principle 3

Artifacts persist data after a Workflow has finished.

Practice 3

Lab 2.3: Create artifacts in build job

  • 1
  • 2

Lab 2.4: Save Test results

  • 1
  • 2

Further Reading


Lesson 3: Controlling jobs

Principle 1

Practice 1

Controlling workflow

Lab 3.1: Execute job only for a specific branch

  • create a new branch in your repo
  • configure execution of one of the jobs in the workflow to run only when changes pushed only to a new branch
  • push your changes at first into main(master) branch - see if the job will run. Then push your changes into new branch and check again

Lab 3.2: Handle failure

  • add step that will execute on fail

Lab 3.3: Add approval step

  • add approval step between test and deploy jobs

Lab 3.4: Logic statements

Practice 2

Write a reusable command that destroys the stack if deployment failed

Lab 3.4: Use commands to perform rollback

  • create a simple CloudFormation template that will create some infrastructure.
  • write a job that creates a new stack using template you defined. You can use amazon/aws-cli image
  • make your job intentionally fail
  • Add a command-step that only executes if the job fails

Lab 3.5: Use orbs

Lesson 4: Manage Secrets

Principle 1

  • add_ssh_keys option

Lab 4.1:

  • Create a key pair
  • add contents of PEM file to the SSH keys into CircleCI
  • create CFN template that creates EC2 instance. Use your key pair

Principle 2

  • add context
  • add slack integration

Lesson 5: Appendix


Further Reading

circleci-learn's People

Contributors

nbekenov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.