Skip to content

Commit a336d95

Browse files
Sagar VelankarSagar Velankar
authored andcommitted
Add steps to documentation
1 parent 27231f0 commit a336d95

File tree

3 files changed

+39
-55
lines changed

3 files changed

+39
-55
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ repos:
2626
- id: check-shebang-scripts-are-executable
2727
- id: pretty-format-json
2828
args: ["--autofix"]
29+
exclude: ^.*\/_meta\.json$
2930
- id: check-merge-conflict
3031
- id: check-symlinks
3132
- id: check-toml

docs/pages/docs/_meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"index": "Introduction",
3-
"cicd_pipeline_stages": "CI/CD pipeline stages"
3+
"cicd_pipeline": "CI/CD pipeline"
44
}

docs/pages/docs/cicd_pipeline_stages.mdx renamed to docs/pages/docs/cicd_pipeline.mdx

Lines changed: 37 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Steps } from 'nextra/components'
2+
13
## Features to be implemented
24
- WHERE DO WE KEEP END TO END, PERFORMANCE, SYNTHETIC AND RESILIENCE TESTING CODE SINCE ALL OF THIS CODE IS FOR ENTIRE APPLICATION OR ORGANIZATIONAL UNIT***
35
- Maybe an application component with the name of the application and one with the name of the organizational unit will have all devops and testing code related to them.
@@ -8,13 +10,15 @@
810
- opentelemetry
911
<br/><br/>
1012

13+
# CI/CD Pipeline
14+
1115
## Pre-commit hooks
16+
1217
- pre-commit or husky
1318
- pre-commit should call linters
1419
- they should also call sonarlint
1520
- Identify secrets such as usernames, passwords, and access keys in code. Examples of secret detection tools include but are not limited to GitGuardian, gitleaks, Yelp Detect Secrets, AWS Git Secrets. Secrets should not be committed to local repository and/or pushed to remote repository. If hacker gets access to code repository, they could read the secrets from commit history.
1621
- if we change something in pre-commit we need to run unit tests again. so unit tests should be last step of pre-commit.
17-
<br/><br/>
1822

1923
## Trigger
2024
- Feature issues created for each feature to be implemented.
@@ -29,15 +33,16 @@
2933
- Due to continuous integration, not all acceptance criteria may have been covered in the test source code.
3034
- Before closing the issue, all acceptance criteria must have been covered by the test source code and CI/CD pipeline ( with all tests ) should be successful.
3135

32-
## Inputs and outputs of each stage
36+
## Stages
37+
3338
- Each stage needs some inputs. These need to be generated by previous stages and stored in a central place since the stages may run inside short lived containers.
3439
- Stashing
3540
- Each stage generates some outputs like test reports and security scan reports. These need to be collected and stored in a central place since the stages may run inside short lived containers. In the always stage, these test reports and security scan reports can then be uploaded or delivered to required consumers.
3641

37-
## Pre-checkout initialize variables
38-
<br/><br/>
42+
<Steps>
43+
### Pre-checkout initialize variables
3944

40-
## Checkout
45+
### Checkout
4146
- Application component source code
4247
- Code that is compiled, transpiled or interpreted for the purpose of delivering business capabilities through applications and/or services.
4348
- Test source code
@@ -64,110 +69,92 @@
6469
- Examples of database source code include but are not limited to Liquibase.
6570
- If the Application component source code uses a private database that no other application component accesses, then the database source code is required to be stored in the same repository as the Application component source code. This allows the Application component source code and Database source code to be updated on the same lifecycle.
6671
- However, if the database is shared by multiple application components then the Database source code should be maintained in a separate repository and managed by separate pipeline. It should be noted that this is undesireable as it introduces coupling between application components.
67-
<br/><br/>
6872

6973

70-
## Post-checkout initialize variables
71-
<br/><br/>
74+
### Post-checkout initialize variables
7275

73-
## Devops code build and unit tests and package ( Pre-build test )
76+
### Devops code build and unit tests and package ( Pre-build test )
7477
- Run build, unit tests and package for devops code like cicd pipeline, container image, container deployment, vm image, vm deployment, database, infrastructure, observability code.
7578
- Examples of tools are terratest for infrastructure code.
7679
- Need to download dependencies like terraform modules, cdk jars, etc.
7780
- If using cdk with java, need to create cdk application jar.
78-
<br/><br/>
7981

80-
## Devops code security scans ( Pre-build test ) ( Security scan )
82+
### Devops code security scans ( Pre-build test ) ( Security scan )
8183
- Run security scans for devops code like cicd pipeline, container image, container deployment, vm image, vm deployment, database, infrastructure, observability
8284
- Examples of tools are Checkov.
8385
- It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
8486
- Policy as code
85-
<br/><br/>
8687

