/
config.yml
1238 lines (1216 loc) · 38.5 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
version: '2.1'
orbs:
# https://circleci.com/developer/orbs/orb/circleci/windows
win: circleci/windows@2.4.1
# https://circleci.com/developer/orbs/orb/circleci/aws-cli
aws-cli: circleci/aws-cli@2.0.3
# https://circleci.com/developer/orbs/orb/circleci/github-cli
gh: circleci/github-cli@2.1.0
# https://circleci.com/developer/orbs/orb/circleci/go
go: circleci/go@1.7.1
parameters:
node_version:
type: string
# https://circleci.com/developer/images/image/cimg/node
default: '16.16.0'
npm_version:
type: string
# match whatever's bundled with node_version
default: '8.1.2'
aws_version:
type: string
# https://github.com/aws/aws-cli/blob/v2/CHANGELOG.rst
default: '2.4.12'
gh_version:
type: string
# https://github.com/cli/cli/releases
default: '2.7.0'
go_version:
type: string
# https://go.dev/doc/devel/release
default: '1.19.4'
mitmproxy_version:
type: string
# https://go.dev/doc/devel/release
default: '7.0.4'
executors:
alpine:
docker:
- image: alpine:3.17
docker-node:
parameters:
node_version:
type: string
default: << pipeline.parameters.node_version >>
docker:
- image: cimg/node:<< parameters.node_version >>
# Using RAM Disk. https://circleci.com/docs/2.0/executor-types/#ram-disks
working_directory: /mnt/ramdisk/snyk
linux:
machine:
# https://circleci.com/developer/machine/image/ubuntu-2004
image: ubuntu-2004:2022.04.1
linux-arm64:
machine:
# https://circleci.com/docs/2.0/arm-resources/
image: ubuntu-2004:2022.04.1
resource_class: arm.medium
macos:
macos:
# https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions
xcode: '13.3.0'
commands:
setup_npm:
parameters:
node_version:
type: string
default: << pipeline.parameters.node_version >>
npm_version:
type: string
default: << pipeline.parameters.npm_version >>
npm_cache_directory:
type: string
default: /mnt/ramdisk/.npm
npm_global_sudo:
type: boolean
default: false
npm_install:
type: boolean
default: false
steps:
- restore_cache:
name: Restoring npm cache
keys:
- npm-cache-v2-{{ arch }}-node<< parameters.node_version >>-npm<< parameters.npm_version >>-{{ checksum "package-lock.json" }}
- when:
condition:
not: << parameters.npm_global_sudo >>
steps:
run:
name: Installing npm
command: npm install -g npm@<< parameters.npm_version >>
- when:
condition: << parameters.npm_global_sudo >>
steps:
run:
name: Installing npm
command: sudo npm install -g npm@<< parameters.npm_version >>
- run:
name: Configuring npm
command: |
npm config set '//registry.npmjs.org/:_authToken' '${NPM_TOKEN}'
npm config set cache << parameters.npm_cache_directory >>
npm config set prefer-offline true
- when:
condition: << parameters.npm_install >>
steps:
- run:
name: Installing project dependencies
command: npm ci
- save_cache:
name: Saving npm cache
key: npm-cache-v2-{{ arch }}-node<< parameters.node_version >>-npm<< parameters.npm_version >>-{{ checksum "package-lock.json" }}
paths:
- << parameters.npm_cache_directory >>
install_sdks_windows:
steps:
- run:
name: Removing pre-installed NodeJS
command: |
$current_node_version = node --version
nvm uninstall $current_node_version
- restore_cache:
name: Restoring Chocolatey cache
keys:
- chocolatey-cache-v2-{{ arch }}-{{ checksum ".circleci/chocolatey.config" }}
- run:
name: Installing SDKs
command: choco install .circleci/chocolatey.config --no-progress
- save_cache:
name: Saving Chocolatey cache
key: chocolatey-cache-v2-{{ arch }}-{{ checksum ".circleci/chocolatey.config" }}
paths:
- ~\AppData\Local\Temp\chocolatey
install_sdks_unix:
steps:
- restore_cache:
name: Restoring SDKMAN install cache
keys:
- sdkman-install-cache-v3-{{ arch }}-{{ checksum ".circleci/vendor/sdkman-install.sh" }}
- run:
name: Installing SDKMAN
# The install script comes from https://get.sdkman.io/?rcupdate=false
# We need to disable rcupdate as CircleCI uses a different setup.
command: |
./.circleci/vendor/sdkman-install.sh
echo -e '\nsource "${HOME}/.sdkman/bin/sdkman-init.sh"' >> $BASH_ENV
source $BASH_ENV
- save_cache:
name: Saving SDKMAN install cache
key: sdkman-install-cache-v3-{{ arch }}-{{ checksum ".circleci/vendor/sdkman-install.sh" }}
paths:
- ~/.sdkman
- restore_cache:
name: Restoring SDKMAN archive cache
keys:
- sdkman-archive-cache-v3-{{ arch }}-{{ checksum ".circleci/install-sdks-unix.sh" }}
- run:
name: Installing SDKs
command: ./.circleci/install-sdks-unix.sh
- save_cache:
name: Saving SDKMAN archive cache
key: sdkman-archive-cache-v3-{{ arch }}-{{ checksum ".circleci/install-sdks-unix.sh" }}
paths:
- ~/.sdkman/archives
- aws-cli/install:
version: << pipeline.parameters.aws_version >>
install_sdks_linux:
steps:
- run:
name: Installing Python
command: |
sudo apt update
sudo apt install python3 python3-pip python-is-python3
- install_sdks_unix
install_sdks_macos:
steps:
- run:
name: Installing golang
command: |
brew install go gradle python elixir composer
- install_sdks_unix
install_shellspec_dependencies:
steps:
- run:
name: Installing ShellSpec
command: |
./test/smoke/install-shellspec.sh --yes
sudo ln -s ${HOME}/.local/lib/shellspec/shellspec /usr/local/bin/shellspec
start_proxy_linux:
steps:
- run:
name: Create and import proxy certificate
working_directory: ./cliv2
command: |
go run cmd/make-cert/main.go test-corp-proxy
sudo cp test-corp-proxy.crt /usr/local/share/ca-certificates
sudo update-ca-certificates
- restore_cache:
name: Restoring mitmproxy install cache
key: mitmproxy-install-cache-{{ arch }}-<< pipeline.parameters.mitmproxy_version >>
- run:
name: Install mitmproxy
command: |
if ! test -f mitmproxy.tar.gz; then
curl -Lo mitmproxy.tar.gz https://snapshots.mitmproxy.org/<< pipeline.parameters.mitmproxy_version >>/mitmproxy-<< pipeline.parameters.mitmproxy_version >>-linux.tar.gz
fi
sudo tar -xvzf mitmproxy.tar.gz -C /usr/local/bin
- save_cache:
name: Saving mitmproxy install cache
key: mitmproxy-install-cache-{{ arch }}-<< pipeline.parameters.mitmproxy_version >>
paths:
- mitmproxy.tar.gz
- run:
name: Start proxy
background: true
working_directory: ./cliv2
command: mitmdump --certs *=test-corp-proxy.pem
- run:
name: Wait for proxy
working_directory: ./cliv2
command: |
curl -I --verbose --retry 6 --retry-delay 5 --retry-connrefused http://localhost:8080
curl -I --verbose --proxy http://localhost:8080 "${SNYK_API}"
start_proxy_windows:
steps:
- run:
name: Create and import proxy certificate
working_directory: ./cliv2
command: |
go run cmd/make-cert/main.go test-corp-proxy
Import-Certificate -FilePath test-corp-proxy.crt -CertStoreLocation Cert:\LocalMachine\Root
- run:
name: Start proxy
background: true
working_directory: ./cliv2
command: mitmdump --certs *=test-corp-proxy.pem
- run:
name: Wait for proxy
shell: bash.exe
working_directory: ./cliv2
command: |
curl -I --verbose --retry 6 --retry-delay 5 --retry-connrefused http://localhost:8080
curl -I --verbose --proxy http://localhost:8080 "${SNYK_API}"
jobs:
install:
executor: docker-node
steps:
- checkout
- setup_npm:
npm_install: true
- persist_to_workspace:
root: .
paths:
- node_modules
- packages/*/node_modules
lint:
executor: docker-node
steps:
- checkout
- attach_workspace:
at: .
- setup_npm
- run:
name: Linting project
command: npm run lint
build:
executor: docker-node
steps:
- checkout
- attach_workspace:
at: .
- setup_npm
- run:
name: Building project
command: npm run build:prod
- persist_to_workspace:
root: .
paths:
- dist/
- packages/*/dist
- pysrc
version:
executor: docker-node
steps:
- checkout
- attach_workspace:
at: .
- setup_npm
- run:
name: Deciding version
command: make binary-releases/version
- persist_to_workspace:
root: .
paths:
- binary-releases/version
regression-test:
parameters:
test_snyk_command:
type: string
executor: docker-node
steps:
- checkout
- attach_workspace:
at: .
- install_sdks_linux
- install_shellspec_dependencies
- setup_npm
- run:
name: Installing test fixture dependencies
working_directory: ./test/fixtures/basic-npm
command: npm install
- run:
name: Installing Snyk CLI
command: |
sudo ln -s << parameters.test_snyk_command >> /usr/local/bin/snyk
snyk --version
- run:
name: Running ShellSpec tests
working_directory: ./test/smoke
command: |
echo "Checkout the README in test/smoke folder for more details about this step"
unset SNYK_API
unset SNYK_API_KEY
shellspec -f d -e REGRESSION_TEST=1
test-windows:
parameters:
test_snyk_command:
type: string
executor: win/default
working_directory: C:\Users\circleci\snyk
steps:
- run:
name: Configuring Git
command: git config --global core.autocrlf false
- checkout
- attach_workspace:
at: .
- install_sdks_windows
- setup_npm:
npm_install: true # reinstalling as workspace node_modules is for linux
npm_cache_directory: ~\AppData\Local\npm-cache
- run:
name: Configuring artifact
command: << parameters.test_snyk_command >> config set "api=$env:SNYK_API_KEY"
- run:
name: Testing artifact
command: npm run test:acceptance -- --selectProjects snyk
environment:
TEST_SNYK_COMMAND: << parameters.test_snyk_command >>
test-macos:
parameters:
test_snyk_command:
type: string
executor: macos
working_directory: /Users/distiller/snyk
steps:
- checkout
- attach_workspace:
at: .
- install_sdks_macos
- setup_npm:
npm_install: true # reinstalling as workspace node_modules is for linux
npm_cache_directory: /Users/distiller/.npm
- run:
name: Configuring artifact
command: << parameters.test_snyk_command >> config set "api=${SNYK_API_KEY}"
- run:
name: Testing artifact
command: npm run test:acceptance -- --selectProjects snyk
environment:
TEST_SNYK_COMMAND: << parameters.test_snyk_command >>
TEST_SNYK_DONT_SKIP_ANYTHING: 1
test-alpine:
parameters:
test_snyk_command:
type: string
executor: alpine
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Installing Node.js + other test dependencies
command: |
apk add --update nodejs npm bash maven git go gradle python3 py3-pip elixir composer
- setup_npm:
npm_cache_directory: /home/circleci/.npm
npm_global_sudo: false
- run:
name: Configuring artifact
command: << parameters.test_snyk_command >> config set "api=${SNYK_API_KEY}"
- run:
name: Testing artifact
command: npm run test:acceptance -- --selectProjects snyk
environment:
TEST_SNYK_COMMAND: << parameters.test_snyk_command >>
test-linux:
parameters:
test_snyk_command:
type: string
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- install_sdks_linux
- run:
name: Installing Node.js
command: |
sudo apt update
sudo apt install nodejs npm golang gradle python3 python3-pip elixir composer
- setup_npm:
npm_cache_directory: /home/circleci/.npm
npm_global_sudo: true
- run:
name: Configuring artifact
command: << parameters.test_snyk_command >> config set "api=${SNYK_API_KEY}"
- run:
name: Testing artifact
command: npm run test:acceptance -- --selectProjects snyk
environment:
TEST_SNYK_COMMAND: << parameters.test_snyk_command >>
TEST_SNYK_DONT_SKIP_ANYTHING: 1
test-linux-arm64:
parameters:
test_snyk_command:
type: string
executor: linux-arm64
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- install_sdks_linux
- run:
name: Installing Node.js
command: |
sudo apt update
sudo apt install nodejs npm golang gradle python3 python3-pip elixir composer
- setup_npm:
npm_cache_directory: /home/circleci/.npm
npm_global_sudo: true
- run:
name: Configuring artifact
command: << parameters.test_snyk_command >> config set "api=${SNYK_API_KEY}"
- run:
name: Testing artifact
command: npm run test:acceptance -- --selectProjects snyk
environment:
TEST_SNYK_COMMAND: << parameters.test_snyk_command >>
TEST_SNYK_DONT_SKIP_ANYTHING: 1
test-jest:
parameters:
node_version:
type: string
npm_global_sudo:
type: boolean
executor:
name: docker-node
node_version: << parameters.node_version >>
environment:
TEMP: /mnt/ramdisk/tmp
steps:
- run:
name: Creating temporary directory
command: mkdir /mnt/ramdisk/tmp
- checkout
- attach_workspace:
at: .
- install_sdks_linux
- go/install:
version: << pipeline.parameters.go_version >>
- run:
name: Installing test dependencies
command: |
sudo apt-get update
sudo apt-get install gradle python3 python3-pip elixir composer
- setup_npm:
npm_global_sudo: << parameters.npm_global_sudo >>
node_version: << parameters.node_version >>
- run:
name: Configuring Snyk CLI
command: node ./bin/snyk config set "api=${SNYK_API_KEY}"
- run:
name: Running unit tests
command: npm run test:unit
- run:
name: Running acceptance tests
command: npm run test:acceptance
test-tap:
executor: docker-node
parallelism: 2
steps:
- checkout
- attach_workspace:
at: .
- install_sdks_linux
- setup_npm
- run:
name: Configuring Snyk CLI
command: node ./bin/snyk config set "api=${SNYK_API_KEY}"
- run:
name: Running Tap tests
command: |
npx tap -Rspec --timeout=300 --node-arg=-r --node-arg=ts-node/register \
$(circleci tests glob "test/tap/*.test.*" | circleci tests split)
build-artifact:
parameters:
artifact:
type: string
executor: docker-node
steps:
- checkout
- attach_workspace:
at: .
- setup_npm
- when:
condition:
equal: ['snyk-win.exe', << parameters.artifact >>]
steps:
run:
name: Installing osslsigncode
command: |
sudo apt update
sudo apt install osslsigncode
- run:
name: Building artifact
command: make binary-releases/<< parameters.artifact >>
- persist_to_workspace:
root: .
paths:
- binary-releases/<< parameters.artifact >>
- binary-releases/<< parameters.artifact >>.sha256
prepare-release:
executor: docker-node
steps:
- checkout
- attach_workspace:
at: .
- setup_npm
- run:
name: Validating NPM artifacts
command: ./release-scripts/validate-npm-artifacts.sh
- run:
name: Copy Windows cliv2 binaries to binary-releases staging area
command: |
ls -la cliv2/bin
cp cliv2/bin/snyk-win.exe binary-releases/snyk-win.exe
cp cliv2/bin/snyk-win.exe.sha256 binary-releases/snyk-win.exe.sha256
- run:
name: Copy macOS cliv2 binaries to binary-releases staging area
command: |
ls -la cliv2/bin
cp cliv2/bin/snyk-macos binary-releases/snyk-macos
cp cliv2/bin/snyk-macos.sha256 binary-releases/snyk-macos.sha256
- run:
name: Copy linux cliv2 binaries to binary-releases staging area
command: |
ls -la cliv2/bin
cp cliv2/bin/snyk-linux binary-releases/snyk-linux
cp cliv2/bin/snyk-linux.sha256 binary-releases/snyk-linux.sha256
- run:
name: Copy linux arm64 cliv2 binaries to binary-releases staging area
command: |
ls -la cliv2/bin
cp cliv2/bin/snyk-linux-arm64 binary-releases/snyk-linux-arm64
cp cliv2/bin/snyk-linux-arm64.sha256 binary-releases/snyk-linux-arm64.sha256
- run:
name: Signing shasums
command: make binary-releases/sha256sums.txt.asc
- run:
name: Making release.json
command: make binary-releases/release.json
- run:
name: Making release notes
command: make binary-releases/RELEASE_NOTES.md
- store_artifacts:
path: ./binary-releases
- run:
name: Validating artifacts
command: ./release-scripts/validate-checksums.sh
- persist_to_workspace:
root: .
paths:
- binary-releases
release:
executor: docker-node
steps:
- checkout
- attach_workspace:
at: .
- setup_npm
- run:
name: Validating artifacts
command: ./release-scripts/validate-checksums.sh
- gh/setup:
token: GH_TOKEN
version: << pipeline.parameters.gh_version >>
- aws-cli/install:
version: << pipeline.parameters.aws_version >>
- run:
name: Ensure master branch
command: |
if [ "$CIRCLE_BRANCH" != "master" ]; then
echo "Release must be on 'master' branch."
exit 1
fi
- run:
name: Ensure not already released
command: |
if git describe --contains --tags; then
echo "This commit has already been released."
exit 1
fi
- run:
name: Publishing npm packages
command: |
npm publish ./binary-releases/snyk-fix.tgz
npm publish ./binary-releases/snyk-protect.tgz
npm publish ./binary-releases/snyk.tgz
- run:
name: Publishing artifacts
command: ./release-scripts/upload-artifacts.sh
- run:
name: Handling failed release
command: ./release-scripts/handle-failed-release.sh
when: on_fail
#
# Snyk CLI v2 Jobs
#
v2-lint:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- go/install:
version: << pipeline.parameters.go_version >>
- run:
name: Lint
working_directory: ./cliv2
command: make lint
v2-unit-test:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- go/install:
version: << pipeline.parameters.go_version >>
- restore_cache:
key: go-unit-test-{{ arch }}-{{ checksum "cliv2/go.sum" }}
- run:
name: Run unit tests
working_directory: ./cliv2
command: make configure whiteboxtest
- save_cache:
key: go-unit-test-{{ arch }}-{{ checksum "cliv2/go.sum" }}
paths: [/home/circleci/go/pkg/mod]
v2-build-artifact:
parameters:
go_os:
type: string
go_arch:
type: string
c_compiler:
type: string
default: ''
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- go/install:
version: << pipeline.parameters.go_version >>
- restore_cache:
key: go-build-{{ arch }}-{{ checksum "cliv2/go.sum" }}
- run: sudo apt-get install musl-tools
- run:
name: Build << parameters.go_os >>/<< parameters.go_arch >>
working_directory: ./cliv2
environment:
CC: << parameters.c_compiler >>
GOOS: << parameters.go_os >>
GOARCH: << parameters.go_arch >>
CLI_V1_LOCATION: ../binary-releases
command: make build build-test install prefix=. -e
- save_cache:
key: go-build-{{ arch }}-{{ checksum "cliv2/go.sum" }}
paths: [/home/circleci/go/pkg/mod]
- persist_to_workspace:
root: .
paths:
- ./cliv2/bin
v2-rename-windows-artifact:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Rename snyk_windows_amd64.exe artifact
command: mv snyk_windows_amd64.exe snyk-win.exe
working_directory: ./cliv2/bin
- run:
name: Regenerate sha256
command: |
shasum -a 256 snyk-win.exe > snyk-win.exe.sha256
shasum -a 256 -c snyk-win.exe.sha256
working_directory: ./cliv2/bin
- run:
name: Show files
command: |
ls -la
cat snyk-win.exe.sha256
working_directory: ./cliv2/bin
- persist_to_workspace:
root: .
paths:
- ./cliv2/bin
v2-rename-macos-artifact:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Rename snyk_darwin_amd64 artifact
command: mv snyk_darwin_amd64 snyk-macos
working_directory: ./cliv2/bin
- run:
name: Regenerate sha256
command: |
shasum -a 256 snyk-macos > snyk-macos.sha256
shasum -a 256 -c snyk-macos.sha256
working_directory: ./cliv2/bin
- run:
name: Show files
command: |
ls -la
cat snyk-macos.sha256
working_directory: ./cliv2/bin
- persist_to_workspace:
root: .
paths:
- ./cliv2/bin
v2-rename-linux-artifact:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Rename snyk_linux_amd64 artifact
command: mv snyk_linux_amd64 snyk-linux
working_directory: ./cliv2/bin
- run:
name: Regenerate sha256
command: |
shasum -a 256 snyk-linux > snyk-linux.sha256
shasum -a 256 -c snyk-linux.sha256
working_directory: ./cliv2/bin
- run:
name: Show files
command: |
ls -la
cat snyk-linux.sha256
working_directory: ./cliv2/bin
- persist_to_workspace:
root: .
paths:
- ./cliv2/bin
v2-rename-linux-arm64-artifact:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Rename snyk_linux_arm64 artifact
command: mv snyk_linux_arm64 snyk-linux-arm64
working_directory: ./cliv2/bin
- run:
name: Regenerate sha256
command: |
shasum -a 256 snyk-linux-arm64 > snyk-linux-arm64.sha256
shasum -a 256 -c snyk-linux-arm64.sha256
working_directory: ./cliv2/bin
- run:
name: Show files
command: |
ls -la
cat snyk-linux-arm64.sha256
working_directory: ./cliv2/bin
- persist_to_workspace:
root: .
paths:
- ./cliv2/bin
v2-prepare-release:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- store_artifacts:
path: ./cliv2/bin
v2-test-linux-amd64:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Run integration tests
working_directory: ./cliv2
environment:
TEST_SNYK_EXECUTABLE_PATH: ./bin/snyk-linux
command: |
export SNYK_TOKEN="${SNYK_API_KEY}"
./bin/snyk_tests_linux_amd64
v2-test-proxy-linux-amd64:
executor: linux
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- go/install:
version: << pipeline.parameters.go_version >>
- start_proxy_linux
- run:
name: Run integration tests
working_directory: ./cliv2
environment:
TEST_SNYK_EXECUTABLE_PATH: ./bin/snyk-linux
HTTPS_PROXY: http://localhost:8080
command: |
export SNYK_TOKEN="${SNYK_API_KEY}"
./bin/snyk_tests_linux_amd64
v2-test-linux-arm64:
executor: linux-arm64
working_directory: /home/circleci/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Run integration tests
working_directory: ./cliv2
environment:
TEST_SNYK_EXECUTABLE_PATH: ./bin/snyk-linux-arm64
command: |
export SNYK_TOKEN="${SNYK_API_KEY}"
./bin/snyk_tests_linux_arm64
v2-test-darwin-amd64:
executor: macos
working_directory: /Users/distiller/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Run integration tests
working_directory: ./cliv2
environment:
TEST_SNYK_EXECUTABLE_PATH: ./bin/snyk-macos
command: |
export SNYK_TOKEN="${SNYK_API_KEY}"
./bin/snyk_tests_darwin_amd64
v2-test-windows-amd64:
executor: win/default
working_directory: C:\Users\circleci\snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Run integration tests
working_directory: ./cliv2
environment:
TEST_SNYK_EXECUTABLE_PATH: ./bin/snyk-win.exe
command: |
$env:SNYK_TOKEN = $env:SNYK_API_KEY
./bin/snyk_tests_windows_amd64.exe
v2-test-proxy-windows-amd64:
executor: win/default
working_directory: C:\Users\circleci\snyk
steps:
- checkout
- attach_workspace:
at: .
- install_sdks_windows
- start_proxy_windows
- run:
name: Run integration tests
working_directory: ./cliv2
environment:
TEST_SNYK_EXECUTABLE_PATH: ./bin/snyk-win.exe
HTTPS_PROXY: http://localhost:8080
command: |
$env:SNYK_TOKEN = $env:SNYK_API_KEY
./bin/snyk_tests_windows_amd64.exe
v2-sign-darwin-amd64:
executor: macos
working_directory: /Users/distiller/snyk
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Signing macOS artifact
# --ignore-errors due to 403s from Apple's service.
# We need to sign a new agreement for our dev account.
# We currently don't publish this artifact so it's safe to ignore.
command: make sign GOOS=darwin GOARCH=amd64 BUILD_DIR=$PWD/bin --ignore-errors
working_directory: ./cliv2
- persist_to_workspace:
root: .
paths:
- cliv2/bin/snyk_darwin_amd64
- cliv2/bin/snyk_darwin_amd64.sha256
v2-sign-windows-amd64:
executor: linux
working_directory: /home/circleci/snyk
steps:
- run:
name: Installing build dependencies
command: |
sudo apt update
sudo apt install osslsigncode
- checkout
- attach_workspace:
at: .
- run:
name: Signing windows artifact
command: make sign GOOS=windows GOARCH=amd64 BUILD_DIR=$PWD/bin
working_directory: ./cliv2
- persist_to_workspace:
root: .
paths:
- cliv2/bin/snyk_windows_amd64.exe
- cliv2/bin/snyk_windows_amd64.exe.sha256
workflows:
version: 2
test_and_release:
jobs:
- install:
name: Install
- lint:
name: Lint
requires:
- Install
- build:
name: Build
requires:
- Install
- test-jest:
name: Jest Tests (Node v<< matrix.node_version >>)
context: nodejs-install
requires:
- Build
matrix:
parameters:
node_version: ['12.22.11', '14.20.0', '16.16.0']
npm_global_sudo: [true, false]
exclude:
- node_version: '12.22.11'