在 Azure Pipelines 中,我们将部署组和环境作为单独的选项,但它们是否都不想将属于环境的服务器列表添加为一个组。对此的澄清将不胜感激。
我在从 Azure DevOps 中的另一个管道触发管道时遇到问题。我有一个 CI 管道,我想在 CI 通过主分支时触发一个部署管道。这在技术上似乎是可行的,但文档不清楚。
我看到以下内容:
# this is being defined in app-ci pipeline
resources:
pipelines:
- pipeline: securitylib
source: security-lib-ci
trigger:
branches:
- releases/*
- master
Run Code Online (Sandbox Code Playgroud)
但不清楚 a) 这是否进入触发管道(在我的情况下为 CI 管道)或触发管道(在我的情况下为部署管道)。
也不清楚 thepipeline和source指的是什么,以及我如何找出这些变量?它们都是管道的名称吗?我尝试了各种不同的排列,但似乎没有任何效果。
我正在编写一个 Azure YAML 管道,它必须执行“git Push”来存储库,因此,我已在 CmdLine@2 任务中编写了 git 命令。像这样的东西:
git checkout -b foo-branch-$(Build.BuildId)
git add myGeneratedFile
git commit -m "My commit message"
git config user.email "$(GitUserName)@foo.com"
git config user.name "$(GitUserName)"
git push --set-upstream origin feature/foo-branch-$(Build.BuildId)
Run Code Online (Sandbox Code Playgroud)
显然,这段代码不起作用,因为 git 凭据没有在任何地方设置。如何指定该命令?
我的想法是从像 $(GitUserName) 这样的参数或从 git 秘密中读取它们。
是否有任何参数可以隐藏以避免在日志中以及用户键入该值时显示该值?
到目前为止的故事:
这就是需要帮助的地方。
我花了好几天的时间寻找一种自动创建 PipeLine Build TAG 的方法,但只找到了我已经拥有的答案。如果它是 YAML 中的步骤/任务或构建管道中的设置,我可能不会。如果有人能指出我正确的方向,我将不胜感激。
最终目标是如果构建成功,则将原始源 GIT TAG 推送到 Build TAG 中。
注意:我只在 YAML 中工作,无论什么设置都是 Azure Devops 版本 Dev18.M170.1 自带的,即没有插件。
我有一个创建缓存的任务
- task: Cache@2
inputs:
key: 'sonarCache'
path: $(SONAR_CACHE)
cacheHitVar: CACHE_RESTORED
displayName: Cache Sonar packages
Run Code Online (Sandbox Code Playgroud)
但是,缓存已损坏。那么我如何运行这个管道,同时告诉它忽略任何现有的缓存?
由于某种原因,我无法更改缓存键sonarCache
pipeline azure azure-devops azure-pipelines azure-pipelines-yaml
我正在尝试运行一个部署存储容器的 terraform 部署。初始部署有效(由于尚未到位 IP 过滤),但随后失败。运行 terraform plan 时,我得到以下信息:
Error: retrieving Container "xxxx" (Account "xxxx" / Resource Group "xxx"): containers.Client#GetProperties: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="AuthorizationFailure" Message="This request is not authorized to perform this operation.\nRequestId:62a85c92-901e-0021-12de-816608000000\nTime:2022-06-17T00:11:56.2063816Z"
Run Code Online (Sandbox Code Playgroud)
根据一些研究和调试,当存储容器没有将托管管道代理的 IP 列入白名单时,就会发生这种情况。
我修改了管道,以便检索代理的 IP 并将其添加为防火墙规则。然后,我添加了不同时间的睡眠(最多 5 分钟),尝试为规则生效留出时间,但它从未起作用。
这是我的管道的片段:
- task: AzureCLI@2
inputs:
azureSubscription: '$(azureSubscription)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
agentIP=$(curl -s https://api.ipify.org/)
az storage account network-rule add -g xxx --account-name xxx --ip-address $agentIP
sleep 300 …Run Code Online (Sandbox Code Playgroud) azure terraform azure-blob-storage azure-devops azure-pipelines
我想从powershell脚本更新Build.BuildNumber变量作为构建步骤.
我试过了:
Write-Host "##vso[task.setvariable variable=BUILD_BUILDNUMBER]1.2.3.4"
Run Code Online (Sandbox Code Playgroud)
和
Write-Host "##vso[task.setvariable variable=Build.BuildNumber]1.2.3.4"
Run Code Online (Sandbox Code Playgroud)
这没效果.
我正在使用Karma-coverage生成代码覆盖.我可以在http-server上托管我的输出覆盖文件夹并在本地查看它.
如何在VSTS代码覆盖率选项卡上显示此报告?
我是否需要在VSTS兼容中重新格式化我的覆盖率结果?
我已经阅读了关于vsts-tasks的内容,但我不知道如何实现相同的目标.
任何帮助表示赞赏.
code-coverage azure-devops azure-pipelines angular azure-devops-rest-api
我有一个带有预定义变量$(ProjectBuildNumber)的Microsoft Visual Studio Team Foundation Server(版本15.117.26714.0).
有没有办法在构建过程中增加带有次要内部编号+1的变量的值?
$(ProjectBuildNumber) = 663
Run Code Online (Sandbox Code Playgroud)
那么,在下一次构建时,它将是:
$(ProjectBuildNumber) = 664
Run Code Online (Sandbox Code Playgroud)
我正在Azure管道(https://github.com/scikit-image/scikit-image/blob/azure-pipelines/azure-pipelines.yml)中为Python包开发CI 。在某个时候,我需要跳出源代码目录以允许pytest发现此软件包的安装,并运行相应的测试。
我现在面临的问题是关系到一个事实,即cd,cd C:等命令似乎并没有造成什么影响,从而使当前的工作目录保持不变(在这种特殊情况下,D:\a\1\s)。
有没有办法克服上述限制?
azure-pipelines ×10
azure-devops ×9
azure ×5
tfs ×2
angular ×1
azure-devops-deploymentgroups ×1
git ×1
pipeline ×1
powershell ×1
terraform ×1
tfs-2015 ×1