From de616e1203662e7ec0ada04e6993b6d01e809ebb Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Mon, 25 Nov 2024 15:06:44 +0000 Subject: [PATCH] internal/ci: run 'npm install' instead of 'npm ci' Use 'npm install' in CI, rather than 'npm ci', because the latter does not appear to fail when, for example, the top-level 'version' field in package.json is out of sync with package-lock.json. So whilst 'npm install' is less efficient than 'npm ci' in a CI context, the two are identical from a "which packages got installed" perspective, because we always check that the repo is clean at the end of the workflow. Signed-off-by: Paul Jolly Change-Id: I808a4ea574165d7f251b20fe8429a6458c5cc39b Dispatch-Trailer: {"type":"trybot","CL":1204600,"patchset":3,"ref":"refs/changes/00/1204600/3","targetBranch":"master"} --- .github/workflows/trybot.yaml | 8 ++++---- internal/ci/github/trybot.cue | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/trybot.yaml b/.github/workflows/trybot.yaml index 995dcbd..35a662e 100644 --- a/.github/workflows/trybot.yaml +++ b/.github/workflows/trybot.yaml @@ -107,15 +107,15 @@ jobs: - run: cue login --token=${CUE_TOKEN} env: CUE_TOKEN: ${{ secrets.NOTCUECKOO_CUE_TOKEN }} - - name: Add node_modules/.bin to PATH and npm ci + - name: Add node_modules/.bin to PATH and npm install run: |- echo "PATH=$PWD/node_modules/.bin:$PATH" >> $GITHUB_ENV - npm ci + npm install - working-directory: extension - name: Add node_modules/.bin to PATH and npm ci + name: Add node_modules/.bin to PATH and npm install run: |- echo "PATH=$PWD/node_modules/.bin:$PATH" >> $GITHUB_ENV - npm ci + npm install - name: Verify run: go mod verify - name: Generate diff --git a/internal/ci/github/trybot.cue b/internal/ci/github/trybot.cue index b572669..8f25209 100644 --- a/internal/ci/github/trybot.cue +++ b/internal/ci/github/trybot.cue @@ -59,11 +59,19 @@ workflows: trybot: _repo.bashWorkflow & { // Update PATH to add node_modules/.bin, for both the root level // package.json used for tooling, and within the extension. + // + // NOTE: we use 'npm install' here, rather than 'npm ci', because the + // latter does not appear to fail when, for example, the top-level + // 'version' field in package.json is out of sync with package-lock.json. + // So whilst 'npm install' is less efficient than 'npm ci' in a CI + // context, the two are identical from a "which packages got installed" + // perspective, because we always check that the repo is clean at the end + // of the workflow. let npmSetup = { - name: "Add node_modules/.bin to PATH and npm ci" + name: "Add node_modules/.bin to PATH and npm install" run: """ echo "PATH=$PWD/node_modules/.bin:$PATH" >> $GITHUB_ENV - npm ci + npm install """ }