[英]How to Automatically upload a file to Azure DevOps repository through a release pipeline CMD task
I have created a release pipeline in Azure devops to generate the.dacpac file using CMD task in release pipeline.我在 Azure devops 中创建了一个发布管道,以使用发布管道中的 CMD 任务生成 .dacpac 文件。 The.dacpac file is getting generated successfully when I am giving \tf: path as $(Agent.HomeDirectory).
当我将 \tf: 路径作为 $(Agent.HomeDirectory) 时,.dacpac 文件正在成功生成。 I want to give path of the folder in my repository where I would like to save the.dacpac file.
我想在我的存储库中提供要保存 .dacpac 文件的文件夹的路径。
Below is the command which I tried to store the file on (Agent.HomeDirectory) and it runs fine.下面是我尝试将文件存储在(Agent.HomeDirectory)上的命令,它运行良好。
C:\Program Files (x86)\Microsoft SQL Server\150\DAC\bin>sqlpackages.exe /Action:Extract /ssn:tcp:,1433 /sdn: /su: /sp: /tf:$(Agnet.HomeDirectory)/test.dacpac /p:Storage=File C:\Program Files (x86)\Microsoft SQL Server\150\DAC\bin>sqlpackages.exe /Action:Extract /ssn:tcp:,1433 /sdn: /su: /sp: /tf:$(Agnet.HomeDirectory )/test.dacpac /p:Storage=File
Please guide me how we can store the file to repository folder from command line.请指导我如何从命令行将文件存储到存储库文件夹。
Thanks, Sachin谢谢,萨钦
Please refer to the following steps:请参考以下步骤:
I created a release pipeline and added this repo: testproject, branch: test我创建了一个发布管道并添加了这个 repo:testproject,branch:test
Add CMD task, the script is as follows:添加CMD任务,脚本如下:
cd D:\a\r1\a_testproject cd D:\a\r1\a_testproject
cd.光盘。 > 001.txt // I create a test txt here.
> 001.txt // 我在这里创建一个测试 txt。 Please copy the file you need to the path.
请将您需要的文件复制到该路径。 Or you can to use git to clone a repo in the path you want.
或者您可以使用 git 在您想要的路径中克隆一个 repo。
git config --global user.email "xxxx@mail.com" git 配置 --global user.email "xxxx@mail.com"
git config --global user.name "xxxx" git 配置 --global user.name "xxxx"
git status git 状态
git add -A git 添加-A
git status git 状态
git commit -m "Latest updated" git show-ref git commit -m "最新更新" git show-ref
git push -u origin HEAD:test //if the push step show the error: src refspec xxxx does not match any. git push -u origin HEAD:test //如果推送步骤显示错误:src refspec xxxx 不匹配。 please check the log and choose a rignt head
请检查日志并选择正确的头
set permission of the account {projectname} Build Service (orgname)
设置帐户
{projectname} Build Service (orgname)
的权限
For more info,please refer Copy file from CI Pipeline to Azure Devops Repository and How to add/update files in git repository from Azure DevOps Pipeline Dynamics 365 CE .有关更多信息,请参阅将文件从 CI 管道复制到 Azure Devops 存储库以及如何在 git 存储库中添加/更新文件从 Z3A580F142203677F1F0BC30898F63F53 动态开发管道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.