-
Notifications
You must be signed in to change notification settings - Fork 481
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
Fix Continuous Integration change detection #32526
Fix Continuous Integration change detection #32526
Conversation
.drone.yml
Outdated
# Always fetch staging branch because the change detection logic compares against the staging branch even when the base | ||
# branch is staging-next: | ||
# https://github.com/code-dot-org/code-dot-org/blob/8ea6ee6b63abd36e51c69d400eefdaa87154030a/lib/cdo/git_utils.rb#L104-L113 | ||
- git fetch --depth 100 origin staging |
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.
why is it necessary to fetch to a depth?
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 don't see why it's necessary. My intent was to preserve the existing logic that fetches the target branch with a depth of 100 commits.
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.
Ah, it's needed to support the i18n sync process? 37120d8
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.
We specify a depth to do a shallow clone, which is faster. We need a high enough depth so that the commit where the feature branch was cut from the base branch is included (I don't remember exactly which step needs this). The whole thing probably could be improved, haven't looked at it since early last year.
The i18n sync process just adds a lot of new commits to one feature branch, hence the increase to 100 in that commit.
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.
that's why it's necessary to fetch to a depth for the feature branch, but if we're just fetching the staging branch for the sake of change detection, shouldn't we only need to fetch the latest commit?
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 (don't know what the git command being run is), good point though. Worth testing.
|
Starting fresh with @uponthesun suggestion to use an environment variable to detect we're executing in a Drone build. |
Description
Drone Continuous Integration builds skip unit tests when the target/base branch is
staging-next
because the detection of which source code directories have changed attempts to compare toorigin/staging
which is not present in the Drone container. The git command referencing theorigin/staging
branch raises an error because it has not been fetched. The best solution would probably be to compare the source code changes againstorigin/staging-next
, but this comparison takes place a few layers down in the Continuous Integration rake call stack where information about what the target branch of the Pull Request that invoked the build is no longer available.This change, instead, always fetches
origin/staging
. This assumes that most feature-branches off of thestaging-next
branch will trigger the same source code change detection when compared againststaging
.Reviewer Checklist: