pivotal-cf / pivnet-resource

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

Unnecessary trigger #124

Closed hae-anwar-bardai closed 4 years ago

hae-anwar-bardai commented 4 years ago

Hi All, We have a pipeline that is supposed to trigger based on pivnet product versions. But lately we are seeing strange behavior with it. Below is part of the pipeline:

resource_types:
  - name: pivnet
    type: docker-image
    source:
      repository: pivotalcf/pivnet-resource
      tag: latest-final

resources:
  - name: product
    type: pivnet
    source:
      api_token: ((pivnet_token))
      product_slug: ((product_slug))
      product_version: ((product_version))

jobs:
  - name: acquire-lock
    serial: true
    plan: 
      - get: product
        params:
          globs: 
          - ((product_glob))
        trigger: true
      - put: locks
        params: 
          claim: upload
 - name: upload-and-stage-tile
    serial: true
    plan:
      - in_parallel:
          - get: locks
            passed: 
              - acquire-lock
          - get: product
            params: 
              globs:
                - ((product_glob))
            passed: 
              - acquire-lock
            trigger: true

The 'acquire-lock' was triggered even though there was not a new version of the product. However, the 'upload-and-stage-tile' did not, which has the same criteria for trigger as 'acquire-lock'.

Any ideas why this would be?

rszumlakowski commented 4 years ago

Hiya. It's not clear to me why the upload-and-stage-tile job is not triggering, but I have a couple suggestions that could help you troubleshoot:

  1. The product_version parameter on the Pivnet resource must be a properly formed regular expression. Many people enter a glob there and find that their pipelines get triggered for unexpected releases. We see this occurrence frequently. The Some Common Gotchas part of the documentation might help make this more clear.

  2. Typically we would write the upload-and-stage-file job above to be a task that runs in the same job as acquire-lock. If you combine these two jobs into one (say, called simply upload-and-stage-file), then you can get the same resources and you won't need to dd the passed or trigger attributes to them. We use this pattern in our own pipelines on Concourse.

I hope that helps.

hae-anwar-bardai commented 4 years ago

Here is how the variables are currently defined: product_slug: p-healthwatch product_version: ^1.7..$ product_glob: ".pivotal"

I'll change the version to be ^1.7.\d+$ per your suggestion. I'll also combine the lock step with the next step to be one step.

Still don't understand why it would trigger without any visible updates from pivnet.

Thanks for your suggestions.

hae-anwar-bardai commented 4 years ago

correction: product_slug is currently ^1.7..*$ (not sure why asterisk fell off the original post)

rszumlakowski commented 4 years ago

If you are still seeing unnecessary triggers then could you please attach a screenshot of the resource from your Concourse pipeline (i.e.: not the job that uses the resource, but click on the resource itself and take a screenshot of all the past versions that the Pivnet resource has returned). I'd like to see the list of versions it has triggered on, please.

miguelverissimo commented 4 years ago

@a-bardai the screenshot would be very helpful, but I'm going out on a limb and speculate that any 1.7.x release will trigger any 1.7.x release, i.e. a new release on 1.7.2 will trigger 1.7.0, 1.7.1, etc.

The screenshot might help us to confirm this

hae-anwar-bardai commented 4 years ago

[cid:image001.png@01D5AEB5.0766F840]

[cid:image002.png@01D5AEB5.70FD4DE0] These 2 runs have identical products. Run 10 should never have been triggered

From: Miguel Verissimo notifications@github.com

Sent: Monday, December 9, 2019 2:25 PM To: pivotal-cf/pivnet-resource pivnet-resource@noreply.github.com Cc: Anwar Bardai anwar.bardai@haemonetics.com; Mention mention@noreply.github.com Subject: Re: [pivotal-cf/pivnet-resource] Unnecessary trigger (#124)

EXTERNAL: This email originated from outside of Haemonetics. Do not click any links, open any attachments, or reply unless you trust the sender and know the content is safe. Use this HaemoNet linkhttp://haemonet.haemo.net/EnterpriseIT/Pages/Email%20Frequently%20Asked%20Questions%20and%20Answers.aspx for information on reporting suspicious emails.

@a-bardaihttps://github.com/a-bardai the screenshot would be very helpful, but I'm going out on a limb and speculate that any 1.7.x release will trigger any 1.7.x release, i.e. a new release on 1.7.2 will trigger 1.7.0, 1.7.1, etc.

The screenshot might help us to confirm this

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/pivotal-cf/pivnet-resource/issues/124?email_source=notifications&email_token=ALJEQTWSNKQZTVP7PNCCX3DQX2LRTA5CNFSM4JTY2R72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGKLH5A#issuecomment-563393524, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALJEQTSXFIUEO6HM6D2CHVTQX2LRTANCNFSM4JTY2R7Q.

hae-anwar-bardai commented 4 years ago

Sorry, not sure if the image came through. I replied to the auto generate email. Please let me know if you can see the image.

hae-anwar-bardai commented 4 years ago

run9 run10

hae-anwar-bardai commented 4 years ago

Just to clarify, these screen shots are from before I created the issue. I haven't seen this occur since I created the issue. This happened 4 or 5 times before I created the issue.

hae-anwar-bardai commented 4 years ago

there is only one entry in the product check!

product

rszumlakowski commented 4 years ago

I'm going to close this issue since it is no longer being reported as reproducible.