【发布时间】:2021-08-26 13:02:53
【问题描述】:
我实际上是在尝试使用 Azure DevOps 管道通过 ssh 将文件发送到外部服务器。
首先,我上传了我用来连接服务器的私钥:Secure file。
然后,我按照那个文档Install SSH keys 的连接进行操作。
然后,我运行一个 node.js 项目来提取 dist 文件。
最后,我想使用 SSH 将我的 dist 文件复制到服务器,就像这个文档解释它Copy Files Over SSH task。
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
cd front-react
npm install
npm run build
displayName: 'npm install and build'
# Install SSH key
# Install an SSH key prior to a build or deployment
- task: InstallSSHKey@0
name: localssh
inputs:
knownHostsEntry: 'xxx@1.1.1.1'
sshPublicKey: $(id_rsa)
sshKeySecureFile: privkey_file
- task: CopyFilesOverSSH@0
inputs:
sshEndpoint: localssh
contents: 'front-react/build/'
targetFolder: '/testssh'
readyTimeout: '20000'
问题是我不知道如何使用我的 SSH 连接进入 sshEndpoint 属性。
这与这篇文章 How to use public key in azure devops pipline copy files over SSH 有关,但没有明确说明如何使用该连接链接已安装的 ssh 和复制 ssh。
【问题讨论】:
标签: ssh azure-devops yaml azure-pipelines