Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-73878

ftpPublisher not creating directories on FTP Server.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ftppublisher-plugin
    • Jenkins: 2.468
      OS: Linux - 5.10.0-31-amd64
      Java: 17.0.11 - Debian (OpenJDK 64-Bit Server VM)
      ---
      ...
      publish-over:0.22
      publish-over-ftp:1.17
      publish-over-ssh:1.25
      ...

      Hello,

      I am encountering an issue with the ftpPublisher plugin, where it fails to create directories on the FTP server. According to the inline help and the plugin's documentation, the following behaviour is expected:

      Remote directory

      If specified, the files will be transfered below this directory (which is relative to the Remote Directory specified in the Host Configuration for this server).
      If the directory does not exist it will be created.

      I have configured the FTP Server in the Publish over FTP section under Manage => System and named it Dev-Symbols. The connectivity test using the Test Configuration option was successful.

      I verified with WinSCP that I can manually create a directory on the FTP server using the same user account Jenkins is configured to use.

      Could someone please advise on what I might be doing wrong? How can I configure Jenkins to create directories on the FTP server automatically? Any assistance would be greatly appreciated.

      For context, my FTP server is running on IIS 8.5.

      Below is the test pipeline I'm using:

      def myPublishSymbols() {
          ftpPublisher(
              alwaysPublishFromMaster: true,
              continueOnError: false,
              failOnError: false,
              masterNodeName: '',
              paramPublish: null,
              publishers: [[
                  configName: 'Dev-Symbols',
                  transfers: [[
                      asciiMode: false,
                      cleanRemote: false,
                      excludes: '',
                      flatten: false,
                      makeEmptyDirs: false,
                      noDefaultExcludes: false,
                      patternSeparator: '[, ]+',
                      remoteDirectory: "'${env.P4_CHANGELIST}'",
                      remoteDirectorySDF: true,
                      removePrefix: "",
                      sourceFiles: '*.pdb'
                  ]],
                  usePromotionTimestamp: false,
                  useWorkspaceInPromotion: false, 
                  verbose: true
              ]]
          )
      }

      pipeline {
          agent {
              node {
                  label 'windows-agent'
      {{        }}}
      {{    }}}
          environment {
              ROOT = "${WORKSPACE}
      workspace"

              P4_CHANGELIST = "clTEST"
      {{    }}}
          stages {
              stage('Create content') {
                  steps {
                      bat "if not exist \"${ROOT}\\myProject\\Binaries\\Win64\" mkdir \"${ROOT}\\myProject\\Binaries\\Win64\""
                      writeFile file: "${ROOT}\\myProject\\Binaries\\Win64
      file.pdb", text: 'This is a test file from Jenkins.'

      {{            }}}
      {{        }}}
              stage('Upload to SymbolsServer') {
                  steps {
                      dir("${ROOT}/myProject/Binaries/Win64/") {
                          echo "Uploading files."
                          myPublishSymbols()
      {{                }}}
      {{            }}}
      {{        }}}
      {{    }}}
      {{    // post { cleanup

      { cleanWs() }

      }}}
      }

      Here's the relevant section of the build log:

      [Pipeline] {
      [Pipeline] echo
      Uploading files.
      [Pipeline] ftpPublisher
      FTP: Connecting from host [ci]
      FTP: Connecting with configuration [Dev-Symbols] ...
      220 Microsoft FTP Service
      FTP: Logging in, command printing disabled
      FTP: Logged in, command printing enabled
      CWD /DebugSymbols/myProject
      250 CWD command successful.
      TYPE I
      200 Type set to I.
      CWD /DebugSymbols/myProject
      250 CWD command successful.
      CWD clTEST
      FTP: Disconnecting configuration [Dev-Symbols] ...
      ERROR: Exception when publishing, exception message [Exception when changing to FTP directory [clTEST]]
      {{[Pipeline] }}}

      Regards

      Remik.

            benjaminjaton benjaminjaton
            remik P4
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: