0

I have a Jenkins job which runs on a slave node on another machine, both master and slave run on windows. The slave node is being run as a windows service. The main repository has git submodule included. After checking-out the code for both the main and sub module repositories, I need to create a folder inside of the submodule folder and write a file into it with some basic deployment details like tag, version, etc. Structure is something like this:

main -> submodule -> {newfolder} -> {newfile}

I am using the mkdir() to create the folder, but it is not being created. I have also tried the dir() method. But nothing seems to be working. Can anyone help on this:

  1. Do I need to provide elevated permissions set for the windows service used to trigger the slave node?
  2. Do I need to provide permissions at folder level?

Any other check that I am missing, please help.

1 Answer 1

0

Issue got resolved with the use of File Operations Plugin methods like folderCreateOperation & fileCreateOperation. Example code snippet below:

def path = "${workspace}\submodule\newFolder"
fileOperations([folderCreateOperation(folderPath: path)])
dir(path) {
    fileOperations([fileCreateOperation(fileName: 'newFile.properties', fileContent: 'Git_Tag=${env.Git_Tag}')])
}
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Apr 29, 2022 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.