dpb587 / bosh-release-resource

A Concourse resource for working with versions of a BOSH release.
MIT License
3 stars 1 forks source link

Version ordering appears to get confused by merge commits #5

Closed vito closed 5 years ago

vito commented 5 years ago

Hey there, I noticed that when the latest commit is a merge commit the version ordering seems to get a little wonky.

In our case, the commit in question was https://github.com/concourse/concourse-bosh-release/commit/fc1dfcb044e7b9107ce00ff65436f90d85c7c72f

The resource is configured like so:

- name: concourse-release
  type: bosh-release
  source:
    uri: https://github.com/concourse/concourse-bosh-release
    dev_releases: true
    private_config: # ... (probably not important)

The version history seemed to jump around on every check. First it would look like this:

~/w/c/fly (fly-resources-pinned) $ fly -t ci resource-versions -r concourse/concourse-release -c 1000
id        version                                            enabled
10663215  version:4.2.3-dev.20190118T220700Z.commit.62f47a0  yes    
10663490  version:4.2.3-dev.20190120T055019Z.commit.b1ee6f5  yes    
10663489  version:4.2.3-dev.20190121T183335Z.commit.f074aab  yes    
10663488  version:4.2.3-dev.20190121T185348Z.commit.662ec91  yes    
10663487  version:4.2.3-dev.20190122T164323Z.commit.ed230c1  yes    
10663486  version:4.2.3-dev.20190122T212758Z.commit.89ad5a6  yes    
10663485  version:4.2.3-dev.20190123T194930Z.commit.1c55df8  yes    
10663484  version:4.2.3-dev.20190123T233953Z.commit.4100e59  yes    
10663483  version:4.2.3-dev.20190124T162317Z.commit.4418763  yes    
10663482  version:4.2.3-dev.20190124T200155Z.commit.6a1c3a4  yes    
10663481  version:4.2.3-dev.20190124T210837Z.commit.d95f95c  yes    
10663480  version:4.2.3-dev.20190125T154240Z.commit.faa77a4  yes    
10663479  version:4.2.3-dev.20190125T233317Z.commit.af85d89  yes    
10663478  version:4.2.3-dev.20190128T190736Z.commit.61d01da  yes    
10663477  version:4.2.3-dev.20190128T210658Z.commit.af3fd3e  yes    
10663476  version:4.2.3-dev.20190128T220626Z.commit.6a5ad04  yes    
10663475  version:4.2.3-dev.20190129T174811Z.commit.7d97050  yes    
10663474  version:4.2.3-dev.20190129T210716Z.commit.d549d61  yes    
9825425   version:4.2.3-dev.20190129T224207Z.commit.6236c36  yes    
10086735  version:4.2.3-dev.20190130T222957Z.commit.146a1d6  yes    
10436564  version:4.2.3-dev.20190131T233231Z.commit.b2a4e35  yes    
10526253  version:4.2.3-dev.20190201T055853Z.commit.7855958  yes    
10663214  version:4.2.3-dev.20190201T154818Z.commit.fc1dfcb  yes    
10663491  version:4.2.3-dev.20190119T181041Z.commit.3c56323  yes

...and next it would look like this:

~/w/c/fly (fly-resources-pinned) $ fly -t ci resource-versions -r concourse/concourse-release -c 1000
id        version                                            enabled
10663491  version:4.2.3-dev.20190119T181041Z.commit.3c56323  yes    
10663490  version:4.2.3-dev.20190120T055019Z.commit.b1ee6f5  yes    
10663489  version:4.2.3-dev.20190121T183335Z.commit.f074aab  yes    
10663488  version:4.2.3-dev.20190121T185348Z.commit.662ec91  yes    
10663487  version:4.2.3-dev.20190122T164323Z.commit.ed230c1  yes    
10663486  version:4.2.3-dev.20190122T212758Z.commit.89ad5a6  yes    
10663485  version:4.2.3-dev.20190123T194930Z.commit.1c55df8  yes    
10663484  version:4.2.3-dev.20190123T233953Z.commit.4100e59  yes    
10663483  version:4.2.3-dev.20190124T162317Z.commit.4418763  yes    
10663482  version:4.2.3-dev.20190124T200155Z.commit.6a1c3a4  yes    
10663481  version:4.2.3-dev.20190124T210837Z.commit.d95f95c  yes    
10663480  version:4.2.3-dev.20190125T154240Z.commit.faa77a4  yes    
10663479  version:4.2.3-dev.20190125T233317Z.commit.af85d89  yes    
10663478  version:4.2.3-dev.20190128T190736Z.commit.61d01da  yes    
10663477  version:4.2.3-dev.20190128T210658Z.commit.af3fd3e  yes    
10663476  version:4.2.3-dev.20190128T220626Z.commit.6a5ad04  yes    
10663475  version:4.2.3-dev.20190129T174811Z.commit.7d97050  yes    
10663474  version:4.2.3-dev.20190129T210716Z.commit.d549d61  yes    
9825425   version:4.2.3-dev.20190129T224207Z.commit.6236c36  yes    
10086735  version:4.2.3-dev.20190130T222957Z.commit.146a1d6  yes    
10436564  version:4.2.3-dev.20190131T233231Z.commit.b2a4e35  yes    
10526253  version:4.2.3-dev.20190201T055853Z.commit.7855958  yes    
10663214  version:4.2.3-dev.20190201T154818Z.commit.fc1dfcb  yes    
10663215  version:4.2.3-dev.20190118T220700Z.commit.62f47a0  yes

