CircleCI-Public / jq-orb

quickly and easily install jq in your CircleCI job
https://circleci.com/orbs/registry/orb/circleci/jq
MIT License
6 stars 9 forks source link

Error in CircleCI: `sudo: command not found` when running `$SUDO mkdir -p "${JQ_EVAL_INSTALL_DIR}"` #36

Open marcel-olaru opened 8 months ago

marcel-olaru commented 8 months ago

Problem: We recently update the orb from version jq@2.2.1 ➡️ jq@3.0.0 While installing we get an error in the pipeline caused by the following line in the install script https://github.com/CircleCI-Public/jq-orb/blob/9a395d728a0accee1c9ed28b94c03f87511b7af5/src/scripts/install.sh#L19 the command $SUDO mkdir -p "${JQ_EVAL_INSTALL_DIR}" encountering an error stating sudo: command not found. we're using as an executor the official image for playwright mcr.microsoft.com/playwright:v1.42.1-focal while using the previous version there was no need to have sudo installed

Error Message:

sudo: command not found

Steps to Reproduce:

  1. Run the command $SUDO mkdir -p "${JQ_EVAL_INSTALL_DIR}" in CircleCI. while using mcr.microsoft.com/playwright:v1.42.1-focal as an executor

Expected Result: The directory specified by JQ_EVAL_INSTALL_DIR should be created without needing sudo.

Actual Result: The command fails with the error message sudo: command not found.

Going back to the previous release jq@2.2.1 seems to have worked now, we can add sudo privileges but would prefer not to. Any help resolving this issue would be greatly appreciated.

marboledacci commented 2 months ago

@marcel-olaru the same script tries to create the directory without sudo in line 4 . It only tries sudo when the directory is not created. So in your case you need to add sudo or change the directory.