Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


changing file permissions in a test fails in bitbucket pipeline

I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Nov 13, 2023

I have a test to make sure the application provides a proper error if it can not access a file. To do so, the test changes the file permission, that it runs the application and checks the error.

Something like:

public void permissions() {
  String file = prepareFiles(); // let's say this creates a file /tmp/myfiles/filetocheck

  Path path = Paths.get(file).getParent();
  Files.setPosixFilePermissions(path, PosixFilePermissions.fromString("---------"));


  thenLogContains("no access to " + file + ": java.nio.file.AccessDeniedException")

It works locally, but when it runs in the BitBucket pipeline, it fails because permissions have not been changed. Has anybody ran into the same problem? Any solution?

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 14, 2023

Hello @stefanofornari and welcome to the Community!

Have you tried testing it locally inside a docker container ? I ask this because bitbucket pipelines run inside a docker container, so testing it locally with docker closely reproduces the pipeline environment and it can help identify if the issue is with the pipelines itself or with the code/image you are using.

If you haven't already, I would suggest following the instructions in the article below to debug it locally using the same image you are using in pipelines: 

Let us know in case you have any questions.

Thank you, @stefanofornari !

Patrik S

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events