The only difference seems to be that the first and last entries swap positions:

~/w/c/fly (fix-web-ui-feedback-loop) $ diff a b
1c1
< 10663215  version:4.2.3-dev.20190118T220700Z.commit.62f47a0  yes    
---
> 10663491  version:4.2.3-dev.20190119T181041Z.commit.3c56323  yes    
24c24
< 10663491  version:4.2.3-dev.20190119T181041Z.commit.3c56323  yes
---
> 10663215  version:4.2.3-dev.20190118T220700Z.commit.62f47a0  yes

Unsurprisingly this causes all sorts of mayhem as our pipeline sometimes runs against 62f47a0 and sometimes runs against 3c56323.

Suggestion: we had a similar challenge in the git resource and resolved it by using git log --first-parent: https://github.com/concourse/git-resource/commit/7cd2be1f937844325458ee0644920605b6eae091

/cc @clarafu

vito commented 5 years ago

I was able to work-around this by waiting for a new non-merge commit, making an empty commit on top of that, and then manually running a check-resource for the version prior to the empty commit:

fly -t ci cr -r concourse/concourse-release -f version:4.2.3-dev.20190201T201645Z.commit.17c35db

The version history is now stable and doesn't jump around anymore, but it's still a bit out of order - probably just building on the weird order it ended up with in the first place.

Here's what it stabilized on:

~/w/concourse-bosh-release (master) $ fly -t ci resource-versions -r concourse/concourse-release
id        version                                            enabled
10734740  version:4.2.3-dev.20190201T202751Z.commit.2648e2e  yes    
10663215  version:4.2.3-dev.20190118T220700Z.commit.62f47a0  yes    
10663490  version:4.2.3-dev.20190120T055019Z.commit.b1ee6f5  yes    
10663489  version:4.2.3-dev.20190121T183335Z.commit.f074aab  yes    
10663488  version:4.2.3-dev.20190121T185348Z.commit.662ec91  yes    
10663487  version:4.2.3-dev.20190122T164323Z.commit.ed230c1  yes    
10663486  version:4.2.3-dev.20190122T212758Z.commit.89ad5a6  yes    
10663485  version:4.2.3-dev.20190123T194930Z.commit.1c55df8  yes    
10663484  version:4.2.3-dev.20190123T233953Z.commit.4100e59  yes    
10663483  version:4.2.3-dev.20190124T162317Z.commit.4418763  yes    
10663482  version:4.2.3-dev.20190124T200155Z.commit.6a1c3a4  yes    
10663481  version:4.2.3-dev.20190124T210837Z.commit.d95f95c  yes    
10663480  version:4.2.3-dev.20190125T154240Z.commit.faa77a4  yes    
10663479  version:4.2.3-dev.20190125T233317Z.commit.af85d89  yes    
10663478  version:4.2.3-dev.20190128T190736Z.commit.61d01da  yes    
10663477  version:4.2.3-dev.20190128T210658Z.commit.af3fd3e  yes    
10663476  version:4.2.3-dev.20190128T220626Z.commit.6a5ad04  yes    
10663475  version:4.2.3-dev.20190129T174811Z.commit.7d97050  yes    
10663474  version:4.2.3-dev.20190129T210716Z.commit.d549d61  yes    
9825425   version:4.2.3-dev.20190129T224207Z.commit.6236c36  yes    
10086735  version:4.2.3-dev.20190130T222957Z.commit.146a1d6  yes    
10436564  version:4.2.3-dev.20190131T233231Z.commit.b2a4e35  yes    
10526253  version:4.2.3-dev.20190201T055853Z.commit.7855958  yes    
10663214  version:4.2.3-dev.20190201T154818Z.commit.fc1dfcb  yes    
10731880  version:4.2.3-dev.20190201T201645Z.commit.17c35db  yes    
10663491  version:4.2.3-dev.20190119T181041Z.commit.3c56323  yes    

