I am working on bitbucket pipelines using javascript/nodejs as the language.
I need 'jq' command in my script but it throws error of jq: command not found
Below is my bitbucket pipelines.yml file
Hi @nazia_akhtar ,
Thank you for your question!
You can add it with the next command before using jq:
apt-get install -y jq
Hi this is part of a script I am running to attach an image to a page. However, I am getting these errors:
line 10: jq: command not found
line 12: [: =: unary operator expected
Line 10 is ATTACHMENT_TITLE=$(curl -u $USER_NAME:$USER_PASSWORD \ -X POST \ -H "X-Atlassian-Token: nocheck" -F "file=@${ATTACHMENT_FILE_NAME}" -F "comment=File attached via REST API" \ ${CONFLUENCE_BASE_URL}/rest/api/content/${PAGE_ID}/child/attachment 2>/dev/null \ | jq -r '.results[].title')
Line 12 is if [ ${ATTACHMENT_TITLE} = ${ATTACHMENT_FILE_NAME} ]; then
Am not sure what is causing this error as I got this script from an atlassian page. Please let me know how I can fix and run this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
image: node:10.15.3
pipelines:
default:
- step:
name: "prova default"
script:
- echo "Deploying version is $VERSIONRELEASE"
- ls
- mkdir build
- touch build/test.json
- ls build
- apt-get install -y jq
- declare -x VERSION=$(jq -r '.version' package.json)
- echo "package.json version is $VERSION"
+ apt-get install -y jqReading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package jq
sorry, but does not work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Luca,
I had the same issue.
Before you can install jq, you have to make an "apt-get update"
Example:
- apt-get update
- apt-get -y install jq
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.