Skip to content

Commit 1392672

Browse files
authored
ci: reorganize test and deploy configuration (#60)
- Reorder jobs and workflows definitions - Rename `generate_sbom_and_assess_image` to `assess_image_and_generate_sbom`
1 parent 1b5c196 commit 1392672

File tree

1 file changed

+89
-90
lines changed

1 file changed

+89
-90
lines changed

.circleci/test-deploy.yml

Lines changed: 89 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,67 @@ release-filters: &release-filters
1616
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
1717

1818
jobs:
19+
install_gitleaks:
20+
executor: core/node
21+
steps:
22+
- security/install_gitleaks:
23+
version: v8.25.1
24+
- run:
25+
name: Validate installation
26+
command: |
27+
if ! gitleaks --version | grep -q "8.25.1"; then
28+
echo "Failed to install chosen gitleaks version"
29+
exit 1
30+
fi
31+
install_grype:
32+
executor: core/node
33+
steps:
34+
- security/install_grype:
35+
version: v0.92.1
36+
- run:
37+
name: Validate installation
38+
command: |
39+
if ! grype --version | grep -q "0.92.1"; then
40+
echo "Failed to install chosen grype version"
41+
exit 1
42+
fi
43+
install_semgrep:
44+
machine:
45+
image: ubuntu-2404:current
46+
steps:
47+
- security/install_semgrep:
48+
version: v1.121.0
49+
- run:
50+
name: Validate installation
51+
command: |
52+
if ! semgrep --version | grep -q "1.121.0"; then
53+
echo "Failed to install chosen semgrep version"
54+
exit 1
55+
fi
56+
install_syft:
57+
executor: core/node
58+
steps:
59+
- security/install_syft:
60+
version: v1.25.1
61+
- run:
62+
name: Validate installation
63+
command: |
64+
if ! syft --version | grep -q "1.25.1"; then
65+
echo "Failed to install chosen syft version"
66+
exit 1
67+
fi
68+
install_trivy:
69+
executor: core/node
70+
steps:
71+
- security/install_trivy:
72+
version: v0.59.1
73+
- run:
74+
name: Validate installation
75+
command: |
76+
if ! trivy --version | grep -q "0.59.1"; then
77+
echo "Failed to install chosen trivy version"
78+
exit 1
79+
fi
1980
scan_dependencies_prod_npm:
2081
executor: core/node
2182
steps:
@@ -48,7 +109,7 @@ jobs:
48109
- checkout
49110
- security/scan_dockerfile:
50111
dockerfile_dir: ./sample
51-
generate_sbom_and_assess_image:
112+
assess_image_and_generate_sbom:
52113
machine:
53114
image: ubuntu-2404:current
54115
steps:
@@ -64,15 +125,6 @@ jobs:
64125
- run:
65126
name: Export image as env
66127
command: echo "export IMAGE_TO_USE=docker.io/security-sample:v1" >> "${BASH_ENV}"
67-
- security/generate_sbom:
68-
image: ${IMAGE_TO_USE}
69-
- run:
70-
name: Check SBOM output
71-
command: |
72-
if [ ! -f "/tmp/security-orb/output/sbom.json" ]; then
73-
echo "SBOM output not found"
74-
exit 1
75-
fi
76128
- security/assess_image:
77129
image: ${IMAGE_TO_USE}
78130
severity: critical
@@ -83,85 +135,32 @@ jobs:
83135
echo "Vulnerability report not found"
84136
exit 1
85137
fi
138+
- security/generate_sbom:
139+
image: ${IMAGE_TO_USE}
86140
- run:
87-
name: Cleanup
88-
command: |
89-
rm -f /tmp/sample-sbom.json
90-
rm -f /tmp/sample-vuln-report.json
91-
install_trivy:
92-
executor: core/node
93-
steps:
94-
- security/install_trivy:
95-
version: v0.59.1
96-
- run:
97-
name: Validate installation
98-
command: |
99-
if ! trivy --version | grep -q "0.59.1"; then
100-
echo "Failed to install chosen trivy version"
101-
exit 1
102-
fi
103-
install_syft:
104-
executor: core/node
105-
steps:
106-
- security/install_syft:
107-
version: v1.25.1
108-
- run:
109-
name: Validate installation
110-
command: |
111-
if ! syft --version | grep -q "1.25.1"; then
112-
echo "Failed to install chosen syft version"
113-
exit 1
114-
fi
115-
install_grype:
116-
executor: core/node
117-
steps:
118-
- security/install_grype:
119-
version: v0.92.1
120-
- run:
121-
name: Validate installation
122-
command: |
123-
if ! grype --version | grep -q "0.92.1"; then
124-
echo "Failed to install chosen grype version"
125-
exit 1
126-
fi
127-
install_semgrep:
128-
machine:
129-
image: ubuntu-2404:current
130-
steps:
131-
- security/install_semgrep:
132-
version: v1.121.0
133-
- run:
134-
name: Validate installation
141+
name: Check SBOM output
135142
command: |
136-
if ! semgrep --version | grep -q "1.121.0"; then
137-
echo "Failed to install chosen semgrep version"
143+
if [ ! -f "/tmp/security-orb/output/sbom.json" ]; then
144+
echo "SBOM output not found"
138145
exit 1
139146
fi
140-
install_gitleaks:
141-
executor: core/node
142-
steps:
143-
- security/install_gitleaks:
144-
version: v8.25.1
145147
- run:
146-
name: Validate installation
148+
name: Cleanup
147149
command: |
148-
if ! gitleaks --version | grep -q "8.25.1"; then
149-
echo "Failed to install chosen gitleaks version"
150-
exit 1
151-
fi
150+
rm -f /tmp/security-orb/output/*
152151
153152
workflows:
154153
test-deploy:
155154
jobs:
156-
- scan_dependencies_prod_npm:
155+
- install_gitleaks:
157156
filters: *filters
158-
- scan_dependencies_prod_pnpm:
157+
- install_grype:
159158
filters: *filters
160-
- scan_dependencies_command:
159+
- install_semgrep:
161160
filters: *filters
162-
- scan_dockerfile:
161+
- install_syft:
163162
filters: *filters
164-
- generate_sbom_and_assess_image:
163+
- install_trivy:
165164
filters: *filters
166165
- security/detect_secrets_dir:
167166
name: detect_secrets_dir
@@ -191,15 +190,15 @@ workflows:
191190
name: analyze_code_full
192191
rules: p/cwe-top-25
193192
filters: *filters
194-
- install_trivy:
193+
- scan_dependencies_prod_npm:
195194
filters: *filters
196-
- install_syft:
195+
- scan_dependencies_prod_pnpm:
197196
filters: *filters
198-
- install_grype:
197+
- scan_dependencies_command:
199198
filters: *filters
200-
- install_semgrep:
199+
- scan_dockerfile:
201200
filters: *filters
202-
- install_gitleaks:
201+
- assess_image_and_generate_sbom:
203202
filters: *filters
204203
- orb-tools/pack:
205204
filters: *release-filters
@@ -209,19 +208,19 @@ workflows:
209208
pub_type: production
210209
requires:
211210
- orb-tools/pack
212-
- scan_dependencies_prod_npm
213-
- scan_dependencies_prod_pnpm
214-
- scan_dependencies_command
215-
- scan_dockerfile
216-
- generate_sbom_and_assess_image
211+
- install_gitleaks
212+
- install_grype
213+
- install_semgrep
214+
- install_syft
215+
- install_trivy
217216
- detect_secrets_dir
218217
- detect_secrets_git_base_revision
219218
- analyze_code_diff
220219
- analyze_code_full
221-
- install_trivy
222-
- install_syft
223-
- install_grype
224-
- install_semgrep
225-
- install_gitleaks
220+
- scan_dependencies_prod_npm
221+
- scan_dependencies_prod_pnpm
222+
- scan_dependencies_command
223+
- scan_dockerfile
224+
- assess_image_and_generate_sbom
226225
context: orb-publishing
227226
filters: *release-filters

0 commit comments

Comments
 (0)