Thanks Ian,

Putting jq in 'raw' mode and putting in the variables gives

curl -s -G $JIRA_REST/project/$JIRA_PROJ/versions | jq -r ".[] |
select(.name==\"$tag\").id"

which seems to work perfectly.

I was able to install jq on ares so this modification should work there.
Are there any other places these scripts get run that would make depending
on jq a problem?


On 18 February 2015 at 08:15, Ian Schneider <[email protected]>
wrote:

> Yuck.
>
> The jq command-line tool can handle this: http://stedolan.github.io/jq
>
> If I understand correctly, a 2.5.5 tag should yield 20833. This could be
> done using jq like this:
>
> curl -s -G http://jira.codehaus.org/rest/api/latest/project/GEOS/versions
> | jq '.[] | select(.name=="2.5.5").id'
>
> Where .[] grabs all the objects and pipes them to a property filter
> grabbing the id of any that match.
>
> On Tue, Feb 17, 2015 at 5:46 PM, Kevin Smith <[email protected]>
> wrote:
>
>> The build script is doing this:
>>
>> curl -s -G http://jira.codehaus.org/rest/api/latest/project/GEOS/versions
>> | tr "{" "\n" | grep "\"$tag\"" | tr "," "\n" | grep "\"id\"" | sed
>> 's/"id": *"\([0-9]\+\).*/\1/g'
>>
>> That's grabbing a bunch of JSON and then "parsing" it by turning each
>> object into a line, and then finding lines which match the release tag
>> treated as a regexp, and then finds the JIRA id for the release in a
>> similar way.
>>
>> Release 2.5.3 has a JIRA ID of 20515 which just happens to match the
>> regular expression 2.5.5  So it produces 2 IDs which then breaks everything.
>>
>> `grep -F` stops treating it as a regular expression and just matches the
>> string.  That's still not parsing the JSON properly and it could still
>> break quite easily, but it stops this particular problem.
>>
>> --
>>
>> Kevin Smith
>>
>> Software Engineer | Boundless <http://boundlessgeo.com/>
>>
>> [email protected]
>>
>> +1-778-785-7459
>>
>> @boundlessgeo <http://twitter.com/boundlessgeo/>
>>
>>
>> <http://twitter.com/boundlessgeo/>
>>
>> [image: http://boundlessgeo.com/]
>> <http://boundlessgeo.com/>
>>
>>
>> ------------------------------------------------------------------------------
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Geoserver-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>>
>>
>
>
> --
> Ian Schneider
> Software Engineer | Boundless <http://boundlessgeo.com>
> [email protected]
> 1-877-673-6436
> @boundlessgeo <http://twitter.com/boundlessgeo/>
>
>


-- 

Kevin Smith

Software Engineer | Boundless <http://boundlessgeo.com/>

[email protected]

+1-778-785-7459

@boundlessgeo <http://twitter.com/boundlessgeo/>


<http://twitter.com/boundlessgeo/>

[image: http://boundlessgeo.com/]
<http://boundlessgeo.com/>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to