My work on online cource about CircleCI
TODO: write prefrace Something about CI/CD and CircleCI
Create your first first pipeline in CircleCI that will combine a few simple jobs
- connect github to CircleCI
- create new repo
- create simple config file (.circleci/config.yml)
- use docker image and echo some text
- set working_directory
- 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
- print: workflow id, branch name and number of the build
- add an environment variable in project settings
- add a job that will print your environment variable
What is the difference between Organization, Project and Job environment variabls scopes?
Can you use pipeline values outside of job context. Can you use them for example in your shell script?
Read about persisting data in CircleCI
Caching is particularly useful with package dependency managers Caching persists data between the same job in different Workflow builds.
- 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.
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.
- 1
- 2
Artifacts persist data after a Workflow has finished.
- 1
- 2
- 1
- 2
- https://circleci.com/blog/deep-diving-into-circleci-workspaces/
- https://circleci.com/docs/2.0/configuration-reference/#executors-requires-version-21
Controlling workflow
- 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
- add step that will execute on fail
- add approval step between test and deploy jobs
Write a reusable command that destroys the stack if deployment failed
- 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
- add_ssh_keys option
- 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
- add context
- add slack integration
- working with API v2
- personal-api-token
- local CLI
- SSH into your build