87-
## Download dependencies
88+
### Download dependencies
8889
- Convert code into artifacts that can be promoted through environments.
8990
- Examples include but are not limited to Maven, Npm, Pip, Poetry, Nuget.
9091
- Mandatory to cache the dependencies for faster build
9192
- Recommend to use a location outside the checked out repository.
92-
<br/><br/>
9393

94-
## Build
94+
### Build
9595
- Convert code into artifacts that can be promoted through environments.
9696
- Compile the code
9797
- Lint the code
9898
- Examples include but are not limited to Maven, Npm, tsc, Poetry, Msbuild.
99-
<br/><br/>
10099

101-
## Unit tests ( Post-build test )
100+
### Unit tests ( Post-build test )
102101
- Run the test code to verify that individual functions and methods of classes, components or modules of the Application source code are performing according to expectations.
103102
- These tests are fast-running tests with zero dependencies on external systems returning results in seconds.
104103
- Examples of unit testing frameworks include but are not limited to JUnit, Jest, and pytest.
105-
<br/><br/>
106104

107-
## Package
105+
### Package
108106
- While the Build Code action will package most of the relevant artifacts, there may be additional steps to automate for packaging the code artifacts.
109107
- Artifacts should only be built and packaged once and then deployed to various environments to validate the artifact. Artifacts should never be rebuilt during subsequent deploy stages.
110108
- Packages should be signed with a digital-signature to allow deployment processes to confirm the code being deployed is from a trusted publisher and has not been altered. AWS Signer can be used to cryptographically sign code for AWS Lambda applications and AWS-supported IoT devices.
111109
- Get the version number from the release branch tag.
112-
<br/><br/>
113110

114-
## Software bill of materials (SBOM) ( Post-package test )
111+
### Software bill of materials (SBOM) ( Post-package test )
115112
- Generate a software bill of materials (SBOM) report detailing all the dependencies used. Examples of SBOM formats include SPDX and CycloneDX
116113
- SBOM should be published to somewhere like JIRA for updating issues and ITSM for attaching to Change Requests.
117-
<br/><br/>
118114

119-
## Software composition analysis (SCA) ( Post-package test ) ( Security scan )
115+
### Software composition analysis (SCA) ( Post-package test ) ( Security scan )
120116
- Run software composition analysis (SCA) tools to find vulnerabilities to package repositories related to open source use, licensing, and security vulnerabilities. SCA tools also launch workflows to fix these vulnerabilities.
121117
- These tools also require a software bill of materials (SBOM) exist.
122118
- Example SCA tools include but are not limited to Dependabot, Snyk, Blackduck, OWASP Dependency Check
123119
- It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
124-
<br/><br/>
125120

126-
## Secrets scanning ( Post-package test ) ( Security scan )
121+
### Secrets scanning ( Post-package test ) ( Security scan )
127122
- Identify secrets such as usernames, passwords, and access keys in artifacts.
128123
- Examples of secret detection tools include but are not limited to GitGuardian, gitleaks, Yelp Detect Secrets, AWS Git Secrets
129124
- Secrets scanning should be part of pre-commit and so secrets should not be committed to local repository and/or pushed to remote repository.
130125
- It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
131-
<br/><br/>
132126

133-
## Static application security testing (SAST) ( Post-package test ) ( Security scan )
127+
### Static application security testing (SAST) ( Post-package test ) ( Security scan )
134128
- Analyze code for application security violations such as XML External Entity Processing, SQL Injection, and Cross Site Scripting.
135129
- Examples of tools to perform static application security testing include but are not limited to SonarQube, Checkmarx and Amazon CodeGuru.
136130
- It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
137-
<br/><br/>
138131

139-
## Infrastructure code security and compliance scanning ( Post-package test ) ( Security scan )
132+
### Infrastructure code security and compliance scanning ( Post-package test ) ( Security scan )
140133
- tfsec(trivy) for Terraform, trivy(cfsec) for CloudFormation, Checkov for Terraform, Helm Charts, Cloudformation, Azure Resource Manager, Serverless Framework, Kubernetes, Docker
141134
- Policy as code
142135
- It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
143-
<br/><br/>
144136

145-
## Container image and other build artifacts security scanning ( Post-package test ) ( Security scan )
137+
### Container image and other build artifacts security scanning ( Post-package test ) ( Security scan )
146138
- trivy for containers
147139
- It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
148-
<br/><br/>
149140

150-
## Anti-virus Scanning ( Post-package test ) ( Security scan )
141+
### Anti-virus Scanning ( Post-package test ) ( Security scan )
151142
- ClamAV
152143
- It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
153-
<br/><br/>
154144

