Bitbucket Pipelines export into variable using jq and xq causes error

233 views Asked by At

When i running a pipeline in bitbucket i want to export into variable using

export APEX_CLASSES=$(xq . < package/package.xml | jq '.Package.types | [.] | flatten | map(select(.name=="ApexClass")) | .[] | .members | [.] | flatten | map(select(. | index("*") | not)) | unique | join(",")' -r)

but i got error in pipeline

parse error: Invalid numeric literal at line 1, column 5

i tried to identify a error but i always get same error :(

When i add a escape \ before " i got this error

jq: error: syntax error, unexpected INVALID_CHARACTER (Unix shell quoting issues?) at <top-level>, line 1:
.Package.types | [.] | flatten | map(select(.name==\"ApexClass\")) | .[] | .members | [.] | flatten | map(select(. | index(\"*\") | not)) | unique | join(\",\")                                                   
jq: 1 compile error

This is package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>AccountHelper</members>
        <members>BoatHelper</members>
        <members>CaseHelper</members>
        <name>ApexClass</name>
    </types>
    <version>57.0</version>
</Package>
0

There are 0 answers