I’m trying to create a multi-job workflow where vendor dependencies (node/npm modules) are installed during one job and used in another (i.e. install grunt-cli in job 1, use grunt in job 2).
I’m persisting the workspace in job 1 and re-attaching it job 2.
grunt is failing in job 2 with
/bin/bash: line 1: grunt: command not found
Exited with code 127
If I call my grunt task in job 1 then it works fine, but I’d like to understand how to do this in seperate jobs as described.
Any help gratefully received.
references: workspace_root: &workspace_root /home/circleci/my-workspace attach_workspace: &attach_workspace attach_workspace: at: *workspace_root defaults: &defaults # Default directory to run the steps in. working_directory: *workspace_root docker: - image: circleci/node:7.10.0 environment: TZ: "/usr/share/zoneinfo/Australia/Brisbane" test: override: - "true" version: 2 jobs: build: <<: *defaults steps: - checkout - run: name: Install npm command: 'sudo npm update -g npm@latest' - run: name: Install bower command: 'sudo npm install -g bower' - run: name: Install grunt-cli command: | sudo npm install -g grunt-cli - run: name: Install vendor dependancies command: | cd /home/circleci/my-workspace/website npm install bower install # - run: # name: Compiling site with environment specific values # command: | # cd /home/circleci/my-workspace/website # grunt staging - persist_to_workspace: root: *workspace_root paths: - . compile_code: <<: *defaults # Override working directory for this job working_directory: /home/circleci/my-workspace/website steps: - *attach_workspace - run: name: Compiling site with environment specific values command: | cd /home/circleci/my-workspace/website grunt staging deploy: <<: *defaults steps: - *attach_workspace - run: name: Deploying to environment command: echo 'Deploying to environment!' workflows: version: 2 continuous-delivery-workflow: jobs: - build - compile_code: requires: - build - approve_staging: type: approval requires: - build - compile_code - deploy: requires: - approve_staging