...and here's git log --first-parent --oneline:

2648e2ec (HEAD -> master, origin/master, origin/HEAD) attempt to work around bosh-release-resource bug
17c35db3 bump concourse to 5.0.0-rc.52
fc1dfcb0 Merge pull request #11 from concourse/issue/2908
7855958a bump concourse to 5.0.0-rc.51
b2a4e35a bump concourse to 5.0.0-rc.50
146a1d64 bump concourse to 5.0.0-rc.49
6236c364 bump concourse to 5.0.0-rc.48
d549d61e bump concourse to 5.0.0-rc.47
7d970503 bump concourse to 5.0.0-rc.46
6a5ad04a bump concourse to 5.0.0-rc.45
af3fd3ea bump concourse to 5.0.0-rc.44
61d01daf bump concourse to 5.0.0-rc.43
af85d893 bump concourse to 5.0.0-rc.42
faa77a4d bump concourse to 5.0.0-rc.41
d95f95c7 bump concourse to 5.0.0-rc.40
6a1c3a4a bump concourse to 5.0.0-rc.39
44187635 bump concourse to 5.0.0-rc.38
4100e598 bump concourse to 5.0.0-rc.37
1c55df88 bump concourse to 5.0.0-rc.36
89ad5a6c bump concourse to 5.0.0-rc.35
ed230c1b bump concourse to 5.0.0-rc.34
662ec911 bump concourse to 5.0.0-rc.33
f074aab3 bump concourse to 5.0.0-rc.32
b1ee6f51 bump concourse to 5.0.0-rc.31
3c56323f bump concourse to 5.0.0-rc.30
2769b3ae bump concourse to 5.0.0-rc.29
23441642 bump concourse to 5.0.0-rc.28
793fa20e bump concourse to 5.0.0-rc.27
cc859c4e bump concourse to 5.0.0-rc.26

...and here it is without --first-parent (note the offending commit, 62f47a06, which is one of the merge parents):

2648e2ec (HEAD -> master, origin/master, origin/HEAD) attempt to work around bosh-release-resource bug
17c35db3 bump concourse to 5.0.0-rc.52
fc1dfcb0 Merge pull request #11 from concourse/issue/2908
7855958a bump concourse to 5.0.0-rc.51
b2a4e35a bump concourse to 5.0.0-rc.50
146a1d64 bump concourse to 5.0.0-rc.49
6236c364 bump concourse to 5.0.0-rc.48
d549d61e bump concourse to 5.0.0-rc.47
7d970503 bump concourse to 5.0.0-rc.46
6a5ad04a bump concourse to 5.0.0-rc.45
af3fd3ea bump concourse to 5.0.0-rc.44
61d01daf bump concourse to 5.0.0-rc.43
af85d893 bump concourse to 5.0.0-rc.42
faa77a4d bump concourse to 5.0.0-rc.41
d95f95c7 bump concourse to 5.0.0-rc.40
6a1c3a4a bump concourse to 5.0.0-rc.39
44187635 bump concourse to 5.0.0-rc.38
4100e598 bump concourse to 5.0.0-rc.37
1c55df88 bump concourse to 5.0.0-rc.36
89ad5a6c bump concourse to 5.0.0-rc.35
ed230c1b bump concourse to 5.0.0-rc.34
662ec911 bump concourse to 5.0.0-rc.33
f074aab3 bump concourse to 5.0.0-rc.32
b1ee6f51 bump concourse to 5.0.0-rc.31
3c56323f bump concourse to 5.0.0-rc.30
62f47a06 (origin/issue/2908) add enable global resources flag to web spec
2769b3ae bump concourse to 5.0.0-rc.29
23441642 bump concourse to 5.0.0-rc.28
793fa20e bump concourse to 5.0.0-rc.27
dpb587 commented 5 years ago

Oops, sorry; I lost track of this. I’ll try to take a look this weekend. Thanks for the extra details and suggestions.

dpb587 commented 5 years ago

Should be fixed now. Thanks, again.

fly resource-versions; neat.

vito commented 5 years ago

great, thanks!