pivotal-cf / pivnet-resource

Concourse Resource to interact with the Tanzu Network API V2 interface.
Apache License 2.0
30 stars 36 forks source link

Resource suddenly pulling in incorrect version #77

Closed osis closed 7 years ago

osis commented 7 years ago

TL;DR - I think there is an issue with the regex and duplicate numbers in the version.

I am using the Pivnet Resource to pull in versions 1.9.*, 1.10.*, and 1.11.* of Runtime. It looks like the 1.9.* and 1.10.* resources have suddenly pulled in versions 1.11.9, and 1.11.10.

Concourse Config

- name: elastic-runtime-1.10.*
  type: pivnet
  source:
    api_token: {{pivnet-token}}
    product_slug: elastic-runtime
    product_version: 1.10.*

- name: elastic-runtime-1.11.*
  type: pivnet
  source:
    api_token: {{pivnet-token}}
    product_slug: elastic-runtime
    product_version: 1.11.*

- name: elastic-runtime-1.9.*
  type: pivnet
  source:
    api_token: {{pivnet-token}}
    product_slug: elastic-runtime
    product_version: 1.9.*

Concourse Resource Output screen shot 2017-08-24 at 2 16 34 pm screen shot 2017-08-24 at 2 17 14 pm

I also checked to see whether there had been a change since it pulled an intended version vs the unintended and both showed version 0.31.3 of the Pivnet Resource.

screen shot 2017-08-24 at 2 26 25 pm screen shot 2017-08-24 at 2 25 06 pm

cf-gitbot commented 7 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/150527129

The labels on this github issue will be updated when the story is started.

robdimsdale commented 7 years ago

@osis I think this has always been an issue. I think the regex needs to be anchored to the beginning of the version, because what is happening is that the regex 1.9.* matches <anything>1<single-char>9<any number of chars>. Specifically 1.11.9 matches <1.1>1<.>.9<nothing> and similar for 1.11.10 - this just hasn't shown up before because we hadn't released these numbers yet.

Pivnet resource could choose to fix this by implicitly anchoring the start and end of regex, but regardless, you could anchor the regex with something like: ^1.11.*$.

robdimsdale commented 7 years ago

and really, the trailing $ isn't necessary (or useful) if the last element in the regex is .*.

osis commented 7 years ago

Didn't know the regex was interpreted that way so that makes sense. Not sure how I got that impression though... Anywho, thanks!!