When using Docker Runner, Bamboo ignores the container directory for the Docker script

XMLWordPrintable

    • Type: Bug
    • Resolution: Low Engagement
    • Priority: Low
    • None
    • Affects Version/s: 6.10.4
    • Component/s: Docker Runner
    • 1
    • Severity 3 - Minor

      Issue Summary

      When using Docker Runner, Bamboo ignores the container directory for the Docker script

      Steps to Reproduce

      1. Create a plan with one job.
      2. (Optional) Create a script task to print information. For example:
        echo PRINT WORKING DIR
        echo ${bamboo.working.directory}
        echo END
        
      3. Under "Docker", choose "Docker container". For the image, choose one. For example: "ubuntu:latest".
      4. Under volumes, change the default working directory mapping. For example, "Container directory" will now be set "/tmp".
      5. Run the build.

      Expected Results

      Bamboo will use "/tmp" as the default working directory inside the container. This will also be reflected on the script <temp-path>/runInDockerXXXXXXXXXXXXXXX.sh

      Actual Results

      When runInDockerXXXXXXXXXXXXXXX.sh is created, it uses the working directory defined in the cfg.xml file (the file name varies depending on which type of agent is being used), ignoring the mapping set before.

      This will show in the build log in the following way:

      command	20-Feb-2020 10:35:16	Beginning to execute external process for build 'pr - pl - Default Job #14 (PR-PL-JOB1-14)'\n ... running command line: \n/home/user/Downloads/temp/atlassian-bamboo-6.10.4/temp/runInDocker2459302165546153494.sh /home/user/Downloads/temp/home6104/temp/PR-PL-JOB1-14-ScriptBuildTask-4935773693336676544.sh\n ... in: /home/user/Downloads/temp/atlassian-bamboo-6.10.4/temp\n
      error	20-Feb-2020 10:35:17	/tmp/runInDocker1413274602186967516.sh: 2: cd: can't cd to /home/user/Downloads/temp/home6104/xml-data/build-dir/PR-PL-JOB1
      build	20-Feb-2020 10:35:17	PRINT WORKING DIR
      build	20-Feb-2020 10:35:27	/home/user/Downloads/temp/home6104/xml-data/build-dir/PR-PL-JOB1
      build	20-Feb-2020 10:35:27	END
      

      Workaround

      Use the default value in the "Container directory" field, which is ${bamboo.working.directory}

            Assignee:
            Unassigned
            Reporter:
            Patricio (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: