<p>In the pipeline post actions you can use this:</p>
<pre><code>post {
  always {
    deleteDir() // clean up our workspace
  }
}
</code></pre>
<p>What way no files in the workspace remain. You have to either copy the file you want to keep or save them as artefacts.</p>

CC BY-SA 4.0
2021-06-30T11:57:47.337Z
2021-06-30T11:57:47.337Z
David
<p>I have an SVN repo that only a subset of user's are allowed to access. I would like to have Jenkins checkout the repo and build it according the groovy script in the repo. However, when setting this up like my other pipelines BuildSlave fails due to not having permission to checkout the repo. There is an existing set of users with access to the repo but they do not have permission to start JAgent. Is there a way I can set up Jenkins such that there is some way to checkout the repo without unauthorized users being able to see the the pipeline or the SVN?</p>
<p>I have found
<a href="https://stackoverflow.com/questions/42426804/restricting-others-to-build-the-particular-job-in-jenkins">https://stackoverflow.com/questions/42426804/restricting-others-to-build-the-particular-job-in-jenkins</a></p>
<p>which pointed me towards <a href="https://plugins.jenkins.io/role-strategy/" rel="nofollow noreferrer">https://plugins.jenkins.io/role-strategy/</a></p>
<p>I think if I created a group in Jenkins that I would be able to define who can see the pipeline but that doesn't solve the SVN access. I am wary of adding BuildSlave to the SVN repo's whitelist. There is already a group account. I have been told adding this group account to Jenkins would allow unauthorized users to see the account. Is there a way to combine these role strategies with the group account to get what I want?</p>
<p>My team is currently thinking of setting up a separate Jenkins server to deal with the restricted project. How does that solution compare to built-in alternatives?</p>

<jenkins><authentication>
Jenkins pipeline for restricted repo
Czarking
# Jenkins pipeline for restricted repo

(Asked by: username_0 on 2021-04-19)

I have an SVN repo that only a subset of user's are allowed to access. I would like to have Jenkins checkout the repo and build it according the groovy script in the repo. However, when setting this up like my other pipelines BuildSlave fails due to not having permission to checkout the repo. There is an existing set of users with access to the repo but they do not have permission to start JAgent. Is there a way I can set up Jenkins such that there is some way to checkout the repo without unauthorized users being able to see the the pipeline or the SVN?

I have found
<https://stackoverflow.com/questions/42426804/restricting-others-to-build-the-particular-job-in-jenkins>

which pointed me towards <https://plugins.jenkins.io/role-strategy/>

I think if I created a group in Jenkins that I would be able to define who can see the pipeline but that doesn't solve the SVN access. I am wary of adding BuildSlave to the SVN repo's whitelist. There is already a group account. I have been told adding this group account to Jenkins would allow unauthorized users to see the account. Is there a way to combine these role strategies with the group account to get what I want?

My team is currently thinking of setting up a separate Jenkins server to deal with the restricted project. How does that solution compare to built-in alternatives?

**Tags:** jenkins, authentication


---

## 1 answers

### Answer by username_1 on 2021-06-30. Score: 1

In the pipeline post actions you can use this:
post {
  always {
    deleteDir() // clean up our workspace
  }
}

What way no files in the workspace remain. You have to either copy the file you want to keep or save them as artefacts.


---

