Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,678
Community Members
 
Community Events
165
Community Groups

bash: jq:command not found

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

 

jq.JPG

3 answers

1 accepted

1 vote
Answer accepted

Hi @nazia_akhtar ,

Thank you for your question!

You can add it with the next command before using jq:

apt-get install -y jq

jq error.PNG

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?

 

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 jq
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package jq

 

sorry, but does not work

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,170 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you