Hi Lee,

afaik is the logged in user who triggers the job providing the
context. It does not matter who is logged on in case the job is
triggered via the cron job of Jenkins. The service account is then
used at all times.
You could amend the jenkins service credentials to a expicit user but
I wouldn't mess around there. I've been there, didn't like it and went
away ;)

You can apply credentials of subsequent program/command calls with
help of the runas command.
Easiest is of course if all steps are running in Jenkins context to
make troubleshooting easier. But that's not always possible.
e.g. call an URL with wget. This will always end up in an anonymous
user if you don't apply some credentials.

Take care
Jan

On 19 Apr., 16:56, Lee Winder <lee.win...@gmail.com> wrote:
> Hi Jan
>
> I'm unsure if the first step succeeds, as if I just run a batch script with
> the same entry it fails for the same reason.
>
> But you've given me a number of things to try here, so I'll give them a try
> and see what the results are.
>
> Just a quick question, I assume when running the job that Jenkins does use
> a different user than the one logged in?  Is that correct, and is it
> possible to change that user?
>
> Thanks
>
>
>
>
>
>
>
> On Thursday, 19 April 2012 13:34:11 UTC+1, Jan Seidel wrote:
>
> > By the way.
>
> > It looks like some of your steps finish successfully right?
> > C:\Project\Asset_2\Export>C:\Project\Repository\Builder.exe --
> > a_lot_of_options_for_assets_2 is just failing if I dont get it wrong
>
> > Maybe you should prepend at each call
> > C:\Project\Asset_1\Export>C:\Project\Repository\Builder.exe --
> > a_lot_of_options_for_assets_1
> > IF %ERRORLEVEL% NEQ 0 echo ##### Builder.exe --
> > a_lot_of_options_for_assets_1 failed ##### && exit /B 1
>
> > C:\Project\Asset_2\Export>C:\Project\Repository\Builder.exe --
> > a_lot_of_options_for_assets_2
> > IF %ERRORLEVEL% NEQ 0 echo ##### Builder.exe --
> > a_lot_of_options_for_assets_2 ##### && exit /B 2
>
> > You can use the echo and/or exit to exactly know where it crashes. The
> > echo may not work if the text is too long or using echo-critical
> > characters.
> > Exit /B [call_number] is less prone to failure and you have simply to
> > count your way through the steps ;)
>
> > On Apr 19, 2:20 pm, Jan Seidel <wakkal...@gmail.com> wrote:
> > > What irritates me a bit is the exit code 255.
> > > Thats a not quite usual one from a plain build step. Looks to me like
> > > a return value from your builder.
>
> > > The builder runs for sure? also when you build it in the workspace C:
> > > \Program Files (x86)\Jenkins\jobs\02 - Daily
> > > Build\workspace ?
> > > I would always try to avoid paths with spaces or in this case even
> > > brackets. So I would test 2 things upfront.
> > > What happens when you execute the builder.exe with the "runas"
> > > command?
> > > What happens if at least the workspace is locate somewhere with plain
> > > numbers and letters only?
>
> > > To execute from a build step especially if one file calls another
> > > action may lead to an anonymous user latest for the action/second file
> > > call (if embedded).
> > > So calling a btach file that calls the builder.exe would not be my
> > > first choice ;)
>
> > > Take care
> > > Jan
>
> > > On Apr 19, 2:08 pm, Lee Winder <lee.win...@gmail.com> wrote:
>
> > > > Hi Jan, sorry, should have added this stuff but I was hoping the user
> > > > permission issue might have been a known problem :)
>
> > > > OS is Win7, Jenkins is running as a standalone service (default
> > service as
> > > > set up by the Jenkins .msi installer -
> >http://jenkins-ci.org/content/windows-installers-are-now-available)
>
> > > > Snap shot of the batch files is a tad harder to show as we're working
> > under
> > > > NDA, but it generally looks like
>
> > > > cd "C:\Project\Asset_1\Export"
>
> > > > C:\Project\Repository\Builder.exe     --a_lot_of_options_for_assets_1
>
> > > > cd "C:\Project\Asset_2\Export"
>
> > > > C:\Project\Repository\Builder.exe     --a_lot_of_options_for_assets_2
>
> > > > Console output is simply the content of the batch file followed by
> > failure
>
> > > > Started by user Lee Winder
>
> > > > Building in workspace C:\Program Files (x86)\Jenkins\jobs\02 - Daily
> > > > Build\workspace
>
> > > > [workspace] $ cmd /c call
> > C:\Windows\TEMP\hudson9141842775998444888.bat
>
> > > > C:\Program Files (x86)\Jenkins\jobs\02 - Daily Build\workspace>cd
> > > > "C:\Project\Asset_1\Export"
>
> > > > C:\Project\Asset_1\Export>C:\Project\Repository\Builder.exe
> > > > --a_lot_of_options_for_assets_1
>
> > > > C:\Program Files (x86)\Jenkins\jobs\02 - Daily Build\workspace>cd
> > > > "C:\Project\Asset_2\Export"
>
> > > > C:\Project\Asset_2\Export>C:\Project\Repository\Builder.exe
> > > > --a_lot_of_options_for_assets_2
>
> > > >  Build step 'Execute Windows batch command' marked build as failure
>
> > > > Sending e-mails to: ...
>
> > > > Finished: FAILURE
>
> > > > The build step simply looks like
>
> > > > C:\Project\Build_Scripts\Build_All_Assets.bat
>
> > > >  If I drop the commands into the Build Step directly I get the
> > following
> > > > failure message
>
> > > > C:\Project\Asset_2\Export>exit 255
>
> > > > Build step 'Execute Windows batch command' marked build as failure
>
> > > > Sending e-mails to: ...
>
> > > > Finished: FAILURE
>
> > > > I'm currently investigating the Builder.exe tool for more information
> > but
> > > > this is a legacy project and we don't have the source code for all
> > parts of
> > > > the process which makes it quite difficult!
>
> > > > Thanks for your help
> > > > Lee
>
> > > > On Thursday, 19 April 2012 12:50:09 UTC+1, Jan Seidel wrote:
>
> > > > > Hi Lee,
>
> > > > > some more information would be nice. I did forget my crystal orb at
> > > > > home ;)
> > > > > Which OS are you using?
> > > > > Do you run Jenkins as service?
> > > > > A snippet of your batch files would be helpful as much as an outtake
> > > > > of your build log would be.
>
> > > > > Take care
> > > > > Jan
>
> > > > > On 19 Apr., 13:43, Lee Winder <lee.win...@gmail.com> wrote:
> > > > > > I have a single batch file which calls a number of executables
> > which
> > > > > builds
> > > > > > various assets for our application.  When I run the batch file
> > manually
> > > > > it
> > > > > > works perfectly (the command prompt opens, the assets are built -
> > takes
> > > > > > about 10 minutes - and then it closes).
>
> > > > > > If I run this batch file via a build step, it successfully calls
> > the
> > > > > batch
> > > > > > file, but the individual steps inside the batch file fail (it just
> > skips
> > > > > > over each one).  I'm assuming this is down to some permission
> > issue
> > > > > between
> > > > > > the user used when I run the file manually and the user used when
> > > > > Jenkins
> > > > > > runs it.
>
> > > > > > If I move the content of the batch file into the build step itself
> > I get
> > > > > > the same results.
>
> > > > > > In the System Information screen my user name is actually my
> > computer
> > > > > name
> > > > > > (with a $ on the end) rather than an explicit user as defined in
> > my
> > > > > system
> > > > > > admin.
>
> > > > > > What user is used to run build steps and how can I change that
> > user?
> > > > >  Has
> > > > > > anyone else experienced this problem before and has a solution?
>
> > > > > > Thanks
> > > > > > Lee

Reply via email to