Use the MSBuild plugin in Jenkins to run code as an admin - jenkins

I'm trying to get Jenkins to run the MSBuild as an admin on Visual Studio. Is there a configuration param I can add to the exe call to achieve this?

So far as I know the only option is to run the Jenkins node agent with an Admin privileges account.

Related

unable to see "ADE" option under "Source Code Management" in Jenkins

I have setup a new Jenkins instance in docker.
Now am trying to create a new job. But the problem that am facing is my Source Code is in ADE.
But under "Source Code Management" i see only 2 options: 1) None 2) Git.
I dont see "ADE" option.
Is there any Plugin for ADE in jenkins?
Please do help
I worked at Oracle for some months and I used ade. Since ADE is a propietary SCM from Oracle, it is fully integrated in Oracle products. As far as I know, ADE can´t be integrated with jenkins natively but I think you could create a transaction in your jenkins server. When you need to build in jenkins, you would need to pull the transaction on your machine to the jenkins server. If you can set an observer or listener in jenkins when something changes in your transaction then trigger the build.
I am not sure if this can help you.
I have installed Jenkins in a docker container hosted on my Linux machine. Now the problem am facing is that I am unable to login to my Jenkins instance(UI) as my Unix\Linux user.
When i navigate to "Manage Jenkins >> Security >> Configure Global Security", under "Security Realm", I see an option called "Unix user/group database". If i select that option its asks(prompts) for "Service Name". I enter "sshd" and then click on "Test" button. On doing so it gives the below error: "User ‘jenkins’ needs to belong to group shadow to read /etc/shadow".
I am not sure how to fix it as am very new to docker as well as jenkins. Finally what i want to achieve is "i want to be able to login using my Unix\Linux credentials".

Jenkins plugin to copy files to windows server

I have a situation where in I need to copy set of files to a windows server through Jenkins. I see a lot of Jenkins plugins that will do this kind of job through ssh but not in my case. Jenkins is also hosted in a windows server and end server is also a windows, so I believe ssh is not an option. Any plugin available in the market to get the job done or writing our requirements in powershell/MSDos script is the only option?
Thanks in advance!
just execute a bat command with the following
copy C:\localfile.bak \\remotemachine\c$\Path\remotefile.bak
in the Using the Execute Windows batch command option in the build Step
How to run bat file in jenkins

TFS + Jenkins job

I have a project on local TFS server. This project has a PowerShell script which creates the build.
I need to create a correct JOB in Jenkins, which will start when any change happens in the project (TFS). This job will automatically start PS script on project directory.
Please, help me with this task.
Based on your description, you just need to integrate Jenkins with TFS and set CI/CD to trigger the build/release in Jenkins.
To run PowerShell in Jenkins you can refer this article: Running Powershell scripts using Jenkins
For the Jenkins integration and CI/CD, you can reference below articles:
TFS and Jenkins Integration
Visual Studio Team Services Integration with Jenkins
Tutorial: Integrate your Jenkins CI jobs with VSTS CD to Azure

How can I report the current tfs user from tf.exe?

How can I report from my build scripts who the current tfs user is?
I'm setting up automated builds with TFS 2013 and VSO and I'm having workspace errors.
I'm unable to checkout files through the build script.
I'd like to know what the user is running the tf.exe command (I've already had issues with the user running the build being automatically set to a Network Service user, who has not permissions)
In any of the pre-/post-script print the USERNAME variable. In Powershell
Write-Output "Running as '$env:USERNAME"
In a batch file
echo Running as %USERNAME%

How can we execute Jenkins job using other user credential

I need to execute few of the Jenkins jobs such as "Release to Production" through Jenkins UI using logged on user credential. The reason is, we have separate Support Team Members, who have access to the production boxes and not the Dev team members. So, in order to deploy any code base to production, all the Windows Deploy Commands (ex, create, update files, folder etc.) needs to be run with specific user credential who has access to the Production Box. So that even the Dev team members who don't have access to the Production box but are Jenkins Admin, execute the same job should result in failure due to "Access Denied". The job should succeed only if its been run by Support Team members with their credential.
I tried using parameterized plugin but couldn't able to pass the Password successfully to the batch file which contains MSDeploy instructions. Even the Jenkins console log displays the parameter passed in its console output, which is a security issue.
I checked Role based security plugin, but that doesn't help me much. I just need a plugin which should ask for user to provide their credential before start building the Job and should use the user credential to get the job executed, so that my MSDeploy command will be able to deploy the code on Production boxes, when the Support team member build that Job using their credential. I wish there was support for impersonation.
Right now all the Jenkins Jobs are getting executed using the service account which the Tomcat service is configured to run with on which Jenkins is hosted.
Any help would be appreciated.
Just in case there is any confusion a Jenkins job will always run as the same OS user. The Matrix based security applies to users who log into the Jenkins server and controls features like creating or launching jobs.
You could configure the job to use a set of generic production credentials and then prevent your developers from invoking the job.
Perhaps a better approach would be to separate the process that builds the code from the one that deploys the code. The following diagram (Taken from the xebia-france project) demonstrates how some of my favourite tools Rundeck and Nexus can be integrated with Jenkins.
Finally, I highly recommend reading the following link:
Using Rundeck and Chef to build devops tool chains
Hi I know I'm coming late on this thread, but I just fell on this issue and had a hard time solving it, so I thought I might just share what I managed to set-up.
First things first: if you want to run a Jenkins job "as a specific user" (with all the correct habilitations) the easiest way is to run a Jenkins SLAVE as this user.
Then you might very well stumble into the following: you probably want to run serveral slaves on the same windows machine as windows services. This is very fine, as long as each slave has his own Remote root directory and probably have a specific "label" too.
Once you managed to run your slave as a windows service, launch the service console (run services.msc). Edit the newly created service properties, go to Log On tab. Select "Log on as: This account" and enter your account credentials.
Cheers :)
You can utilize the built in windows runas or Powershell InvokeCommand cmdlet and -Credential to run - Both these would store the username/password in plain text - So do think about the risks, but this gives you flexibility.
I'm surprised this doesn't have a better answer of set an agent on another machine to run as another service and define agent as a special "type" which picks up the jobs - Something along those lines is what I would expect but I haven't seen an implementation like that in Jenkins (I'm new to Jenkins so was looking for an answer and found this thread).
Something else that could be considered for someone more familiar with Jenkins is when you set the custom path to MSBuild could you set that to runas /user:... msbuild.exe perhaps? I don't have an extra Jenkins server currently to try that on.

Resources