Comments (5)
Drone does not always provide a last commit. Was the branch created with the push?
When drone provides no last build, drone-tree-config asumes just the last one. If you open a pull request the tests should be fine.
from drone-tree-config.
Yes, the branch was created with the push after the last commit. And you are right, pull request & Merge builds do solve the problem but we do some test on the branch level before pushing to master.
Maybe if I change this part to take the master branch as the before variable it would work? Or you think it will break something else?
// use diff to get changed files before := req.Build.Before if before == "0000000000000000000000000000000000000000" || before == "" { before = fmt.Sprintf("%s~1", req.Build.After) } var err error changedFiles, err = req.Client.ChangedFilesInDiff(ctx, before, req.Build.After)
from drone-tree-config.
i do not think its save to assume that the default branch is master.
also as far as i remember there where at least occasions where this happened
- new branches
- build restarts
currently i do not have the time for a full test setup. can you investigate further?
from drone-tree-config.
Hey, I found the bug and fixed it for our use case, i also edit the tests module, added the values needed for my solution to work, I opened a PR for this changes.
The problem was for builds triggered from push event, there was a git-diff between the last commit and the one before, that is wrong - when you push to remote branch in a multi branch environment - sometimes you have more than 1 commit.
scm.go:
} else { // use diff to get changed files before := req.Build.Before if before == "0000000000000000000000000000000000000000" || before == "" { before = fmt.Sprintf("%s~1", req.Build.After) }
There are 2 cases -
- New branch - condition is true, the "before" variable is populated with the last commit with a suffix of "~1", (which i don't understand why you inserted the suffix), and the "after" variable is also the last commit.
- Existing branch - condition is false, the "before" variable is populated with the commit before the push event and the "after" variable is also the last commit.
from drone-tree-config.
PR has been merged.
from drone-tree-config.
Related Issues (20)
- Failed SCM connections should be handled properly HOT 4
- Auth server for BitBucket client is not specified HOT 6
- Gitlab support? HOT 4
- v0.3.4 fails to trigger builds on master branch in monorepo HOT 8
- Add support for root folder files changing - trigger multiple pipelines HOT 2
- Git tags / Release support HOT 3
- How to use it on k8s HOT 2
- The plugin omit "..." in commands in steps HOT 2
- Documentation: Timeouts of consideration HOT 1
- Drone rebuilds everything every time HOT 7
- Rate limit hit HOT 1
- did not find a .drone.yml HOT 4
- Docker images for ARM
- bitbucket cloud authorization error
- BitBucker Server(previously known as Stash) support?
- Add GitLab self-hosted support? HOT 1
- Bitbucket integration error "unable to fetch diff"
- Wait the end of all pipelines? HOT 7
- Gitea support? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drone-tree-config.