I see your point but we really do have this need, so it's only fair to 
point it out. We manufacture kit running on custom hardware with our own 
Android spins. This hardware is variously dotted around the place; the 
version number + build info pops up in an about box, logs, crash reports 
etc. So you can imagine the ranges of stability we get with these 
permutations. Now, any tester/dev/manager can wander up to this kit and 
have a play. At any point, it can have any build on - from an uncommitted 
one a dev made from his PC 5 minutes ago right through to the latest stable 
one test just spent 2 weeks QA'ing. Since we moved over to Gradle/Jenkins 
we have a single build script on both the dev PC's and CI. Ultimately, we'd 
like to get the dev name in there too for non-Jenkins PC only builds 
("blame" on steroids). It's *just* this "source" as a kind of write only 
audit string, of course you're right regarding any other logic flows. The 
deviation stops right there :-)

On Wednesday, 18 June 2014 10:04:27 UTC+1, Stephen Connolly wrote:
>
> Well JENKINS_HOME will not be guaranteed to be set when running on a build 
> slave... so really not robust.
>
> In any case, IMHO, it is a bad plan if the build runs differently when run 
> on the CI server versus when run on a developer's machine... you run the 
> risk of returning to the bad ways of "well it builds on my machine" only 
> now it becomes "well it builds on *all* the developers machines so the CI 
> server *must* be broken"!
>
> One thing you could do is have some sort of one-way hash function and 
> store a secret at a specific file system location on all your build 
> slaves... then check if the hash of that file matches and if it does... 
> you're on a Jenkins machine...
>
> That won't help if developers can login to build slaves directly though
>
>
> On 18 June 2014 09:59, William Damage <bill.d...@gmail.com <javascript:>> 
> wrote:
>
>> Our devs use the same build.gradle script in Android Studio as Jenkins - 
>> but we'd like to know if the build was created locally or from CI. 
>> I guess I can test if $JENKINS_HOME is set as an env var but this doesn't 
>> seem too robust; an enterprising dev might even set Jenkins up locally or 
>> whatever.
>>
>> Is there anything I can test to guarantee the build is being run under 
>> Jenkins please?
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to