@@ -2,12 +2,14 @@ version: 2.1
22
33orbs :
44 shellcheck : circleci/shellcheck@1.2.0
5+ snyk : snyk/snyk@1.7.0
56 windows : circleci/windows@5.0.0
67
78executors :
89 go :
910 docker :
1011 - image : cimg/go:1.20
12+ resource_class : large
1113 environment :
1214 CGO_ENABLED : 0
1315 mac :
@@ -25,7 +27,7 @@ commands:
2527 # https://app.circleci.com/jobs/github/CircleCI-Public/circleci-cli/6480
2628 # curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
2729 # The issue seems to be on the server-side, so force HTTP 1.1
28- name : ' cURL: Force HTTP 1.1'
30+ name : " cURL: Force HTTP 1.1"
2931 command : echo '--http1.1' >> ~/.curlrc
3032 build-docker-image :
3133 steps :
@@ -41,36 +43,31 @@ commands:
4143 command : |
4244 docker build -t circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine --file Dockerfile.alpine .
4345 docker run --rm circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine update check
44- deploy-save-cache- workspace-and-artifacts :
46+ deploy-save-workspace-and-artifacts :
4547 steps :
46- - save_cache :
47- key : v4-goreleaser-{{ checksum "~/goreleaser_amd64.deb" }}
48- paths : [~/goreleaser_amd64.deb]
4948 - persist_to_workspace :
5049 root : .
5150 paths :
52- - ' dist'
51+ - " dist"
5352 - store_artifacts :
5453 path : ./dist
5554 destination : dist
5655 install-goreleaser :
5756 parameters :
58- GORELEASER_URL :
57+ version :
5958 type : string
60- default : https://github.com/goreleaser/goreleaser/releases/download/v0.184.0/goreleaser_amd64.deb
59+ default : " 1.19.1 "
6160 steps :
62- - restore_cache :
63- keys : [v5-goreleaser-]
6461 - run :
6562 name : Install GoReleaser
6663 command : |
67- [ -f ~/goreleaser_amd64.deb ] || curl --silent --location --fail --retry 3 << parameters.GORELEASER_URL >> > ~/goreleaser_amd64.deb
68- sudo apt-get update -y
69- sudo apt install ~/goreleaser_amd64.deb
64+ echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
65+ sudo apt -q update -y
66+ sudo apt -q install -y --no-install-recommends goreleaser=<< parameters.version >>
7067 gomod :
7168 steps :
7269 - restore_cache :
73- keys : [' v3-gomod-{{ arch }}-' ]
70+ keys : [" v3-gomod-{{ arch }}-" ]
7471 - run :
7572 name : Download go module dependencies
7673 command : go mod download
@@ -121,7 +118,7 @@ jobs:
121118 - persist_to_workspace :
122119 root : .
123120 paths :
124- - ' build'
121+ - " build"
125122 cucumber :
126123 docker :
127124 - image : cimg/ruby:2.7
@@ -130,7 +127,7 @@ jobs:
130127 - attach_workspace :
131128 at : .
132129 - run :
133- name : ' Install CLI tool from workspace'
130+ name : " Install CLI tool from workspace"
134131 command : sudo cp ~/project/build/linux/amd64/circleci /usr/local/bin/
135132 - run :
136133 command : bundle install
@@ -209,7 +206,7 @@ jobs:
209206 docker_layer_caching : true
210207 - build-docker-image
211208 - build-alpine-image
212- - deploy-save-cache- workspace-and-artifacts
209+ - deploy-save-workspace-and-artifacts
213210
214211 deploy :
215212 executor : go
@@ -246,7 +243,7 @@ jobs:
246243 docker push circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine
247244 docker tag circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine circleci/circleci-cli:alpine
248245 docker push circleci/circleci-cli:alpine
249- - deploy-save-cache- workspace-and-artifacts
246+ - deploy-save-workspace-and-artifacts
250247
251248 snap :
252249 docker :
@@ -304,6 +301,46 @@ jobs:
304301 command : choco push circleci-cli.nupkg --source https://chocolatey.org/ --apikey $env:CHOCO_API_KEY
305302 working_directory : chocolatey
306303
304+ vulnerability-scan :
305+ executor : go
306+ steps :
307+ - checkout
308+ - run :
309+ name : Setup Scanning
310+ command : |
311+ git config --global url."https://$GITHUB_USER:$GITHUB_TOKEN@github.com/circleci/".insteadOf "https://github.com/circleci/"
312+ - when :
313+ condition :
314+ or :
315+ - equal : [ main, << pipeline.git.branch >> ]
316+ steps :
317+ - run :
318+ name : Launching Snyk Orb Scanning
319+ command : echo "Running snyk/scan on main; uploading the results"
320+ - run :
321+ name : Cleanup RemoteRepoURL
322+ command : echo 'export REMOTE_REPO_URL="${CIRCLE_REPOSITORY_URL%".git"}"' >> "$BASH_ENV"
323+ - snyk/scan :
324+ organization : " circleci-public"
325+ fail-on-issues : true
326+ severity-threshold : high
327+ monitor-on-build : true
328+ additional-arguments : " --all-projects --remote-repo-url=${REMOTE_REPO_URL} -d"
329+ - unless :
330+ condition :
331+ or :
332+ - equal : [ main, << pipeline.git.branch >> ]
333+ steps :
334+ - run :
335+ name : Launching Snyk Orb Scanning
336+ command : echo "Running snyk/scan on branch; not uploading the results"
337+ - snyk/scan :
338+ organization : " circleci-public"
339+ fail-on-issues : true
340+ severity-threshold : high
341+ monitor-on-build : false
342+ additional-arguments : " --all-projects -d"
343+
307344workflows :
308345 ci :
309346 jobs :
@@ -317,6 +354,8 @@ workflows:
317354 - test_windows
318355 - coverage
319356 - lint
357+ - vulnerability-scan :
358+ context : org-global-employees
320359 - deploy-test
321360 - docs :
322361 requires :
0 commit comments