|
| 1 | +import { Steps } from 'nextra/components' |
| 2 | + |
1 | 3 | ## Features to be implemented
|
2 | 4 | - 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***
|
3 | 5 | - 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 | 10 | - opentelemetry
|
9 | 11 | <br/><br/>
|
10 | 12 |
|
| 13 | +# CI/CD Pipeline |
| 14 | + |
11 | 15 | ## Pre-commit hooks
|
| 16 | + |
12 | 17 | - pre-commit or husky
|
13 | 18 | - pre-commit should call linters
|
14 | 19 | - they should also call sonarlint
|
15 | 20 | - 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.
|
16 | 21 | - 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/> |
18 | 22 |
|
19 | 23 | ## Trigger
|
20 | 24 | - Feature issues created for each feature to be implemented.
|
|
29 | 33 | - Due to continuous integration, not all acceptance criteria may have been covered in the test source code.
|
30 | 34 | - 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.
|
31 | 35 |
|
32 |
| -## Inputs and outputs of each stage |
| 36 | +## Stages |
| 37 | + |
33 | 38 | - 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.
|
34 | 39 | - Stashing
|
35 | 40 | - 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.
|
36 | 41 |
|
37 |
| -## Pre-checkout initialize variables |
38 |
| -<br/><br/> |
| 42 | +<Steps> |
| 43 | +### Pre-checkout initialize variables |
39 | 44 |
|
40 |
| -## Checkout |
| 45 | +### Checkout |
41 | 46 | - Application component source code
|
42 | 47 | - Code that is compiled, transpiled or interpreted for the purpose of delivering business capabilities through applications and/or services.
|
43 | 48 | - Test source code
|
|
64 | 69 | - Examples of database source code include but are not limited to Liquibase.
|
65 | 70 | - 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.
|
66 | 71 | - 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/> |
68 | 72 |
|
69 | 73 |
|
70 |
| -## Post-checkout initialize variables |
71 |
| -<br/><br/> |
| 74 | +### Post-checkout initialize variables |
72 | 75 |
|
73 |
| -## Devops code build and unit tests and package ( Pre-build test ) |
| 76 | +### Devops code build and unit tests and package ( Pre-build test ) |
74 | 77 | - Run build, unit tests and package for devops code like cicd pipeline, container image, container deployment, vm image, vm deployment, database, infrastructure, observability code.
|
75 | 78 | - Examples of tools are terratest for infrastructure code.
|
76 | 79 | - Need to download dependencies like terraform modules, cdk jars, etc.
|
77 | 80 | - If using cdk with java, need to create cdk application jar.
|
78 |
| -<br/><br/> |
79 | 81 |
|
80 |
| -## Devops code security scans ( Pre-build test ) ( Security scan ) |
| 82 | +### Devops code security scans ( Pre-build test ) ( Security scan ) |
81 | 83 | - Run security scans for devops code like cicd pipeline, container image, container deployment, vm image, vm deployment, database, infrastructure, observability
|
82 | 84 | - Examples of tools are Checkov.
|
83 | 85 | - It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
|
84 | 86 | - Policy as code
|
85 |
| -<br/><br/> |
86 | 87 |
|
87 |
| -## Download dependencies |
| 88 | +### Download dependencies |
88 | 89 | - Convert code into artifacts that can be promoted through environments.
|
89 | 90 | - Examples include but are not limited to Maven, Npm, Pip, Poetry, Nuget.
|
90 | 91 | - Mandatory to cache the dependencies for faster build
|
91 | 92 | - Recommend to use a location outside the checked out repository.
|
92 |
| -<br/><br/> |
93 | 93 |
|
94 |
| -## Build |
| 94 | +### Build |
95 | 95 | - Convert code into artifacts that can be promoted through environments.
|
96 | 96 | - Compile the code
|
97 | 97 | - Lint the code
|
98 | 98 | - Examples include but are not limited to Maven, Npm, tsc, Poetry, Msbuild.
|
99 |
| -<br/><br/> |
100 | 99 |
|
101 |
| -## Unit tests ( Post-build test ) |
| 100 | +### Unit tests ( Post-build test ) |
102 | 101 | - 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.
|
103 | 102 | - These tests are fast-running tests with zero dependencies on external systems returning results in seconds.
|
104 | 103 | - Examples of unit testing frameworks include but are not limited to JUnit, Jest, and pytest.
|
105 |
| -<br/><br/> |
106 | 104 |
|
107 |
| -## Package |
| 105 | +### Package |
108 | 106 | - While the Build Code action will package most of the relevant artifacts, there may be additional steps to automate for packaging the code artifacts.
|
109 | 107 | - 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.
|
110 | 108 | - 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.
|
111 | 109 | - Get the version number from the release branch tag.
|
112 |
| -<br/><br/> |
113 | 110 |
|
114 |
| -## Software bill of materials (SBOM) ( Post-package test ) |
| 111 | +### Software bill of materials (SBOM) ( Post-package test ) |
115 | 112 | - Generate a software bill of materials (SBOM) report detailing all the dependencies used. Examples of SBOM formats include SPDX and CycloneDX
|
116 | 113 | - SBOM should be published to somewhere like JIRA for updating issues and ITSM for attaching to Change Requests.
|
117 |
| -<br/><br/> |
118 | 114 |
|
119 |
| -## Software composition analysis (SCA) ( Post-package test ) ( Security scan ) |
| 115 | +### Software composition analysis (SCA) ( Post-package test ) ( Security scan ) |
120 | 116 | - 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.
|
121 | 117 | - These tools also require a software bill of materials (SBOM) exist.
|
122 | 118 | - Example SCA tools include but are not limited to Dependabot, Snyk, Blackduck, OWASP Dependency Check
|
123 | 119 | - It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
|
124 |
| -<br/><br/> |
125 | 120 |
|
126 |
| -## Secrets scanning ( Post-package test ) ( Security scan ) |
| 121 | +### Secrets scanning ( Post-package test ) ( Security scan ) |
127 | 122 | - Identify secrets such as usernames, passwords, and access keys in artifacts.
|
128 | 123 | - Examples of secret detection tools include but are not limited to GitGuardian, gitleaks, Yelp Detect Secrets, AWS Git Secrets
|
129 | 124 | - Secrets scanning should be part of pre-commit and so secrets should not be committed to local repository and/or pushed to remote repository.
|
130 | 125 | - It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
|
131 |
| -<br/><br/> |
132 | 126 |
|
133 |
| -## Static application security testing (SAST) ( Post-package test ) ( Security scan ) |
| 127 | +### Static application security testing (SAST) ( Post-package test ) ( Security scan ) |
134 | 128 | - Analyze code for application security violations such as XML External Entity Processing, SQL Injection, and Cross Site Scripting.
|
135 | 129 | - Examples of tools to perform static application security testing include but are not limited to SonarQube, Checkmarx and Amazon CodeGuru.
|
136 | 130 | - It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
|
137 |
| -<br/><br/> |
138 | 131 |
|
139 |
| -## Infrastructure code security and compliance scanning ( Post-package test ) ( Security scan ) |
| 132 | +### Infrastructure code security and compliance scanning ( Post-package test ) ( Security scan ) |
140 | 133 | - tfsec(trivy) for Terraform, trivy(cfsec) for CloudFormation, Checkov for Terraform, Helm Charts, Cloudformation, Azure Resource Manager, Serverless Framework, Kubernetes, Docker
|
141 | 134 | - Policy as code
|
142 | 135 | - It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
|
143 |
| -<br/><br/> |
144 | 136 |
|
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 ) |
146 | 138 | - trivy for containers
|
147 | 139 | - It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
|
148 |
| -<br/><br/> |
149 | 140 |
|
150 |
| -## Anti-virus Scanning ( Post-package test ) ( Security scan ) |
| 141 | +### Anti-virus Scanning ( Post-package test ) ( Security scan ) |
151 | 142 | - ClamAV
|
152 | 143 | - It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
|
153 |
| -<br/><br/> |
154 | 144 |
|
155 |
| -## Static code analysis ( Post-package test ) |
| 145 | +### Static code analysis ( Post-package test ) |
156 | 146 | - 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.
|
157 | 147 | - Examples of tools to measure code quality include but are not limited to SonarQube, black, ESLint, Amazon CodeGuru.
|
158 |
| -<br/><br/> |
159 | 148 |
|
160 |
| -## Database changes quality checks ( Post-package test ) |
| 149 | +### Database changes quality checks ( Post-package test ) |
161 | 150 | - Liquibase
|
162 |
| -<br/><br/> |
163 | 151 |
|
164 |
| -## Push Artifacts |
| 152 | +### Push Artifacts |
165 | 153 | - Examples of artifact repositories include but are not limited to Nexus, JFrog Artifactory, AWS CodeArtifact, Amazon ECR.
|
166 | 154 | - 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.
|
167 | 155 | - It is recommended to use security platform like Checkmarx or Veracode for security scans and only use better tool if available.
|
168 |
| -<br/><br/> |
169 | 156 |
|
170 |
| -## Deploy and test in component testing environment |
| 157 | +### Deploy and test in component testing environment |
171 | 158 | - Producer/Upstream application components are simulated.
|
172 | 159 | - Only this application component is tested.
|
173 | 160 | - Consumers/Downstream of this application component are not tested.
|
|
201 | 188 | - 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.
|
202 | 189 | - Ideally, deployments should be automatically failed and rolled back when error thresholds are breached.
|
203 | 190 | - Destroy consumer/downstream application component component testing environment kubernetes namespace or cloud account
|
204 |
| -<br/><br/> |
205 | 191 |
|
206 |
| -## Deploy and test in integration testing environment |
| 192 | +### Deploy and test in integration testing environment |
207 | 193 | - Producer/Upstream application components are real.
|
208 | 194 | - Only this application component is tested.
|
209 | 195 | - Consumers/Downstream of this application component are not tested.
|
|
246 | 232 | - In case of failures, rollback and create bug issue
|
247 | 233 | - Examples of automated rollback include AWS CloudFormation monitor & rollback, AWS CodeDeploy rollback and Flagger.
|
248 | 234 | - Retest to ensure rollback is successful.
|
249 |
| -<br/><br/> |
250 | 235 |
|
251 |
| -## Deploy and test in end to end testing environment |
| 236 | +### Deploy and test in end to end testing environment |
252 | 237 | - All application components of the application are tested. Journeys are used for testing.
|
253 | 238 | - Pull artifacts
|
254 | 239 | - 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 | 266 | - In case of failures, rollback and create bug issue
|
282 | 267 | - Examples of automated rollback include AWS CloudFormation monitor & rollback, AWS CodeDeploy rollback and Flagger.
|
283 | 268 | - Retest to ensure rollback is successful.
|
284 |
| -<br/><br/> |
285 | 269 |
|
286 |
| -## Deploy and test in performance testing environment |
| 270 | +### Deploy and test in performance testing environment |
287 | 271 | - All application components of the application are performance and resilience tested. Journeys are used for testing.
|
288 | 272 | - Pull artifacts
|
289 | 273 | - 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 | 332 | - In case of failures, rollback and create bug issue
|
349 | 333 | - Examples of automated rollback include AWS CloudFormation monitor & rollback, AWS CodeDeploy rollback and Flagger.
|
350 | 334 | - Retest to ensure rollback is successful.
|
351 |
| -<br/><br/> |
352 | 335 |
|
353 |
| -## Create release OR |
| 336 | +### Create release OR |
354 | 337 | - Pull artifacts
|
355 | 338 | - Manual approval
|
356 | 339 | - As part of an automated workflow, obtain authorized human approval.
|
357 | 340 | - Need to provide RFC and change request number
|
358 |
| -<br/><br/> |
359 | 341 |
|
360 |
| -## OR Deploy to production environment |
| 342 | +### OR Deploy to production environment |
361 | 343 | - Pull artifacts
|
362 | 344 | - 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.
|
363 | 345 | - Manual approval
|
|
388 | 370 | - Deployed infrastructure security and compliance scanning
|
389 | 371 | - In case of failures, rollback and create problem issue
|
390 | 372 | - Examples of automated rollback include AWS CloudFormation monitor & rollback, AWS CodeDeploy rollback and Flagger.
|
391 |
| -<br/><br/> |
392 | 373 |
|
393 |
| -## Always |
| 374 | +### Always |
394 | 375 | - Publish testing and security scanning results to somewhere like
|
395 | 376 | - JIRA for updating issues
|
396 | 377 | - ITSM for attaching to Change Requests and RFCs for testing proof.
|
|
412 | 393 | - Communication and Collaboration
|
413 | 394 | - Update JIRA Issue. Send Notification via email,sms,etc.
|
414 | 395 | - Cleanup
|
415 |
| - - Docker logout |
| 396 | + - Docker logout |
| 397 | + |
| 398 | +</Steps> |
0 commit comments