Skip to content

Commit dbbb712

Browse files
use orbs to reduce circleci config (#205)
* use orbs to reduce circleci config
1 parent 74133f3 commit dbbb712

File tree

1 file changed

+21
-122
lines changed

1 file changed

+21
-122
lines changed

.circleci/config.yml

Lines changed: 21 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -7,90 +7,9 @@ defaults: &defaults
77
username: lumigo
88
password: $DOCKERHUB_PASSWORD
99

10-
commands:
11-
checkout_utils:
12-
description: "Checkout various utilities"
13-
steps:
14-
- run:
15-
command: |
16-
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
17-
cd ..
18-
git clone [email protected]:lumigo-io/common-resources.git
19-
- run:
20-
command: |
21-
cd ..
22-
git clone [email protected]:lumigo-io/utils.git
23-
- run:
24-
command: |
25-
cd ..
26-
git clone [email protected]:lumigo-io/larn.git
27-
28-
checkout_credentials:
29-
description: "Checkout credentials"
30-
steps:
31-
- run:
32-
command: |
33-
cd ..
34-
git clone [email protected]:lumigo-io/common-resources.git
35-
36-
checkout_integration_tests:
37-
description: "Checkout integration tests"
38-
steps:
39-
- run:
40-
command: |
41-
cd ..
42-
git clone [email protected]:lumigo-io/integration-tests.git
43-
checkout_dashboard:
44-
description: "Checkout Lumigo Platform (dashboard)"
45-
steps:
46-
- run:
47-
command: |
48-
cd ..
49-
git clone [email protected]:lumigo-io/dashboard.git
50-
51-
checkout_code:
52-
description: "Checkout code and test it"
53-
steps:
54-
- checkout
55-
- run:
56-
# Avoid annoying double runs after deploy.
57-
# See https://discuss.circleci.com/t/job-runs-even-when-tags-ignore-filter-is-triggered-when-combined-with-branches-only/20664
58-
name: Check if tagged
59-
command: |
60-
tags=$(git tag -l --points-at HEAD)
61-
echo "Tags $tags"
62-
if [[ ! -z "$tags" ]]
63-
then
64-
echo "A tagged commit, skip..."
65-
circleci step halt
66-
fi
67-
- run: sudo chown -R circleci:circleci /usr/local/bin
68-
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
69-
70-
# Download and cache dependencies
71-
- restore_cache:
72-
keys:
73-
- v1-dependencies-{{ checksum "requirements.txt" }}
74-
# fallback to using the latest cache if no exact match is found
75-
- v1-dependencies-
10+
orbs:
11+
lumigo-orb: lumigo/lumigo-orb@volatile
7612

77-
- run:
78-
name: install dependencies
79-
command: |
80-
python3 -m venv venv
81-
. venv/bin/activate
82-
pip install -r requirements.txt
83-
python setup.py develop
84-
# https://discuss.circleci.com/t/activate-python-virtualenv-for-whole-job/14434
85-
- run: echo "source venv/bin/activate" >> $BASH_ENV
86-
- run: pip install pytest-cov
87-
- run: pip install pre-commit
88-
- run: pre-commit install
89-
90-
- save_cache:
91-
paths:
92-
- ./venv
93-
key: v1-dependencies-{{ checksum "requirements.txt" }}
9413

9514
workflows:
9615
test-deploy:
@@ -99,12 +18,26 @@ workflows:
9918
filters:
10019
branches:
10120
ignore: master
102-
- integration-test:
21+
- lumigo-orb/be-deploy:
10322
filters:
10423
branches:
10524
ignore: master
10625
requires:
10726
- test
27+
- lumigo-orb/integration-test:
28+
deploy_spec: python
29+
tests_spec: testPython
30+
filters:
31+
branches:
32+
ignore: master
33+
requires:
34+
- lumigo-orb/be-deploy
35+
- lumigo-orb/e2e-test:
36+
requires:
37+
- lumigo-orb/integration-test
38+
filters:
39+
branches:
40+
ignore: master
10841
- deploy:
10942
filters:
11043
branches:
@@ -114,53 +47,19 @@ jobs:
11447
test:
11548
<<: *defaults
11649
steps:
117-
- checkout_code
118-
- checkout_utils
50+
- lumigo-orb/checkout_code
51+
- lumigo-orb/checkout_utils
11952
# run tests!
12053
- run: echo "export AWS_DEFAULT_REGION=us-west-2" >> $BASH_ENV
12154
- run: mkdir -p ~/.aws
12255
- run: echo ${KEY} | gpg --batch -d --passphrase-fd 0 ../common-resources/encrypted_files/credentials_integration.enc > ~/.aws/credentials
123-
- run: pre-commit install
12456
- run: . venv/bin/activate && ./scripts/checks.sh
12557
- run: ../utils/common_bash/defaults/code_cov.sh
12658

127-
integration-test:
128-
<<: *defaults
129-
resource_class: medium+
130-
steps:
131-
- checkout_utils
132-
- checkout_code
133-
- run: ./scripts/ci_deploy.sh
134-
- run: cd ../integration-tests && npm i
135-
- run: sudo npm install -g recursive-install
136-
- run: cd ../integration-tests && git rev-parse HEAD > ../commits && cd ../python_tracer && git rev-parse HEAD >> ../commits && cd ../lumigo-node && git rev-parse HEAD >> ../commits && cd ../java-tracer && git rev-parse HEAD >> ../commits
137-
- restore_cache:
138-
keys:
139-
- IT-{{ .Branch }}-{{ checksum "../commits" }}
140-
- run: cd ../integration-tests && ./scripts/parallel_prepare_env.sh
141-
- run: cd ../integration-tests && ./scripts/parallel_deploy.sh --spec python
142-
- save_cache:
143-
key: IT-{{ .Branch }}-{{ checksum "../commits" }}
144-
paths:
145-
- ../integration-tests/.env
146-
- ../integration-tests/.env2
147-
- ../integration-tests/.env3
148-
- ../integration-tests/.deployment_finished.env
149-
- ../integration-tests/.deployment_finished.env2
150-
- ../integration-tests/.deployment_finished.env3
151-
- run: cd ../integration-tests && export testPython=true && npm run test-parallel
152-
- store_test_results:
153-
path: ../integration-tests/src/test/test-results
154-
- persist_to_workspace:
155-
root: ../
156-
paths:
157-
- envs/
158-
- stack/
159-
- .aws/
16059

16160
deploy:
16261
<<: *defaults
16362
steps:
164-
- checkout_code
165-
- checkout_utils
63+
- lumigo-orb/checkout_code
64+
- lumigo-orb/checkout_utils
16665
- run: ./scripts/bd_to_prod.sh

0 commit comments

Comments
 (0)