Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

config.yml 24 KB

You have to be logged in to leave a comment. Sign In
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
  1. version: 2.1
  2. release_tag_filter: &release_tag_filter
  3. filters:
  4. branches:
  5. ignore: /.*/
  6. tags:
  7. only: /^\d+\.\d+\.\d+$/
  8. release_candidate_filter: &release_candidate_filter
  9. filters:
  10. branches:
  11. only: master
  12. commands:
  13. run_on_account:
  14. description: "Run a command using a given role"
  15. parameters:
  16. command:
  17. type: string
  18. aws_role:
  19. type: string
  20. env_name:
  21. type: string
  22. steps:
  23. - run:
  24. environment:
  25. ENVIRONMENT_NAME: << parameters.env_name >>
  26. name: Run a command on << parameters.aws_role >> aws account
  27. command: scripts/aws-sudo.sh -c '<< parameters.command >>' << parameters.aws_role >>
  28. set_env_login_details:
  29. description: "log into codeartifcat specific repo "
  30. parameters:
  31. repo_name:
  32. type: string
  33. aws_account_id:
  34. type: string
  35. aws_role:
  36. type: string
  37. env_name:
  38. type: string
  39. steps:
  40. - run_on_account:
  41. aws_role: << parameters.aws_role >>
  42. env_name: << parameters.env_name >>
  43. command: |
  44. aws codeartifact login --tool pip --repository << parameters.repo_name >> --domain deci-packages --domain-owner << parameters.aws_account_id >>
  45. - run:
  46. name: edit the pip conf
  47. command: sed -i 's/^index-url/extra-index-url/g' ~/.config/pip/pip.conf
  48. create_github_release:
  49. description: create a pull request on github
  50. parameters:
  51. directory_to_cd_into:
  52. type: string
  53. tag:
  54. type: string
  55. notes:
  56. type: string
  57. default: "Automated nightly release"
  58. steps:
  59. - run:
  60. name: install gh cli
  61. command: |
  62. curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
  63. echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
  64. sudo apt update
  65. sudo apt install gh
  66. - run:
  67. name: authenticate
  68. command: |
  69. echo "$GITHUB_CLI_TOKEN" > token.txt
  70. gh auth login --with-token < token.txt
  71. rm token.txt
  72. - run:
  73. name: create the release
  74. command: |
  75. cd << parameters.directory_to_cd_into >>
  76. gh release create << parameters.tag >> --notes "<< parameters.notes >>"
  77. tag_as:
  78. description: "tag as a certain name"
  79. parameters:
  80. tag_name:
  81. type: string
  82. delete_remote:
  83. type: boolean
  84. steps:
  85. - when:
  86. condition: << parameters.delete_remote >>
  87. steps:
  88. - run:
  89. name: Remove local and remote tag
  90. command: |
  91. git tag -d << parameters.tag_name >>
  92. git push --delete origin << parameters.tag_name >>
  93. - run:
  94. name: Tag stable and push
  95. command: |
  96. git tag << parameters.tag_name >>
  97. git push origin << parameters.tag_name >>
  98. upload_package_run:
  99. description: "uploads the package to dev and prod"
  100. parameters:
  101. version:
  102. type: string
  103. default: ""
  104. py_version:
  105. type: string
  106. default: ""
  107. clone_specific_tag:
  108. type: boolean
  109. default: false
  110. tag_to_checkout_from:
  111. type: string
  112. default: ""
  113. steps:
  114. - upload_package:
  115. aws_role: $AWS_DEV_ROLE
  116. aws_account: $AWS_DEV_ACCOUNT_ID
  117. version: << parameters.version >>
  118. py_version: << parameters.py_version >>
  119. clone_specific_tag: << parameters.clone_specific_tag >>
  120. tag_to_checkout_from: << parameters.tag_to_checkout_from >>
  121. - upload_package:
  122. aws_role: $AWS_PROD_ROLE
  123. aws_account: $AWS_PROD_ACCOUNT_ID
  124. version: << parameters.version >>
  125. py_version: << parameters.py_version >>
  126. clone_specific_tag: << parameters.clone_specific_tag >>
  127. tag_to_checkout_from: << parameters.tag_to_checkout_from >>
  128. upload_package:
  129. description: "uploads a package to a designated repo"
  130. parameters:
  131. aws_account:
  132. type: string
  133. aws_role:
  134. type: string
  135. version:
  136. type: string
  137. default: ""
  138. py_version:
  139. type: string
  140. default: ""
  141. clone_specific_tag:
  142. type: boolean
  143. default: false
  144. tag_to_checkout_from:
  145. type: string
  146. default: ""
  147. codeartifact_repository:
  148. type: string
  149. default: "deci-packages"
  150. steps:
  151. - unless:
  152. condition: << parameters.clone_specific_tag >>
  153. steps:
  154. - checkout_and_skip_build
  155. - when:
  156. condition: << parameters.clone_specific_tag >>
  157. steps:
  158. - clone_specific_tag:
  159. tag_to_checkout_from: << parameters.tag_to_checkout_from >>
  160. - attach_workspace:
  161. at: ~/
  162. - restore_cache:
  163. key: << parameters.py_version >>-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "requirements.txt" }}
  164. - run:
  165. name: Taking version from tag or env vars
  166. command: |
  167. echo "upload_package Command got version: << parameters.version >>"
  168. NEW_VERSION=<< parameters.version >>
  169. if [[ $NEW_VERSION ]]
  170. then
  171. export NEW_VERSION=$NEW_VERSION
  172. echo "export NEW_VERSION=$NEW_VERSION" >> $BASH_ENV
  173. else
  174. cat ~/new-env-vars >> $BASH_ENV
  175. source $BASH_ENV
  176. fi
  177. echo "new version is ${NEW_VERSION}"
  178. # - run: #TODO:implement linter
  179. # name: install Flake8 python linter
  180. # command: |
  181. # pip install --user flake8
  182. # - run:
  183. # name: Lint all python files changed since develop branch
  184. # command: |
  185. # flake8 --statistics --config -v --exclude venv/,docs scripts/flake8-config setup.py $(git diff --diff-filter ACM origin/master --name-only | grep 'py$')
  186. - run:
  187. command: |
  188. sudo apt-get update
  189. pip install -U importlib-metadata>=3.6
  190. pip install --user awscli twine wheel
  191. - set_codeartifact_login:
  192. aws_role: << parameters.aws_role >>
  193. aws_account: << parameters.aws_account >>
  194. tool: "twine"
  195. repository: << parameters.codeartifact_repository >>
  196. # - run:
  197. # name: build documentation
  198. # command: |
  199. # sudo apt-get install python3-sphinx
  200. # . venv/bin/activate
  201. # pip install sphinx_rtd_theme jsonschema
  202. # sphinx-build -b html docs/source docs/html
  203. # - store_artifacts:
  204. # path: docs/html
  205. - upload_package_and_edit_version:
  206. version: $NEW_VERSION
  207. - set_codeartifact_login:
  208. aws_role: << parameters.aws_role >>
  209. aws_account: << parameters.aws_account >>
  210. tool: "pip"
  211. repository: << parameters.codeartifact_repository >>
  212. - test_on_clean_env:
  213. package_name: "super-gradients"
  214. version: $NEW_VERSION
  215. ## if test worked push to repo, otherwise delete from pypi
  216. - run:
  217. name: delete dist
  218. command: |
  219. rm -rf dist/*
  220. run_on_aws_account:
  221. description: "Run a command using a role"
  222. parameters:
  223. command:
  224. type: string
  225. aws_role:
  226. type: string
  227. steps:
  228. - run:
  229. name: Run a command using an aws account
  230. command: |
  231. scripts/aws-sudo.sh -c '<< parameters.command >>' << parameters.aws_role >>
  232. set_codeartifact_login:
  233. description: "Connecting to codeartifact"
  234. parameters:
  235. repository:
  236. type: string
  237. default: "deci-packages"
  238. domain:
  239. type: string
  240. default: "deci-packages"
  241. aws_role:
  242. type: string
  243. aws_account:
  244. type: string
  245. tool:
  246. type: string
  247. steps:
  248. - run:
  249. name: "remove old"
  250. command: |
  251. if [ -f ~/.config/pip/pip.conf ]; then
  252. rm ~/.config/pip/pip.conf
  253. fi
  254. - run_on_aws_account:
  255. aws_role: << parameters.aws_role >>
  256. command: |
  257. CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain << parameters.domain >> --domain-owner << parameters.aws_account >> --query authorizationToken --output text`
  258. aws codeartifact login --tool << parameters.tool >> --repository << parameters.repository >> --domain << parameters.domain >> --domain-owner << parameters.aws_account >>
  259. test_on_clean_env:
  260. parameters:
  261. package_name:
  262. type: string
  263. version:
  264. type: string
  265. steps:
  266. - run:
  267. name: install python dependencies
  268. command: |
  269. python3 -m venv clean_env
  270. . clean_env/bin/activate
  271. sed -i 's/^index-url/extra-index-url/g' ~/.config/pip/pip.conf
  272. python -m pip install << parameters.package_name >>==<< parameters.version >>
  273. - run:
  274. name: todo - implement tests for the package. Maybe use poc repo # TODO: Still need to get the tests going
  275. command: |
  276. . clean_env/bin/activate
  277. echo "TODO: Still need to get the pacakge tests going"
  278. upload_package_and_edit_version:
  279. parameters:
  280. version:
  281. type: string
  282. description: "Uploading a package to pypi"
  283. steps:
  284. - run:
  285. name: edit package version
  286. command: |
  287. echo << parameters.version >> > version.txt
  288. - run:
  289. name: create packages
  290. command: |
  291. python setup.py bdist_wheel
  292. - run:
  293. name: upload to pypi using codeartifact
  294. command: |
  295. twine upload -r codeartifact dist/*
  296. git_commit_and_tag:
  297. parameters:
  298. version:
  299. type: string
  300. default: ""
  301. tag_remote:
  302. type: boolean
  303. default: true
  304. steps:
  305. - run:
  306. name: Avoid hosts unknown for github
  307. command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
  308. - run:
  309. name: Commit and Push version file
  310. command: |
  311. git config --global user.email "circleci@deci.ai"
  312. git config --global user.name "CircleCI commit"
  313. git commit version.txt -m "CircleCi - Changed version to << parameters.version >>"
  314. git push --force --set-upstream origin master
  315. - when:
  316. condition: << parameters.tag_remote >>
  317. steps:
  318. - run:
  319. name: tag git repository
  320. command: |
  321. git tag << parameters.version >>
  322. git push origin << parameters.version >>
  323. checkout_and_skip_build:
  324. description: "Checkout code and check if we should skip the build"
  325. steps:
  326. - checkout
  327. - run:
  328. name: Check if we should skip build
  329. command: |
  330. if [[ ! $CIRCLE_TAG ]]; then
  331. last_commit_user=$(git log -1 --pretty=format:'%an')
  332. if [ "${last_commit_user}" == "CircleCI commit" ]; then
  333. echo "\n\n PLEASE NOTICE: Skipping Build to prevent commit loop since the last commit was genereated by automated CI/CD \n\n"
  334. circleci-agent step halt
  335. fi
  336. fi
  337. clone_specific_tag:
  338. description: "got clone and check out specific tag"
  339. parameters:
  340. tag_to_checkout_from:
  341. type: string
  342. steps:
  343. - checkout
  344. - run:
  345. name: Checkout tag
  346. command: |
  347. cd super_gradients
  348. git checkout tags/<< parameters.tag_to_checkout_from >>
  349. jobs:
  350. get_version_info:
  351. working_directory: ~/project
  352. docker:
  353. - image: cimg/base:2021.04
  354. resource_class: small
  355. description: "Putting latest tag in environment"
  356. steps:
  357. - checkout_and_skip_build
  358. - run:
  359. name: get latest tag
  360. command: |
  361. set +e
  362. LATEST_RELEASE=$(git tag --list | grep --regexp="^[0-9]\+\.[0-9]\+\.[0-9]\+$" | sort -V | tail -n 1)
  363. echo "export LATEST_RELEASE=${LATEST_RELEASE}" >> $BASH_ENV
  364. NEW_VERSION=$(bash scripts/version-up.sh -v $LATEST_RELEASE -i)
  365. BRANCH=<< pipeline.git.branch >>
  366. echo "PIPELINE is ${BRANCH} "
  367. case << pipeline.git.branch >> in
  368. master)
  369. echo "export NEW_VERSION=${NEW_VERSION}rc${CIRCLE_BUILD_NUM}" >> $BASH_ENV
  370. ;;
  371. *)
  372. echo "export NEW_VERSION=${NEW_VERSION}b${CIRCLE_BUILD_NUM}" >> $BASH_ENV
  373. ;;
  374. esac
  375. cat $BASH_ENV
  376. - run: cat $BASH_ENV >> ~/new-env-vars
  377. - persist_to_workspace:
  378. root: ~/
  379. paths:
  380. - new-env-vars
  381. build:
  382. parameters:
  383. py_version:
  384. type: string
  385. default: latest
  386. package_name:
  387. type: string
  388. docker:
  389. - image: circleci/python:<< parameters.py_version >>
  390. steps:
  391. - checkout_and_skip_build
  392. - attach_workspace:
  393. at: ~/
  394. - run:
  395. name: set version at bash env
  396. command: |
  397. if [[ $CIRCLE_TAG ]]
  398. then
  399. echo "export NEW_VERSION=$CIRCLE_TAG" >> $BASH_ENV
  400. else
  401. cat ~/new-env-vars >> $BASH_ENV
  402. fi
  403. # - restore_cache:
  404. # key: << parameters.py_version >>-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "requirements.txt" }}
  405. - run:
  406. name: install python dependencies
  407. command: |
  408. python3 -m venv venv
  409. . venv/bin/activate
  410. python -m pip install --upgrade pip
  411. cat requirements.txt | cut -f1 -d"#" | xargs -n 1 -L 1 pip install --progress-bar off
  412. # - save_cache:
  413. # key: << parameters.py_version >>-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "requirements.txt" }}
  414. # paths:
  415. # - "venv"
  416. - run:
  417. name: edit package version
  418. command: |
  419. echo "${NEW_VERSION}" > version.txt
  420. cat version.txt
  421. - run:
  422. name: setup custom environment variables
  423. command: |
  424. echo 'export PYTHONPATH=/home/circleci/super_gradients' >> $BASH_ENV
  425. - run:
  426. name: install package
  427. no_output_timeout: 30m
  428. command: |
  429. . venv/bin/activate
  430. cp requirements.txt tmp.txt
  431. cat tmp.txt | head -n -1 > requirements.txt
  432. rm tmp.txt
  433. rm ~/.config/pip/pip.conf
  434. python -m pip install .
  435. - run:
  436. name: run tests with coverage
  437. no_output_timeout: 30m
  438. command: |
  439. . venv/bin/activate
  440. coverage run --source=super_gradients -m unittest tests/deci_core_unit_test_suite_runner.py
  441. coverage report
  442. coverage html # open htmlcov/index.html in a browser
  443. - store_artifacts:
  444. path: htmlcov
  445. - store_artifacts:
  446. path: ~/sg_logs
  447. build_and_release:
  448. docker:
  449. - image: circleci/python:3.7
  450. steps:
  451. - get_version_info
  452. - build:
  453. name: "build3.7"
  454. py_version: "3.7"
  455. package_name: "super-gradients"
  456. requires:
  457. - get_version_info
  458. - upload_package:
  459. aws_role: $AWS_PROD_ROLE
  460. aws_account: $AWS_PROD_ACCOUNT_ID
  461. version: $CIRCLE_TAG
  462. py_version: << parameters.py_version >>
  463. release_candidate:
  464. docker:
  465. - image: circleci/python:3.7
  466. parameters:
  467. py_version:
  468. type: string
  469. steps:
  470. - upload_package:
  471. aws_role: $AWS_DEV_ROLE
  472. aws_account: $AWS_DEV_ACCOUNT_ID
  473. py_version: << parameters.py_version >>
  474. - git_commit_and_tag:
  475. version: $NEW_VERSION
  476. release_version:
  477. docker:
  478. - image: circleci/python:3.7
  479. parameters:
  480. py_version:
  481. type: string
  482. steps:
  483. - upload_package_run:
  484. version: $CIRCLE_TAG
  485. py_version: << parameters.py_version >>
  486. - upload_package:
  487. aws_role: $AWS_PROD_ROLE
  488. aws_account: $AWS_PROD_ACCOUNT_ID
  489. version: $CIRCLE_TAG
  490. py_version: << parameters.py_version >>
  491. codeartifact_repository: "deci-toolkit"
  492. - git_commit_and_tag:
  493. version: $CIRCLE_TAG
  494. tag_remote: false
  495. - tag_as:
  496. tag_name: "stable"
  497. delete_remote: true
  498. release_version_from_rc:
  499. docker:
  500. - image: circleci/python:3.7
  501. steps:
  502. - attach_workspace:
  503. at: ~/
  504. - run:
  505. name: exit if $AUTO_RELEASED_VERSION is empty
  506. command: |
  507. if ! [[ -f ~/new-env-vars ]]; then
  508. echo "no version to release"
  509. circleci-agent step halt
  510. exit 0
  511. fi
  512. cat ~/new-env-vars >> $BASH_ENV
  513. source $BASH_ENV
  514. if [[ -z $AUTO_RELEASED_VERSION ]]; then
  515. echo "no version to release"
  516. circleci-agent step halt
  517. exit 0
  518. else
  519. echo "will create a release $AUTO_RELEASED_VERSION from ${LATEST_RELEASE_AWS}"
  520. fi
  521. - clone_specific_tag:
  522. tag_to_checkout_from: $LATEST_RELEASE_AWS
  523. - run:
  524. name: tag git repository
  525. command: |
  526. git tag $AUTO_RELEASED_VERSION
  527. git push origin $AUTO_RELEASED_VERSION
  528. - create_github_release:
  529. directory_to_cd_into: "."
  530. tag: $AUTO_RELEASED_VERSION
  531. notes: "Automated nightly release. Generated from ${LATEST_RELEASE_AWS}"
  532. lines_of_code_cap:
  533. working_directory: ~/repo
  534. docker:
  535. - image: circleci/python:3.7.5
  536. parameters:
  537. lines_of_code_cap:
  538. type: integer
  539. default: 600
  540. resource_class: small
  541. steps:
  542. - checkout
  543. - when:
  544. condition:
  545. not:
  546. equal: [ master, << pipeline.git.branch >> ]
  547. steps:
  548. - run:
  549. name: Enforcing << parameters.lines_of_code_cap >> Lines Of Code limit
  550. command: |
  551. sudo apt install bc
  552. BASE_BRANCH="master"
  553. DIRS_TO_IGNORE=""
  554. git diff --shortstat $CIRCLE_BRANCH $BASE_BRANCH
  555. git diff --stat=300 ${CIRCLE_BRANCH} ${BASE_BRANCH} > changes.txt
  556. #for dir_to_ignore in cypress/ scripts/ .circleci/
  557. #do
  558. # DIRS_TO_IGNORE="${DIRS_TO_IGNORE} | grep -v '${dir_to_ignore}'"
  559. #done
  560. #echo "dirs to ignore: ${DIRS_TO_IGNORE} "
  561. # in a perfect world I would use that list instead of hardcoding the "grep". However, there is an annoying issue that
  562. # makes the script look at | as a string and not pipe. this is not important enough to spend time on.
  563. LOC=$(cat changes.txt | grep -v 'tests/' | grep -v 'docs/' | grep -v '.circleci/' | awk -F"|" '{ print $2 }' | awk '{ print $1 }' | sed '/^$/d' | paste -sd+ - | bc)
  564. echo " there are $LOC changes"
  565. if [[ $LOC -gt << parameters.lines_of_code_cap >> ]]; then
  566. echo "#######################################################"
  567. echo "#######################################################"
  568. echo "There are $LOC changed lines of code. We only allow << parameters.lines_of_code_cap >> for each PR."
  569. echo "Please break down your PR into a smaller one"
  570. echo "#######################################################"
  571. echo "#######################################################"
  572. exit 1
  573. fi
  574. get_unreleased_rc:
  575. working_directory: ~/repo
  576. docker:
  577. - image: circleci/python:3.7.5
  578. resource_class: small
  579. steps:
  580. - checkout
  581. - run:
  582. command: |
  583. pip install --user awscli
  584. - run_on_aws_account:
  585. aws_role: $AWS_DEV_ROLE
  586. command: |
  587. LATEST_RELEASE_AWS="null"
  588. LATEST_RELEASE_AWS=$(aws codeartifact list-package-versions --domain deci-packages --domain-owner $AWS_DEV_ACCOUNT_ID --repository deci-packages --format pypi --package super-gradients --max-results 1 --sort-by PUBLISHED_TIME --query versions[0].version --output text)
  589. echo "export LATEST_RELEASE_AWS=${LATEST_RELEASE_AWS}" >> $BASH_ENV
  590. - run:
  591. name: "check for unreleased rc"
  592. command: |
  593. source $BASH_ENV
  594. LAST_REV=$(git rev-list --tags --max-count=1)
  595. GIT_LATEST_TAG=$(git describe --tags "${LAST_REV}")
  596. echo "latest tag: ${GIT_LATEST_TAG}"
  597. echo "latest release on AWS: ${LATEST_RELEASE_AWS}"
  598. if ! [[ "${GIT_LATEST_TAG}" =~ "rc" ]]; then
  599. echo "latest is a release, nothing to do. Off for fusball"
  600. circleci-agent step halt
  601. elif [[ "${GIT_LATEST_TAG}" != "${LATEST_RELEASE_AWS}" ]]; then
  602. echo "latest tag does not equal the latest release on dev account"
  603. echo "something is phishy, we wont proceed"
  604. circleci-agent step halt
  605. else
  606. echo "we have a release candidate to release - ${GIT_LATEST_TAG}"
  607. AUTO_RELEASED_VERSION=$(echo $GIT_LATEST_TAG | cut -d 'r' -f1)
  608. echo "version to release: $AUTO_RELEASED_VERSION"
  609. echo "export AUTO_RELEASED_VERSION=${AUTO_RELEASED_VERSION}" >> $BASH_ENV
  610. fi
  611. - run: cat $BASH_ENV >> ~/new-env-vars
  612. - persist_to_workspace:
  613. root: ~/
  614. paths:
  615. - new-env-vars
  616. login_to_codeartifact:
  617. description: Authenticate to aws code artifact. By default authenticates to prod
  618. docker:
  619. - image: circleci/python:3.7.5
  620. parameters:
  621. dev_account:
  622. description: authenticate to development codeartifact
  623. type: boolean
  624. default: false
  625. pip_repo_name:
  626. type: string
  627. steps:
  628. - checkout
  629. - run:
  630. command: |
  631. pip install --user awscli
  632. - when:
  633. condition: << parameters.dev_account >>
  634. steps:
  635. - set_env_login_details:
  636. repo_name: << parameters.pip_repo_name >>
  637. aws_account_id: ${AWS_DEV_ACCOUNT_ID}
  638. aws_role: ${AWS_DEV_ROLE}
  639. env_name: "development"
  640. - unless:
  641. condition: << parameters.dev_account >>
  642. steps:
  643. - set_env_login_details:
  644. repo_name: << parameters.pip_repo_name >>
  645. aws_account_id: ${AWS_PROD_ACCOUNT_ID}
  646. aws_role: ${AWS_PROD_ROLE}
  647. env_name: "production"
  648. - persist_to_workspace:
  649. root: ~/
  650. paths:
  651. - .config/pip/pip.conf
  652. workflows:
  653. # timed_release:
  654. # triggers:
  655. # - schedule:
  656. # cron: "0 20 * * *" # 23:00 israel time
  657. # filters:
  658. # branches:
  659. # only:
  660. # - master
  661. # jobs:
  662. # - get_unreleased_rc
  663. # - release_version_from_rc:
  664. # requires:
  665. # - get_unreleased_rc
  666. release:
  667. jobs:
  668. - login_to_codeartifact:
  669. name: "login_to_codeartifact_release"
  670. dev_account: false
  671. pip_repo_name: "deci-clients"
  672. <<: *release_tag_filter
  673. - build:
  674. name: "build3.7"
  675. py_version: "3.7"
  676. package_name: "super-gradients"
  677. requires:
  678. - login_to_codeartifact_release
  679. <<: *release_tag_filter
  680. - release_version:
  681. py_version: "3.7"
  682. requires:
  683. - "build3.7"
  684. <<: *release_tag_filter
  685. build_and_deploy:
  686. jobs:
  687. - lines_of_code_cap
  688. - get_version_info
  689. - login_to_codeartifact:
  690. pip_repo_name: "deci-clients"
  691. dev_account: false
  692. - build:
  693. name: "build3.7"
  694. py_version: "3.7"
  695. package_name: "super-gradients"
  696. requires:
  697. - get_version_info
  698. - login_to_codeartifact
  699. - release_candidate: # happens on merge
  700. py_version: "3.7"
  701. requires:
  702. - "build3.7"
  703. <<: *release_candidate_filter
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...