Re: git checkouts always set to controller user, causing problems with latest git

2022-11-02 Thread 'Björn Pedersen' via Jenkins Users


Mark Waite schrieb am Freitag, 28. Oktober 2022 um 15:17:21 UTC+2:

> I suspect that you'll find that something is misconfigured in your agent 
> definition rather than an issue in the checkout step.
>
> I think you'll be able to see that if you:
>
>1. Create a file in the workspace from inside the Pipeline
>2. Check the permissions of the created file
>
> I suspect you'll see that the permissions are the same as the permissions 
> generated by the checkout scm task.
>
>
I found the core cause:  
 https://github.com/jenkinsci/git-plugin/pull/1237/ disables the hooks by 
default. So I just need to re-nable hooks where they are needed.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fdaf81a1-0788-47cf-aaef-eb8248acd42cn%40googlegroups.com.


Re: git checkouts always set to controller user, causing problems with latest git

2022-10-28 Thread Mark Waite
I suspect that you'll find that something is misconfigured in your agent 
definition rather than an issue in the checkout step.

I think you'll be able to see that if you:

   1. Create a file in the workspace from inside the Pipeline
   2. Check the permissions of the created file

I suspect you'll see that the permissions are the same as the permissions 
generated by the checkout scm task.

This is the Pipeline script that I used to confirm it:

pipeline {
agent {
label '!windows' // sh step not available on windows
}
stages {
stage('Hello') {
steps {
   writeFile file: 'a-test-file.txt', text: 'Some text inside 
the file'
   sh 'ls -altr a-test-file.txt'
}
}
}
}
On Friday, October 28, 2022 at 5:32:48 AM UTC-6 ice...@googlemail.com wrote:

> In our setup we  run the agents  a separate user via ssh ( contoller: 
> jenkins, agent: jenkinsworker).
>
> In a pipeline we  checkout some code:
> ```
> node(agent) {
>checkout git+ssh://.
>   }
> ```
> This  results in the workdir and all git files belonging to the user 
> jenkins,  not jenkinsworker.
>
> Trying to do a commit (with the need to run a commit-msg hook) fails to 
> run the hook unless I explicitly allow the directory as  safe and correct 
> the hook path (it is set to /dev/null if the directory belongs to an other 
> user ).
>
> I would have  expected the workdir to be owned  by the agent user.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d2943e1e-4caa-47ca-8a30-007d14358107n%40googlegroups.com.


git checkouts always set to controller user, causing problems with latest git

2022-10-28 Thread 'Björn Pedersen' via Jenkins Users
In our setup we  run the agents  a separate user via ssh ( contoller: 
jenkins, agent: jenkinsworker).

In a pipeline we  checkout some code:
```
node(agent) {
   checkout git+ssh://.
  }
```
This  results in the workdir and all git files belonging to the user 
jenkins,  not jenkinsworker.

Trying to do a commit (with the need to run a commit-msg hook) fails to run 
the hook unless I explicitly allow the directory as  safe and correct the 
hook path (it is set to /dev/null if the directory belongs to an other user 
).

I would have  expected the workdir to be owned  by the agent user.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6e3b-eeed-44a3-8ee3-82330923782dn%40googlegroups.com.