Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use tar and ssh to publish package metadata files. (#1049)
* Use sftp via shell to publish package metadata files. The publish-over-ssh plugin adds an extra configuration step that's hard to manage securely as it does not use the Jenkins ssh-agent and credential system, nor does it support openssh formatted or ed22519 keys, unlike the Jenkins private key credential. Although it requires a bit more finagling ourselves, I think this is an equally valid way to publish this content which only requires one copy of the ssh private key in the ssh-agent and not an out-of-band system. I chose sftp over rsync in order to batch the transfers of these smaller files without doing wildly long rsync commands. * Avoid use of pushd/popd which aren't available on agents. * Use find instead of globs to aggregate metadata files. Using the sftp batch as written had two regressions in behavior: 1. globs that did not have matches resulted in errors 2. file paths were not preserved by sftp so every matching file was put directly into the `noetic` directory rather than preserving its path relative to noetic. 1 is trivial to fix by prefixing the sftp command with `-` but 2 is substantially more challenging, after attempting a few sftp and rsync changes, the problem came down to the fact that not every glob will always have matching files and when the glob fails to expand, the glob is passed to the command literally. Which meant that an rsync or scp command would get a glob (that is known not to have any valid expansion) and fail because the file with the glob characters in it does not exist. So instead we change modes entirely and use `find` to match regular expressions that are equivalent to the glob expressions. It seemed to me that the most convenient way to transmit the found files, preserving relative paths, was with tar. Which is why the files are tar'd and piped to ssh to be untar'd at the correct path.
- Loading branch information