jenkins - Jenkins Job 将文件从 GIT 复制到 Windows 主机
问题描述
我必须实现一个 Jenkins 作业,我从 git 存储库访问文件并将它们复制到 Windows 服务器。我不能通过插件来做到这一点,需要使用 powershell 脚本。
我已经创建了下面的脚本,但它无法从 Jenkins 工作区中找到文件。我该如何执行此任务。
Jenkins Job Details:
Freestyle project
SCM - via git repository
Build Triggers: None
Build environement: Use secret text
Bindings: Specified usrname/password variable
Build : Windows power shell
Powershell script:
$loginPassword2 = ConvertTo-SecureString "$($ENV:loginPassword)" -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ("$ENV:loginUsername", $loginPassword2)
Invoke-Command -ComputerName windows_Host_server -Credential $Credential -ScriptBlock {
Copy-Item .\Solr_config -Destination "E:\install" -recurse -For
}
错误:
Cannot find path 'C:\Users\****\Documents\Solr_config' because it
does not exist.
+ CategoryInfo : ObjectNotFound: (C:\Users\svc_**...nts\Solr_conf
ig:String) [Copy-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyI
temCommand
解决方案
推荐阅读
- typescript - 无法使用 TypeORM + pgAdmin4 连接到在 docker 上运行的本地 PostgreSQL 数据库
- python - 如何在特定的 Unix 时间戳上激活事件。在discord.py中?
- python - 网页抓取表过滤结果
- tensorflow - tensorflow:在 Windows 7 上使用 g++ 6.3.0(通过 MinGW)构建操作时出错
- java - GSON - 序列化/反序列化扩展日期的子类?
- sql - 使用 to_number 聚合 varchar 时获取无效数字
- python - Django admin 中的自定义 M2M 验证未向用户显示
- angular - 如何在发送订阅之前使 Observable 在流中收集值 x 秒
- amazon-web-services - 无法从使用 startExecution 设置的 Step Function 输入中传递 Glue 作业参数
- linux - 如何在 Linux 中删除具有 n 列的相等行