- 
                Notifications
    
You must be signed in to change notification settings  - Fork 146
 
feat: Add Annotated Tag Push Support #1139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # src/ui/views/OpenPushRequests/components/PushesTable.tsx # src/ui/views/PushDetails/PushDetails.tsx
          ✅ Deploy Preview for endearing-brigadeiros-63f9d0 canceled.
  | 
    
          Codecov Report❌ Patch coverage is  Additional details and impacted files@@            Coverage Diff             @@
##             main    #1139      +/-   ##
==========================================
- Coverage   83.71%   83.53%   -0.18%     
==========================================
  Files          67       68       +1     
  Lines        2886     3013     +127     
  Branches      365      408      +43     
==========================================
+ Hits         2416     2517     +101     
- Misses        410      425      +15     
- Partials       60       71      +11     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
| } else if (action.tagData?.length) { | ||
| action.user = action.tagData.at(-1)!.tagger; | ||
| } else { | ||
| throw new Error('No commit or tag data parsed from packfile'); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the commitData check here is causing this test to fail:
it.only('should return empty commitData on empty branch push', async () => {
  const emptyPackBuffer = createEmptyPackBuffer();
  const newCommit = 'b'.repeat(40);
  const ref = 'refs/heads/feature/emptybranch';
  const packetLine = `${EMPTY_COMMIT_HASH} ${newCommit} ${ref}\0capabilities\n`;
  req.body = Buffer.concat([createPacketLineBuffer([packetLine]), emptyPackBuffer]);
  const result = await exec(req, action);
  expect(result).to.equal(action);
  const step = action.steps.find(s => s.stepName === 'parsePackFile');
  expect(step).to.exist;
  expect(step.error).to.be.false; // <-- Fails here
  expect(action.branch).to.equal(ref);
  expect(action.setCommit.calledOnceWith(EMPTY_COMMIT_HASH, newCommit)).to.be.true;
  expect(action.commitData).to.be.an('array').with.lengthOf(0);
});Ideally, we want to allow empty commitData so that we can interpret it later: It might be an empty branch push, a tag push or something else entirely.
Perhaps we could move this check into the another action? We could rename the checkEmptyBranch action to handleEmptyCommitData and do all the relevant checks there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core flow seems to work correctly! Just a few edge cases and an integration issue with the checkEmptyBranch that might be worth refactoring.
Also, we will be merging #973 soon which will likely cause a few conflicts here... Might want an extra pair of eyes to make sure everything is good to merge.
| 
           Updated with the latest changes of main and manually tested also with gitlab  | 
    
| action = await proc.pre.parseAction(req); | ||
| // 2) Parse the push payload first to detect tags/branches | ||
| if (action.type === RequestType.PUSH) { | ||
| action = await proc.push.parsePush(req, action); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I misunderstood the flow here, but isn't parsePush executing twice when pushing branches? Seems it executes here, and once again as part of the branchPushChain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless, it seems the push flow is working as expected - just not sure if this is running twice or if the parsePush prevents the double execution somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I tested the tags and regular push flow and both work as expected with the new updates 👍🏼
Just a comment on the parsePush which I'm not sure if it's executing once or twice on pushes.
| 
           As we're modifying the proxy logic, another pair of eyes here would be super helpful! 👀 @finos/git-proxy-maintainers  | 
    
Description:
This PR introduces end-to-end support for annotated tag pushes
branchPushChainandtagPushChain.getChain()to select the correct chain based onaction.typeand presence ofaction.tag.Fixes #986
Note: Restored from deleted fork
This PR recreates the original PR #1051, which was automatically closed due to accidental fork deletion.
** For discussions and reviews:** See the original PR #1051
All commits are identical to the original with preserved git history.