The document discusses using Jenkins as a Python execution platform. It covers running Python code in Jenkins jobs, performing input/output operations, and persisting state across jobs using artifacts. The key points covered include running Python via shell scripts or plugins, passing data between jobs using environment variables, files, and serialized objects stored as artifacts, and sharing a JVM between Jenkins and Python using Jython. Examples of applications like the oVirt CI system are also mentioned.
22. Persisting statePersisting state
def object_from_artifact(artifact_file, fallback_cls):
try:
with open(artifact_file) as fd:
return cPickle.load(fd)
except IOError as e:
# errno 2 is 'No such file or directory'
if e.errno == 2:
return fallback_cls()
raise
def object_to_artifact(obj, artifact_file):
with open(artifact_file, 'w') as fd:
cPickle.dump(obj, fd)
35. ApplicationsApplications
● oVirt "Standard-CI":
– oVirt has many
different sub-projects
– The CI system is
project-agnostic
– Each project tell the CI
what to do
– We have local tool to
emulate CI system
36. ApplicationsApplications
●
oVirt “change-gating" flow:
– Runs “heavy” tests on batches of changes
– Runs bisection on failure to find root cause
Project 1Project 1
Project 2Project 2
Project NProject N
Change
queue
Change
queue
TestsTests