0

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>
Cezu
  • 82
  • 10
  • This means that your JSON (or XML) is invalid. You have to show the contents of `package.xml`. – knittl Jan 13 '23 at 16:01
  • Just added a content of package.xml – Cezu Jan 14 '23 at 06:12
  • Which `xq` is that? https://github.com/sibprogrammer/xq outputs an error for `xq . < file.xml` "read .: is a directory" on STDOUT. It does _not_ transform XML to JSON! (it only pretty-prints XML as XML). `jq` cannot parse `read .: is a directory` as JSON because it obviously isn't. – knittl Jan 14 '23 at 09:30

0 Answers0