jenkins python copyfile parameter in file pathThere is a time and/or date difference between the client and...

How to explain that I do not want to visit a country due to personal safety concern?

Why must traveling waves have the same amplitude to form a standing wave?

Have researchers managed to "reverse time"? If so, what does that mean for physics?

Why are there 40 737 Max planes in flight when they have been grounded as not airworthy?

How could a scammer know the apps on my phone / iTunes account?

Ban on all campaign finance?

Making a sword in the stone, in a medieval world without magic

Russian cases: A few examples, I'm really confused

SQL Server Primary Login Restrictions

Bastion server: use TCP forwarding VS placing private key on server

Instead of Universal Basic Income, why not Universal Basic NEEDS?

How could a female member of a species produce eggs unto death?

Can anyone tell me why this program fails?

My story is written in English, but is set in my home country. What language should I use for the dialogue?

How do anti-virus programs start at Windows boot?

Good allowance savings plan?

Can hydraulic brake levers get hot when brakes overheat?

Why do Australian milk farmers need to protest supermarkets' milk price?

What is a good source for large tables on the properties of water?

Do I need life insurance if I can cover my own funeral costs?

What are the possible solutions of the given equation?

Co-worker team leader wants to inject his friend's awful software into our development. What should I say to our common boss?

Font with correct density?

Is having access to past exams cheating and, if yes, could it be proven just by a good grade?



jenkins python copyfile parameter in file path


There is a time and/or date difference between the client and serverHow can I get Jenkins to execute a script that it pulled from Git?Maven interfering with Jenkins post build scriptone login for jenkins and auto login to SVN url in jenkinsWhy is Jenkins making temp files that are binaries?Jenkins execute shell scpJenkins : Python script with argumentsWhy is PATH different when launching Jenkins slave via launchctl?Jenkins windows Gui gives an errorJenkins execute shell return value commands vs file













0















I have a file on my server, and I want to copy it into the Jenkins artifacts. I have paramaterized the folder name in the Windows file path, because it changes from release to release.



When I run the script with no parameters, it completes correctly.



When I try to replace part of the Windows path with a Jenkins parameter, the job fails, saying it can't find the specified file.



Here is the part of the Python script that works:



shutil.copyfile("C:\Doc191CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
shutil.copyfile("C:\Doc191CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


When I change it to this, it stops working:



shutil.copyfile("C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
shutil.copyfile("C:\Doc${BranchIDshort}CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


I even tried using the Windows variable for the parameter, but that also failed:



shutil.copyfile("C:\Doc%BranchIDshort%CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
shutil.copyfile("C:\Doc%BranchIDshort%CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


Now I know that the parameter works. Earlier in the same Python script, I have the following command, and it works fine, so it's not the parameter that is the problem, AFAIK:



list_master_projects = ["C:\Doc${BranchIDshort}CS\TPP Project\Output\Administrator"]


Here is the error I find in the console output after the job fails when I run it with a parameter:



Traceback (most recent call last):
File "C:UsersADMINI~1AppDataLocalTempjenkins4558065654793360270.py", line 40, in <module>
shutil.copyfile("C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
File "C:Python27libshutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: 'C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py'
Build step 'Execute Python script' marked build as failure


And yes, the files DO exist in the source location. You know this is true because when I run the job WITHOUT the parameter, the job completes correctly.



So my question is this: How can I use Jenkins parameters in a Python script to copy files from the hard drive of the build system to the artifacts? What am I doing wrong?









share







New contributor




Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I have a file on my server, and I want to copy it into the Jenkins artifacts. I have paramaterized the folder name in the Windows file path, because it changes from release to release.



    When I run the script with no parameters, it completes correctly.



    When I try to replace part of the Windows path with a Jenkins parameter, the job fails, saying it can't find the specified file.



    Here is the part of the Python script that works:



    shutil.copyfile("C:\Doc191CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
    shutil.copyfile("C:\Doc191CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


    When I change it to this, it stops working:



    shutil.copyfile("C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
    shutil.copyfile("C:\Doc${BranchIDshort}CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


    I even tried using the Windows variable for the parameter, but that also failed:



    shutil.copyfile("C:\Doc%BranchIDshort%CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
    shutil.copyfile("C:\Doc%BranchIDshort%CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


    Now I know that the parameter works. Earlier in the same Python script, I have the following command, and it works fine, so it's not the parameter that is the problem, AFAIK:



    list_master_projects = ["C:\Doc${BranchIDshort}CS\TPP Project\Output\Administrator"]


    Here is the error I find in the console output after the job fails when I run it with a parameter:



    Traceback (most recent call last):
    File "C:UsersADMINI~1AppDataLocalTempjenkins4558065654793360270.py", line 40, in <module>
    shutil.copyfile("C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
    File "C:Python27libshutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
    IOError: [Errno 2] No such file or directory: 'C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py'
    Build step 'Execute Python script' marked build as failure


    And yes, the files DO exist in the source location. You know this is true because when I run the job WITHOUT the parameter, the job completes correctly.



    So my question is this: How can I use Jenkins parameters in a Python script to copy files from the hard drive of the build system to the artifacts? What am I doing wrong?









    share







    New contributor




    Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0


      1






      I have a file on my server, and I want to copy it into the Jenkins artifacts. I have paramaterized the folder name in the Windows file path, because it changes from release to release.



      When I run the script with no parameters, it completes correctly.



      When I try to replace part of the Windows path with a Jenkins parameter, the job fails, saying it can't find the specified file.



      Here is the part of the Python script that works:



      shutil.copyfile("C:\Doc191CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
      shutil.copyfile("C:\Doc191CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


      When I change it to this, it stops working:



      shutil.copyfile("C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
      shutil.copyfile("C:\Doc${BranchIDshort}CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


      I even tried using the Windows variable for the parameter, but that also failed:



      shutil.copyfile("C:\Doc%BranchIDshort%CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
      shutil.copyfile("C:\Doc%BranchIDshort%CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


      Now I know that the parameter works. Earlier in the same Python script, I have the following command, and it works fine, so it's not the parameter that is the problem, AFAIK:



      list_master_projects = ["C:\Doc${BranchIDshort}CS\TPP Project\Output\Administrator"]


      Here is the error I find in the console output after the job fails when I run it with a parameter:



      Traceback (most recent call last):
      File "C:UsersADMINI~1AppDataLocalTempjenkins4558065654793360270.py", line 40, in <module>
      shutil.copyfile("C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
      File "C:Python27libshutil.py", line 82, in copyfile
      with open(src, 'rb') as fsrc:
      IOError: [Errno 2] No such file or directory: 'C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py'
      Build step 'Execute Python script' marked build as failure


      And yes, the files DO exist in the source location. You know this is true because when I run the job WITHOUT the parameter, the job completes correctly.



      So my question is this: How can I use Jenkins parameters in a Python script to copy files from the hard drive of the build system to the artifacts? What am I doing wrong?









      share







      New contributor




      Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have a file on my server, and I want to copy it into the Jenkins artifacts. I have paramaterized the folder name in the Windows file path, because it changes from release to release.



      When I run the script with no parameters, it completes correctly.



      When I try to replace part of the Windows path with a Jenkins parameter, the job fails, saying it can't find the specified file.



      Here is the part of the Python script that works:



      shutil.copyfile("C:\Doc191CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
      shutil.copyfile("C:\Doc191CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


      When I change it to this, it stops working:



      shutil.copyfile("C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
      shutil.copyfile("C:\Doc${BranchIDshort}CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


      I even tried using the Windows variable for the parameter, but that also failed:



      shutil.copyfile("C:\Doc%BranchIDshort%CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
      shutil.copyfile("C:\Doc%BranchIDshort%CS\CS-Site-Files\contentindex.php", "artifacts\contentindex.php")


      Now I know that the parameter works. Earlier in the same Python script, I have the following command, and it works fine, so it's not the parameter that is the problem, AFAIK:



      list_master_projects = ["C:\Doc${BranchIDshort}CS\TPP Project\Output\Administrator"]


      Here is the error I find in the console output after the job fails when I run it with a parameter:



      Traceback (most recent call last):
      File "C:UsersADMINI~1AppDataLocalTempjenkins4558065654793360270.py", line 40, in <module>
      shutil.copyfile("C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py", "artifacts\PopulateCSSite.py")
      File "C:Python27libshutil.py", line 82, in copyfile
      with open(src, 'rb') as fsrc:
      IOError: [Errno 2] No such file or directory: 'C:\Doc${BranchIDshort}CS\BuildScripts\PopulateCSSite.py'
      Build step 'Execute Python script' marked build as failure


      And yes, the files DO exist in the source location. You know this is true because when I run the job WITHOUT the parameter, the job completes correctly.



      So my question is this: How can I use Jenkins parameters in a Python script to copy files from the hard drive of the build system to the artifacts? What am I doing wrong?







      python jenkins





      share







      New contributor




      Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 mins ago









      Paul PehrsonPaul Pehrson

      1011




      1011




      New contributor




      Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Paul Pehrson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Paul Pehrson is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f958353%2fjenkins-python-copyfile-parameter-in-file-path%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Paul Pehrson is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Paul Pehrson is a new contributor. Be nice, and check out our Code of Conduct.













          Paul Pehrson is a new contributor. Be nice, and check out our Code of Conduct.












          Paul Pehrson is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f958353%2fjenkins-python-copyfile-parameter-in-file-path%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          117736 Шеррод Примітки | Див. також | Посилання | Навігаційне...

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          Маріан Котлеба Зміст Життєпис | Політичні погляди |...