Closed pnwguy closed 3 years ago
Hello,
Just to be sure, do you want to detect changes on the QA branch or changes between QA and Staging branches?
This module tries to detect changes between the commit of the last successful build and the current one. It does not look if the branch differs.
We will investigate to find the best way to implement this behavior. Feel free to help by collaborating 😉
Thanks
Hi, I would love to help! I want to detect changes between QA and Staging. My use case - I want to determine if documentation file has changed, if so, import the new documentation file. This works great for same branch. Let me brush up on my git knowledge and see if I can provide some solutions.
@pnwguy @SomaticIT please have a look at this PR my be it can help #13
Hi guys!
@SomaticIT this is a nice tool! We wanna use it to speed up our monorepo builds. However this issue is preventing us from doing so.
This module tries to detect changes between the commit of the last successful build and the current one.
I think that statement needs to include the current branch, considering that pipelines can build more than one branch. i.e. when using Branch Policies for PRs.
I think we need to include the current branch here, and filter the "last successful build" for the current branch as well as the definition id.
So, find the last successful build for the current pipeline definition and current branch being built. Is that a PR you would consider merging?
Hi,
@mohamedelhabib your PR looks promising for this use case.
I think, we should consider using the same branch as the refBranchName
(need to remove the default value).
It will allow @pnwguy to specify a custom refBranchName
on Staging
and @leonardochaia could use the default behavior.
Do you agree?
Hey guys, sorry I didn't really look at the PR. I just think that the default behavior should be to "find the build for this definition and this branch". That works for single and multi branch repos and is safe by default.
Personally, I ended up using the API since I wanted to get the last successful build commit to use it for another tool which does the git diff internally
@SomaticIT sorry i just sow you comment
after several tests i found another approach using https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/get%20build%20changes?view=azure-devops-rest-6.0
and git log -m -1 --name-only --pretty='format:' <commitId>
to list changed files
I am still using refBranch
to detect changes between branches.
Please have a look here https://github.com/mohamedelhabib/vsts-changed-files-multibranch/blob/master/changed-files/index.ts#L64 NB : to be able to test i published a renamed version of the extension.
@SomaticIT i just created a new PR #16
@mohamedelhabib Just looking for the same feature, thanks!
Hello everyone,
I'm very happy to announce that we released a new version v1.2.1
today.
Many thanks to @mohamedelhabib for his work.
To summarize new features:
Can you give a try to the new version and give me your feedback?
PS: very sorry for the time.
I'm closing this issue as I think it's resolved with v1.2.1
.
If you encounter a case that is not handled with this new feature, please open a new issue.
This works perfectly when detecting file changes from within the same branch. However when I do pull requests from one branch to another (ie merging QA to Staging), it doesn't detect the file changes. Is this intended to work within a branch only?
If I do pull request from branch QA to Staging, the task shows:
If trigger was to detect a change to a specific file, and the file changes were implement as part of 20210427.2-[QA], then the pull request to 20210427.4-[Stage] won't pick it up even though the file, upon merge completion, will be changed.