Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 在VST的git存储库中获取最后更新/提交的文件_Azure_Azure Devops_Azure Pipelines_Azure Data Factory_Azure Pipelines Release Pipeline - Fatal编程技术网

Azure 在VST的git存储库中获取最后更新/提交的文件

Azure 在VST的git存储库中获取最后更新/提交的文件,azure,azure-devops,azure-pipelines,azure-data-factory,azure-pipelines-release-pipeline,Azure,Azure Devops,Azure Pipelines,Azure Data Factory,Azure Pipelines Release Pipeline,我正在尝试对Azure Data Factory的管道部署进行deltafy。换句话说,我计划只将最近修改的管道或最近添加的管道部署到Azure portal中的ADF。目前,我在CD管道中使用powershell任务来部署所有管道。如何使用时间戳获取最近修改的管道?任何建议都会有帮助。:) 如果您想构建所有文件,但只推/发布要部署的修改文件,这是可能的 您可以使用PowerShell任务获取$(Build.SourcesDirectory)中的最后一个提交id(sha-1值),然后使用git

我正在尝试对Azure Data Factory的管道部署进行deltafy。换句话说,我计划只将最近修改的管道或最近添加的管道部署到Azure portal中的ADF。目前,我在CD管道中使用powershell任务来部署所有管道。如何使用时间戳获取最近修改的管道?任何建议都会有帮助。:)

如果您想构建所有文件,但只推/发布要部署的修改文件,这是可能的


您可以使用PowerShell任务获取
$(Build.SourcesDirectory)
中的最后一个提交id(sha-1值),然后使用
git show
查找提交中更改的文件,然后将这些文件复制到
$(Build.artifactstagingdirectory)
。最后将这些文件发布到服务器。

您可以使用RESTAPI获得更改后的文件

简单powershell脚本:

Param(
 [string]$collection,
 [string]$project,
 [string]$repository,
 [string]$commit,
  [string]$token
)
$u="$($collection)$($project)/_apis/git/repositories/$repository/commits/$commit/changes"
Write-Output $u
$changedFiles=New-Object System.Collections.ArrayList
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "",$token)))
$result=Invoke-RestMethod -Method Get -Uri $u -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -ContentType "application/json"

Foreach($c in $result.changes)
{
    If($c.item.isFolder -ne 'true')
    {
        Write-Output $c.item.path
        $changedFiles.Add(($c.item.path))
    }
}
参数(选中允许脚本访问生成/发布定义中的OAuth令牌选项):


您的意思是,您希望在最新提交git repo时对更改的文件执行CI和CD操作吗?但构建和部署将用于您最近提交的所有文件。@Marina MSFT HI Marina。生成所有文件,但仅根据时间戳推送/发布修改的文件…是否可能?是的,可以为所有文件生成并为更改的文件部署。我在回答中给你让路。
-collection $(System.TeamFoundationCollectionUri) -project $(System.TeamProject) -repository $(Build.Repository.Name) -commit $(Build.SourceVersion) -token $(System.AccessToken)