Hello everyone,
I'm running a pipeline on a Self hosted Windows runner in Bitbucket Pipelines and need to clean the temporary files located in atlassian_runners\atlassian-bitbucket-pipelines-runner\temp\* as not doing that while running docker containers in windows using the runner will move the runner into unhealthy state. (I have built my own wrapper around the self hosted windows runner as Windows Docker Runners aren't supported in Bitbucket Pipelines yet). See my other question for more hints on how I am doing it. https://community.atlassian.com/t5/Bitbucket-questions/Issues-running-Windows-Docker-Container-on-Pipelines-Self-hosted/qaq-p/2735498 However, I'm struggling to dynamically obtain the user profile path. My goal is to avoid hardcoding the user profile path and handle it dynamically within the script.
Here's what I've tried so far:
Using [System.Environment]::GetFolderPath('UserProfile')
:
This returns the system profile path (C:\Windows\system32\config\systemprofile
) instead of the intended user profile path. It seems that the script runs under a different context (Possibly in a Sandboxed JVM environment) in the Bitbucket pipeline.
Questions:
Any help or guidance would be greatly appreciated!
Regards,
Gajesh