Jenkins perforce plugin: can I get it to do full sync if key files are missing? -
we using jenkins perforce plugin reasonably in semi-continuous integration setup. "reasonably" in because our builds slow, not related jenkins , more our own code.
one of main problems have if files have been deleted outside builds - e.g. if low on diskspace , "prunes" builds on build machines - p4 plugin cannot directly handle that. in mode run (without full-sync flag) assumes files sync'd on previous run still there.
this covered under "quirks" on plugin page - https://wiki.jenkins-ci.org/display/jenkins/perforce+plugin - suggests "one time force sync" workspace normal. however, have couple of build machines each config bit of redundancy. in case, machine run next not same 1 had problem. makes tricky adding new machines pool.
i wondered if had better solution. e.g. if key files missing (indicative of build being wiped) forced sync anyway?
ok took me while twigged approach works @ least in our setup. pretty near top of job check existence of particular file. if not exist, assume workspace has been wiped (if exist, assume ok). if has been wiped, equivalent of "remove client" of files. modify few files during build, i've added revert in measure. not sure if required - suspect not - should no harm.
on pc means adding following first build step:
if not exist //%p4client%/sdk/changelog.txt ( rem remove client. throw away files being modified p4 revert %workspace%/... p4 sync %workspace%/...#none > nul )
on mac (and linux boxes assume):
if ! [ -e //%p4client%/sdk/changelog.txt ] # remove client. throw away files being modified p4 revert $workspace/... p4 sync $workspace/...#none > /dev/null fi
sdk/changelog.txt file assume marks valid installation. reset environment next sync equivalent of forced sync.
Comments
Post a Comment