Skip to content

Commit 3e3c7f1

Browse files
committed
fix: only pull docker when needed
1 parent 21574b9 commit 3e3c7f1

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

.circleci/config.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ jobs:
187187
steps:
188188
- run:
189189
name: Start Docker pull
190-
command: docker pull python@sha256:1f92d35b567363820d0f2f37c7ccf2c1543e2d852cea01edb027039e6aef25e6
190+
command: |
191+
if [ "$CIRCLE_NODE_INDEX" = "0" ]; then
192+
docker pull python@sha256:1f92d35b567363820d0f2f37c7ccf2c1543e2d852cea01edb027039e6aef25e6
193+
fi
191194
background: true
192195
- checkout
193196
- install_node_npm:
@@ -202,8 +205,18 @@ jobs:
202205
- run:
203206
name: Run Windows tests in parallel
204207
command: |
205-
TEST=$(circleci tests glob "test/windows/**/*.spec.ts" | circleci tests split --split-by=timings | sed 's#\\\\#/#g')
206-
npm run test-jest-windows -- $TEST --reporters=default --reporters=jest-junit
208+
# Run different tests based on parallel instance
209+
if [ "$CIRCLE_NODE_INDEX" = "0" ]; then
210+
# Instance 0: Run only the slow Python test
211+
echo "Running plugin.spec.ts on instance 0..."
212+
npm run test-jest-windows -- test/windows/plugin.spec.ts --reporters=default --reporters=jest-junit
213+
else
214+
# Instance 1: Run all other tests
215+
echo "Running all other tests on instance 1..."
216+
# Get all test files except plugin.spec.ts
217+
TESTS=$(find test/windows -name "*.spec.ts" -not -name "plugin.spec.ts" | tr '\n' ' ')
218+
npm run test-jest-windows -- $TESTS --reporters=default --reporters=jest-junit
219+
fi
207220
environment:
208221
JEST_JUNIT_OUTPUT_DIR: './reports/junit'
209222
JEST_JUNIT_ADD_FILE_ATTRIBUTE: 'true' # We need this to make --split-by=timings work
@@ -242,23 +255,13 @@ jobs:
242255
- run:
243256
name: Setup NPM credentials
244257
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ../.npmrc
245-
- run:
246-
name: Get latest CLI commit hash
247-
# We can't use the CLI_COMMIT_HASH environment variable directly
248-
# But we can write it to a file and use that to restore the cache
249-
command: |
250-
CLI_COMMIT_HASH=$(git ls-remote https://github.com/snyk/cli.git main | cut -f1)
251-
echo "CLI_COMMIT_HASH: $CLI_COMMIT_HASH"
252-
echo $CLI_COMMIT_HASH >> /tmp/cli-version
253258
- run:
254259
name: Build Snyk CLI with latest changes
255260
command: ./.circleci/build-cli.sh
256261
build_and_test_latest_go_binary:
257262
<<: *defaults
258263
resource_class: medium
259264
steps:
260-
- setup_remote_docker:
261-
docker_layer_caching: true
262265
- checkout_and_merge
263266
- run:
264267
name: Build a Go binary with latest Go version

0 commit comments

Comments
 (0)