atomist / sdm-local

Local software delivery machine support
Apache License 2.0
13 stars 4 forks source link

Post-receive hook sends wrong commit data for branch commit #158

Closed cdupuis closed 6 years ago

cdupuis commented 6 years ago
Executing git hook against project {"event":"post-receive","baseDir":"/Users/cdupuis/atomist/atomist/cli","branch":"atomist-update-latest-1535459640988","sha":"164f305ed7f8f9142f7fb3cbb2a786eebc1a6047","workspaceId":"local"}
Created GitProject
/Users/cdupuis/atomist/atomist/cli ==> git rev-parse --abbrev-ref HEAD
master

/Users/cdupuis/atomist/atomist/cli ==> git for-each-ref --format "%(upstream:short) %(upstream:trackshort)" refs/heads/master
origin/master >

/Users/cdupuis/atomist/atomist/cli ==> git rev-list -1 HEAD --
1982af4917631a39b3d271cc62b3cb6a9f6205ef

/Users/cdupuis/atomist/atomist/cli ==> git status --porcelain

/Users/cdupuis/atomist/atomist/cli ==> git status --porcelain --ignored
!! index.d.ts
!! index.js
!! index.js.map

[/Users/cdupuis/atomist/atomist/cli] git log --format=%B -n 1 1982af4917631a39b3d271cc62b3cb6a9f6205ef stdout was 
date

and the following event is raised against the SDM

Calling url /event to handler SetGoalsOnPush using {"extensions":{"operationName":"SetGoalsOnPush","query_id":"q-1535459642169","team_id":"local","team_name":"local","correlation_id":"atomist-cli-general-1535459642169"},"secrets":[{"uri":"github://user_token?scopes=repo,user:email,read:user","value":"4**************************************d"},{"uri":"github://org_token","value":"4**************************************d"},{"uri":"github://org_token","value":"4**************************************d"},{"uri":"github://user_token","value":"4**************************************d"}],"api_version":"1","data":{"Push":[{"id":"1535459642169_","branch":"atomist-update-latest-1535459640988","repo":{"owner":"atomist","name":"cli","org":{"owner":"atomist","ownerType":"organization","provider":{"providerType":"github_com","apiUrl":"just.not.there","url":"and.nor.is.this","providerId":"foo"}},"channels":[{"name":"cli","id":"cli","team":{"id":"local"}}],"defaultBranch":"master"},"commits":[{"message":"date","sha":"1982af4917631a39b3d271cc62b3cb6a9f6205ef","committer":{"login":"Christian","person":{"chatId":{"screenName":"Dupuis"},"gitHubId":{"login":"Christian"},"forename":"","surname":"Christian","name":"Christian","emails":[{"address":"Christian"}]}},"author":{"name":"Christian","login":"Christian"},"timestamp":"1535458790"}],"after":{"message":"date","sha":"1982af4917631a39b3d271cc62b3cb6a9f6205ef","committer":{"login":"Christian","person":{"chatId":{"screenName":"Dupuis"},"gitHubId":{"login":"Christian"},"forename":"","surname":"Christian","name":"Christian","emails":[{"address":"Christian"}]}},"author":{"name":"Christian","login":"Christian"},"timestamp":"1535458790"},"before":{"message":"date","sha":"8ec651abc01acfcfb63001320516d18f2b2b080c","committer":{"login":"Christian","person":{"chatId":{"screenName":"Dupuis"},"gitHubId":{"login":"Christian"},"forename":"","surname":"Christian","name":"Christian","emails":[{"address":"Christian"}]}},"author":{"name":"Christian","login":"Christian"},"timestamp":"1535458730"},"timestamp":"1535458790"}]}}
ddgenome commented 6 years ago

A post-receive hook received a list of references being pushed via standard input. Perhaps we are taking the first and ignoring the rest?

cdupuis commented 6 years ago

The first log statement is correct. It seams we are getting the correct values but then switching back it whatever was currently checked out in project root.

cdupuis commented 6 years ago

I picked this up. Hopefully have a fix soon.