155-
## Static code analysis ( Post-package test )
145+
### Static code analysis ( Post-package test )
156146
- Run various automated static analysis tools that generate reports on bugs, readability, maintainability, code quality, coding standards, code coverage, and other aspects according to the team and/or organization’s best practices.
157147
- Examples of tools to measure code quality include but are not limited to SonarQube, black, ESLint, Amazon CodeGuru.
158-
<br/><br/>
159148

160-
## Database changes quality checks ( Post-package test )
149+
### Database changes quality checks ( Post-package test )
161150
- Liquibase
162-
<br/><br/>
163151

164-
## Push Artifacts
152+
### Push Artifacts
165153
- Examples of artifact repositories include but are not limited to Nexus, JFrog Artifactory, AWS CodeArtifact, Amazon ECR.
166154
- When artifacts are published to Artifact repository tools like Sonatype nexus, jfrog artifactory, etc. they can run security scans like SCA and reject the publish if the security scans fail.
167155
- It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
168-
<br/><br/>
169156

170-
## Deploy and test in component testing environment
157+
### Deploy and test in component testing environment
171158
- Producer/Upstream application components are simulated.
172159
- Only this application component is tested.
173160
- Consumers/Downstream of this application component are not tested.
@@ -201,9 +188,8 @@
201188
- The thresholds for metric alarms should be defined in the Infrastructure Source Code and deployed along with the rest of the infrastructure in an environment.
202189
- Ideally, deployments should be automatically failed and rolled back when error thresholds are breached.
203190
- Destroy consumer/downstream application component component testing environment kubernetes namespace or cloud account
204-
<br/><br/>
205191

206-
## Deploy and test in integration testing environment
192+
### Deploy and test in integration testing environment
207193
- Producer/Upstream application components are real.
208194
- Only this application component is tested.
209195
- Consumers/Downstream of this application component are not tested.
@@ -246,9 +232,8 @@
246232
- In case of failures, rollback and create bug issue
247233
- Examples of automated rollback include AWS CloudFormation monitor & rollback, AWS CodeDeploy rollback and Flagger.
248234
- Retest to ensure rollback is successful.
249-
<br/><br/>
250235

251-
## Deploy and test in end to end testing environment
236+
### Deploy and test in end to end testing environment
252237
- All application components of the application are tested. Journeys are used for testing.
253238
- Pull artifacts
254239
- Artifacts to be deployed should include digital signatures to verify that the artifact came from a trusted source and that no changes were made to the artifact.
@@ -281,9 +266,8 @@
281266
- In case of failures, rollback and create bug issue
282267
- Examples of automated rollback include AWS CloudFormation monitor & rollback, AWS CodeDeploy rollback and Flagger.
283268
- Retest to ensure rollback is successful.
284-
<br/><br/>
285269

286-
## Deploy and test in performance testing environment
270+
### Deploy and test in performance testing environment
287271
- All application components of the application are performance and resilience tested. Journeys are used for testing.
288272
- Pull artifacts
289273
- Artifacts to be deployed should include digital signatures to verify that the artifact came from a trusted source and that no changes were made to the artifact.
@@ -348,16 +332,14 @@
348332
- In case of failures, rollback and create bug issue
349333
- Examples of automated rollback include AWS CloudFormation monitor & rollback, AWS CodeDeploy rollback and Flagger.
350334
- Retest to ensure rollback is successful.
351-
<br/><br/>
352335

353-
## Create release OR
336+
### Create release OR
354337
- Pull artifacts
355338
- Manual approval
356339
- As part of an automated workflow, obtain authorized human approval.
357340
- Need to provide RFC and change request number
358-
<br/><br/>
359341

360-
## OR Deploy to production environment
342+
### OR Deploy to production environment
361343
- Pull artifacts
362344
- Artifacts to be deployed should include digital signatures to verify that the artifact came from a trusted source and that no changes were made to the artifact.
363345
- Manual approval
@@ -388,9 +370,8 @@
388370
- Deployed infrastructure security and compliance scanning
389371
- In case of failures, rollback and create problem issue
390372
- Examples of automated rollback include AWS CloudFormation monitor & rollback, AWS CodeDeploy rollback and Flagger.
391-
<br/><br/>
392373

393-
## Always
374+
### Always
394375
- Publish testing and security scanning results to somewhere like
395376
- JIRA for updating issues
396377
- ITSM for attaching to Change Requests and RFCs for testing proof.
@@ -412,4 +393,6 @@
412393
- Communication and Collaboration
413394
- Update JIRA Issue. Send Notification via email,sms,etc.
414395
- Cleanup
415-
- Docker logout
396+
- Docker logout
397+
398+
</Steps>

0 commit comments

Comments
 (0)