Hudson CI: The user permission for shell script - hudson

I am setting up Hudson to run a shell script, which simply copy the workspace to a different folder. I got the following error:
cp: cannot create directory
`/home/u123/Temp/workspace':
Permission denied
My question is, which user Hudson build is running? I installed Hudson as a Ubuntu service according to this page: http://pkg.hudson-labs.org/debian/
Thanks!

Why not ask hudson itself? Create a job and in that job have it run the command "id" and/or "whoami". The answer should be in the console output of the job.

Related

gitlab ci shell runner reports profile loading problem

I'm trying to setup the gitlab ci shell runner. I've used the docker runner before successfully but now I'd like to use another docker container within my testing routine and therefore switched to the shell runner.
After registering I'm running into an exception:
ERROR: Job failed (system failure): prepare environment: exit status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
So, I went through the linked material but that didn't cure the problem. Now, I verified that the gitlab-runner user exists and it has access to docker (needed to run the docker test container). Also the gitlab-runner user is part of the docker group. I can also --login, fire up the /bin/bash without problems.
Still, all I get from the runner side is the the enigmatic message above. What other checkups to I need to do to track down this issue?
The careful reader will find the answer:
"A common failure is when you have a .bash_logout that tries to clear
the console."

Why is Google Cloud SDK (gcloud) trying to access a local MySQL instance?

I installed the Google Cloud SDK (gcloud) on my Windows workstation several weeks back. I noticed that every time I run a command, I saw output similar to:
MySQL: command not found
... before the normal command begins. I assumed that the SDK detected that I have MySQL installed on my workstation, and was trying (in a very buggy manner) to hook into it for Cloud SQL support. It was annoying, but I didn't pay it much attention.
Today I ran a gcloud components update command, and now the SDK is altogether non-functional. Apparently Google fixed the issue with the MySQL command's PATH, as the SDK is successfully invoking mysql.exe with every execution.
It's trying to connect with the MySQL user Utilities, and prompting me for a password. Of course I have no idea what the password is supposed to be, since I didn't create this user.
I went into MySQL Workbench and set the password for this user to a known value, so that I can get past the password prompt triggered by the SDK. However, the problem now is that any gcloud command that I type simply drops me into a MySQL shell session!
What the hell? I'm not sure why Cloud SDK is so insistent on accessing my local MySQL environment anyway. We do use Cloud SQL, but I have no particular interest in using gcloud to manage it (particularly if it's buggy). I can't remove the Cloud SQL component from my local environment right now... because once again, any gcloud command simply drops me into a MySQL shell. So I suppose my next step is to wipe the SDK off my workstation altogether, and attempt to install again without Cloud SQL selected. Why is any of this necessary at all?
UPDATE:
Blowing away my Cloud SDK enviroment and re-installing did not make the problem go away. However, removing mysql.exe from my system PATH did. Apparently, the current version of Cloud SDK simply breaks right now (at least on Windows) when it detects MySQL in your path. I wonder how this made it past QA?
The output from gcloud info is below (email address and current project ID redacted):
> gcloud info
Google Cloud SDK [0.9.67]
Platform: [Windows, x86_64]
Python Version: [2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)]]
Site Packages: [Disabled]
Installation Root: [C:\Program Files\Google\Cloud SDK\google-cloud-sdk]
Installed Components:
core: [2015.06.30]
bq-win: [2.0.18]
core-win: [2015.06.02]
gcloud: [2015.06.30]
windows-ssh-tools: [2015.06.02]
gcutil-msg: [2015.06.09]
gsutil: [4.13]
bq: [2.0.18]
preview: [2015.06.30]
gsutil-win: [4.12]
System PATH: [C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin\..\bin\sdk;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\Docker\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\Steve\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\HashiCorp\Vagrant\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Git\cmd;C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin;C:\PROGRA~2\Groovy\GROOVY~1.3\bin;C:\Users\Steve\.dnx\runtimes\dnx-coreclr-win-x86.1.0.0-beta5\bin;C:\Users\Steve\.dnx\bin;C:\Dev\gradle-2.4\bin;C:\Users\Steve\AppData\Roaming\npm;C:\Users\Steve\AppData\Local\Code\bin;C:\Program Files\Boot2Docker for Windows]
Cloud SDK on PATH: [True]
Installation Properties: [C:\Program Files\Google\Cloud SDK\google-cloud-sdk\properties]
User Config Directory: [C:\Users\Steve\AppData\Roaming\gcloud]
User Properties: [C:\Users\Steve\AppData\Roaming\gcloud\properties]
Current Workspace: [None]
Workspace Config Directory: [None]
Workspace Properties: [None]
Account: [...]
Project: [...]
Current Properties:
[core]
project: [...]
account: [...]
disable_usage_reporting: [False]
Logs Directory: [C:\Users\Steve\AppData\Roaming\gcloud\logs]
Last Log File: [C:\Users\Steve\AppData\Roaming\gcloud\logs\2015.07.06\11.43.23.734000.log]
I can't comment so will post as an answer.
You probably have some environmental variable set up in a way that confuses gcloud. Can you also post the output of set cloudsdk from the command line? That should print all the environmental variables with the prefix "cloudsdk". You can redirect it to a file so it's easier to copy: set cloudsdk > environment_cloudsdk.txt.
Not sure how this can happen. If the CLOUDSDK_ env vars are empty, and gcloud.cmd is correct, gcloud shouldn't touch mysql at all. "c:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd" lists at the top what each env var does. Make sure they are not set. Also when you reinstall Cloud SDK, make sure the directory "c:\Program Files\Google\Cloud SDK\" is properly deleted and that there's nothing in the PATH var about it.

How to use ant to compile and deploy my webapp in openshift server?

I don't have ant in my server. When I do rhc ssh myapp and tried to use ant, it shows "bash: ant: command not found". But I find jars related to ant in my folder "jbossews/lib/catalina-ant.jar".
I tried to install ant by sudo apt-get install ant, but it shows "bash: /usr/bin/sudo: Permission denied"
so I dont know what to do.
Ant functionality is not available on OpenShift at this time. I'm working on clearing up some conflicting articles on our side. Also, root access (sudo) isn't available to users in their gears.
Just use the commands below:
wget https://www.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.zip
unzip apache-ant-1.9.4-bin.zip

Configuring Bazaar in Hudson

I am trying to configure a task in Hudson for a VC++ project. I was able to build a project from the file system with MSBuild task. But when I try to configure the task to check out a bazaar repo to do the build, checkout is always failing in authentication. Bazaar passwordless access is setup on the machine and when I use bzr cmd line, checkout is happening without password. Another post suggested that I should have the id_rsa in C:\Documents and Settings\Administrator.hudson - but that also did not help. In Subversion config I saw a way of mentioning username and password. Is there any way to get around this problem.
I assume you have set up the authentication in the windows equivalent of ~/.bazaar/authentication.conf (use bzr version -v to get the correct location).
Is hudson running as the same user as the one you use to connect with the command-line? Because that will impact which authentication.conf it will try to use.
My hudson is using authentication.conf fine but I run it on Ubuntu.
I solved the problem. The authentication.conf is not being considered in windows. I made the repo accessible through http and configured the bazaar with that URL. It was able to download the repo with http protocol without asking for password. One more thing I did was I created a username in hudson, which I matched with a user having access in the bazaar repo which solved another problem which was asking for a user named pwd.

Why won't my NAnt builds run in Hudson?

My NAnt builds run fine locally on a developer machine, and locally on the command line of the Hudson server, but they will not run in my configured Hudson project.
The console output when I run a Build via the Hudson web UI is similar to the following :
Started by user anonymous [workspace]
$ sh -xe
C:\WINDOWS\TEMP\hudson8104357939096562606.sh
C:\WINDOWS\TEMP\hudson8104357939096562606.sh:
fork failed: no error [1] Archiving
artifacts Finished: SUCCESS
I have another project configured properly that runs fine so I know the NAnt plugin is setup properly in Hudson, and that NAnt is on the system path.
Can anyone suggest possible causes as to why this build won't run?
The problematic build may be configured to Execute a Shell script, rather than Execute a Windows Batch file.
Copy the command from the existing build step (the Execute Shell Script) and remove the step. Then add a new step to Execute a windows Batch File and paste the command.
Trigger the build and observe the results.
(I asked and answered this since it took me quite a while to figure out how I had mis-configured this particular build. Hopefully it'll save time or give ideas to other people trouble-shooting automation..)