Skip to content
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

Add step to ensure Buildbot checks out right commit #531

Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -14,6 +14,36 @@
SERVO_REPO = "https://github.com/servo/servo"


class CheckRevisionStep(buildstep.BuildStep):
"""\
Step which checks to ensure the revision that triggered the build
is the same revision that we actually checked out,
and fails the build if this is not the case.
"""

haltOnFailure = True
flunkOnFailure = True

def __init__(self, **kwargs):
buildstep.BuildStep.__init__(self, **kwargs)

@defer.inlineCallbacks
def run(self):
rev = self.getProperty('revision')
got_rev = self.getProperty('got_revision')

# `revision` can be None if the build is not tied to a single commit,
# e.g. if "force build" is requested on the status page
if rev is not None and rev != got_rev:
raise Exception(
"Actual commit ({}) differs from requested commit ({})".format(
got_rev, rev
)
)

defer.returnValue(SUCCESS)


class ServoFactory(util.BuildFactory):
"""\
Build factory which checks out the servo repo as the first build step.
@@ -29,6 +59,7 @@ def __init__(self, build_steps):
repourl=SERVO_REPO,
mode="full", method="fresh", retryFetch=True
),
CheckRevisionStep(),
] + build_steps
# util.BuildFactory is an old-style class so we cannot use super()
# but must hardcode the superclass here
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.