Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket pipeline: Owner of cloned files/dirs is root

Marcus November 3, 2023

Unfortunately the things that get cloned during a bitbucket pipeline are owned by root. Even if you set the run-as-user directive this is still the case. The only thing that changes when setting this directive is that the cached directories are owned by the defined user.

This is a problem on our use case, because we start a container within this container, where the user is not root. And we share the volume with this container, so we have a permission problem there.

1 answer

1 accepted

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 7, 2023

Hi Morgus,

You can add in your yml file a command to change the owner and group of the files in the build container's clone directory.

For example, if you want to change the owner to pipelines user and group to pipelines, you can execute the command:

sudo chown -R pipelines:pipelines /opt/atlassian/pipelines/agent/build

Does this work for you?

Kind regards,
Theodora

Marcus April 24, 2024

This worked thank you. But it doesn't feel like this is good practice. For me it would make more sense, if one could define which user should own the files in the build. Similar to the run-as-user command for the image.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2024

Hi Marcus,

You are very welcome and thank you for the feedback. I can create a feature request for what you are asking, for our development team to consider. Please feel free to let me know if you'd like me to proceed with that.

Kind regards,
Theodora

Marcus April 26, 2024

Yes, please proceed with that.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 29, 2024

Hi Marcus,

I went ahead and created a feature request here:

I would suggest adding your vote to that feature request (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy here and any updates will be posted in the feature request.

Kind regards,
Theodora

Like Marcus likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events