Skip to content

Commit ab0a64c

Browse files
committed
fix: adds npm credentials to build steps
1 parent 51ff100 commit ab0a64c

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

.circleci/config.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,16 @@ windows_big: &windows_big
5454
release_defaults: &release_defaults
5555
resource_class: small
5656
docker:
57-
- image: node:20
57+
- image: cimg/node:20.19
5858
working_directory: ~/snyk-docker-plugin
5959

6060
define: &windows_node_version "20.19.1"
6161

6262
commands:
63+
setup_npm_user:
64+
steps:
65+
- run:
66+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
6367
install_deps:
6468
description: Install dependencies
6569
steps:
@@ -68,9 +72,7 @@ commands:
6872
keys:
6973
- v2-npm-cache-{{ checksum "package.json" }}
7074
- v2-npm-cache-
71-
- run:
72-
name: Use snyk-main npmjs user
73-
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
75+
- setup_npm_user
7476
- run: npm ci
7577
- save_cache:
7678
key: v2-npm-cache-{{ checksum "package.json" }}
@@ -147,9 +149,7 @@ jobs:
147149
- checkout
148150
- install_node_npm:
149151
node_version: << parameters.node_version >>
150-
- run:
151-
name: Use snyk-main npmjs user
152-
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
152+
- setup_npm_user
153153
- run: npm ci
154154
- run: docker version
155155
- run:
@@ -161,9 +161,7 @@ jobs:
161161
- checkout
162162
- install_node_npm:
163163
node_version: << parameters.node_version >>
164-
- run:
165-
name: Use snyk-main npmjs user
166-
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
164+
- setup_npm_user
167165
- run: npm ci
168166
# make docker appear to be broken.
169167
- run: "function docker() { return 1; }"
@@ -174,16 +172,17 @@ jobs:
174172
<<: *defaults
175173
steps:
176174
- checkout_and_merge
177-
- run:
178-
name: Use snyk-main npmjs user
179-
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
175+
- setup_npm_user
180176
- run: npm ci
181177
- run: npm run build
182178
build_cli:
183179
<<: *defaults
184180
resource_class: medium
185181
steps:
186182
- checkout_and_merge
183+
- run:
184+
name: Setup NPM credentials
185+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ../.npmrc
187186
- run:
188187
name: Build Snyk CLI with latest changes
189188
command: ./.circleci/build-cli.sh
@@ -203,6 +202,7 @@ jobs:
203202
<<: *release_defaults
204203
steps:
205204
- checkout
205+
- setup_npm_user
206206
- run: npm ci
207207
- run: npm run build
208208
- run:
@@ -241,6 +241,7 @@ workflows:
241241
- build:
242242
name: Build
243243
context:
244+
- nodejs-install
244245
- snyk-bot-slack
245246
requires:
246247
- Lint

0 commit comments

Comments
 (0)