标签: azure-devops

Azure DevOps 部署到多个订阅

\xe2\x80\x8b专家您好,\n我一直在尝试寻找这个问题的答案,Azure DevOps 是否可以支持部署到具有不同 Azure AD 租户的多个 Azure 订阅?

\n

azure-devops

1
推荐指数
1
解决办法
8258
查看次数

当failOnStderr: true时,Azure脚本任务会出现bash错误,这并不是没有这个标志

我有有线行为\n当任务中未设置failOnStderr: true 时一切正常,但是
\n当我使用failOnStderr: true 调用这样的脚本任务时:

\n
- script:  |\n     echo \'Start invoking Fastfile\'\n     fastlane release --verbose projectName:${{parameters.projectName}} appIdentifier:${{parameters.appIdentifier}} versionNumber:${{parameters.versionNumber}} buildNumber:${{parameters.buildNumber}} plistFileFtpBasePath:${{parameters.plistFileFtpBasePath}} ArtifactsDirectory:$(System.ArtifactsDirectory)\n     echo \'Done invoking Fastfile\'\n    failOnStderr: true \n    workingDirectory: \'$(System.ArtifactsDirectory)/ios_artifacts\'\n    displayName: \'create keychain invoke fastlane\'\n
Run Code Online (Sandbox Code Playgroud)\n

我收到此错误:

\n
2020-09-30T07:54:45.8179430Z INFO [2020-09-30 07:54:45.81]: [32mfastlane.tools finished successfully \xc3\xb0\xc5\xb8\xc5\xbd\xe2\x80\xb0[0m\n2020-09-30T07:54:45.8917310Z Done invoking Fastfile\n2020-09-30T07:54:45.8948720Z \n2020-09-30T07:54:45.9020160Z ##[error]Bash wrote one or more lines to the standard error stream.\n2020-09-30T07:54:45.9033610Z ##[error]/Users/runner/hostedtoolcache/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/fastlane-2.161.0/fastlane_core/lib/fastlane_core/ui/interface.rb:141: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to …
Run Code Online (Sandbox Code Playgroud)

azure azure-devops azure-pipelines azure-devops-pipelines

1
推荐指数
1
解决办法
1万
查看次数

在 Azure DevOps-Pipeline 中找不到上一步中的文件

在管道中我有两个不同的步骤。第一个生成一些文件,第二个应该将这些文件作为输入。

该管道的 Yaml 如下:

name: myscript
stages:
- stage: Tes/t
displayName: owasp-test
jobs:

- job: owasp_test
  displayName: run beasic checks for site
  pool:
    name: default
    demands: Agent.OS -equals Windows_NT

  steps:

  - task: DotNetCoreCLI@2
    inputs:
      command: 'build'
      projects: '**/*.sln'
  - task: dependency-check-build-task@5
    inputs:
      projectName: 'DependencyCheck'
      scanPath: '**/*.dll'
      format: 'JUNIT'
  - task: PublishTestResults@2
    inputs:
      testResultsFormat: 'JUnit'
      testResultsFiles: '**/*-junit.xml'
Run Code Online (Sandbox Code Playgroud)

返回dependency-check-build-task一个 XML 文件:

File upload succeed.
Upload 'P:\Azure-Pipelines-Agent\_work\2\TestResults\dependency-check\dependency-check-junit.xml' to file container: '#/11589616/dependency-check'
Associated artifact 53031 with build 21497
Run Code Online (Sandbox Code Playgroud)

以下步骤 ( PublishTestResults) …

azure-devops azure-pipelines

1
推荐指数
1
解决办法
1026
查看次数

DevOps 管道 Replace() 函数未按预期工作

我正在尝试在 DevOps 管道中使用替换函数,如https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#replace中所述

对于以下 yml,我期望输出为This Should be Steak but it is Steak,但实际输出为This Should be Steak but it is Beef

variables:
  foo: 'beef'
  bar: $[replace('$(foo)', 'beef', 'steak')]

pool:
  vmImage: 'ubuntu-latest'
steps:
- script: echo This should be steak but it is $(bar)
Run Code Online (Sandbox Code Playgroud)

我也尝试过这会产生相同的输出

variables:
  foo: 'beef'

pool:
  vmImage: 'ubuntu-latest'
steps:
- script: echo This should be steak but it is ${{ replace('$(foo)', 'beef', 'steak') }}
Run Code Online (Sandbox Code Playgroud)

yaml azure-devops azure-pipelines

1
推荐指数
1
解决办法
6726
查看次数

从 powershell 执行 PATCH api 调用

我正在尝试从 powershell 运行以下 API“Patch”命令,我希望在 Azure DevOps 中执行发布...

$deploy = Invoke-RestMethod -Uri $patchurl -Method Patch -Body $body -Headers $header -ContentType "application/json-patch+json"
Run Code Online (Sandbox Code Playgroud)

网址示例如下

https://vsrm.dev.azure.com/test/Fixed%20Income/_apis/Release/releases/567/environments/1072?api-version=6.0-preview.6
Run Code Online (Sandbox Code Playgroud)

补丁调用的主体是...

    "Status": "inProgress",
    "scheduledDeploymentTime": null,
    "comment": null,
    "variables": {}
Run Code Online (Sandbox Code Playgroud)

从 powershell 运行调用命令会返回以下响应...

Invoke-RestMethod : {"$id":"1","innerException":null,"message":"TF400898: 发生内部错误。活动 ID: 759888ab-9828-4cb6-b​​a2f-e90cde1cd39a。","typeName" :“System.Web.Http.HttpResponseException,System.Web.Http”,“typeKey”:“HttpResponseException”,“errorCode”:0,“eventId”:0}

当我运行相同的 url 来运行来自 Postman 的“补丁”请求时,我收到以下响应,这正是我期望从 Powershell 获得的响应。

“$id”:“1”,“innerException”:null,“message”:“TF400813:用户''无权访问此资源。”,“typeName”:“Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException ,Microsoft.TeamFoundation.Framework.Server”,“typeKey”:“UnauthorizedRequestException”,“errorCode”:0,“eventId”:3000

有什么想法我做错了吗?

api powershell json azure-devops

1
推荐指数
1
解决办法
6740
查看次数

如何通过 VS Code 在 Azure DevOps YAML 文件中添加和验证自定义构建任务

我有 Azure DevOps 自定义扩展,其中包含构建任务。我正在尝试在代码库中配置/编辑 YAML 文件,并通过 VS Code 将自定义构建任务添加到其中。我正在使用 Microsoft VS Code 扩展 docs-yaml 扩展来验证我的 YAML 文件。

如下图所示,Microsoft 构建模板中提供的所有构建任务均已成功验证,没有任何问题。但它未能验证我的构建任务sampletask@3。据我了解,YAML 文件正在根据称为管道架构的文件进行验证。我在以下位置找到了此架构文件 https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/v1.174.2/service-schema.json

  1. 如何/是否可以将我的构建任务详细信息添加到管道模式文件中?
  2. 如果上述方法不可行,有什么方法可以在 VS Code 中成功验证我的构建任务吗?

请参考下图。 无法验证我的任务

参考 :

schema yaml visual-studio-code azure-devops azure-pipelines-build-task

1
推荐指数
1
解决办法
2280
查看次数

有什么方法可以更改 VS code 中 git 提交的作者电子邮件吗?

变量摘要:我正在使用企业计算机(corp.company.com),上面安装了 VS Code(win10),使用 VSTS(Azure DevOps)并托管了属于另一个组织(another.com)的 git。全局和本地 Gitconfig 配置为使用 alexsun@another.com 作为 user.email,因为 VSTS 仅接受来自 @another.com 的提交(策略)。

问题是,当我尝试从 VScode 提交并推送到 VSTS 时,提交的作者变为 myusername@corp.company.com,并且由于上述策略,推送失败。当在 VScode 中通过终端(WSL) 执行提交和推送时,一切正常,并且提交保存为 alexsun@another.com。

我多次重建本地存储库(通过克隆远程存储库),禁用凭据帮助程序。尽管如此,当使用 VScode 提交和推送时,作者变为 myusername@corp.company.com,当通过 cli 提交时,一切都很好 - alexsun@another.com。

顺便说一句,myusername@corp.company.com 与登录 Win 计算机的用户名相同。我检查了 Windows Credentials Manager,对于 git,它也是 alexsun@another.com。myusername@corp.company.com 仅针对 O365 信用设置。

任何人?

git visual-studio-code azure-devops

1
推荐指数
1
解决办法
4535
查看次数

我可以在 Azure DevOps 中使用 dotnetpublish 命令发布 .net Framework 4.7.1 解决方案吗

我有一个目标框架为 4.7.1 的解决方案。我已经在本地安装了 dotnet core sdks 并且能够发出构建、发布命令。

我的项目文件如下所示,其中有许多对 dotnet core dll 的引用

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net471</TargetFramework>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
    <TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
    <IsPackable>false</IsPackable>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.3.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.4.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.3.0" />
    <PackageReference Include="Microsoft.AspNetCore.Session" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.0">
Run Code Online (Sandbox Code Playgroud)

我在尝试使用特定的 .net sdk …

c# azure .net-framework-version azure-devops .net-4.7.1

1
推荐指数
1
解决办法
7830
查看次数

从 AzureDevOps 替换令牌在应用程序设置中设置 JSON 密钥

我正在努力使用 Azure Devops 中的替换令牌任务将变量发送到 Blazor 服务器应用程序中的 appsettings.json 文件。

在 中appsettings,我有这个:

{
  "version": "#{versionNumber}#"
}
Run Code Online (Sandbox Code Playgroud)

在 Azure DevOps 中,我设置了以下变量:

versionNumber: '$(version.Major).$(version.Minor).$(version.Revision)'
Run Code Online (Sandbox Code Playgroud)

我的 ReplaceToken 任务是:

- task: replaceToken@3
  displayName: "Replacing version in appsettings"
  inputs:
    targetFiles: '**/*.appsettings.json'
    encoding: 'auto'
    writeBOM: true
    actionOnMissing: 'warn'
    keepToken: false
    tokenPrefix: '#{'
    tokenSuffix: '}#'
    useLegacyPattern: false
    enableTelemetry: true,
    verbosity: detailed
Run Code Online (Sandbox Code Playgroud)

但是,在构建管道中我看到:

replaced 0 tokens out of 0 in 0 file(s) in 1.17 seconds
Run Code Online (Sandbox Code Playgroud)

对我在这里做错了什么有帮助吗?

azure azure-devops azure-pipelines

1
推荐指数
1
解决办法
2881
查看次数

如何使Azure Pipelines yaml触发特定项目的分支?

我在 Github 上有这个项目存储库,并且该存储库中有很多项目。

所以在我的场景中是这样的。

api-build-pipeline 项目-1:触发分支-1 ui-build-pipiline 项目-2:触发分支-1

因此,如果我只对project-1 有更新,则不应触发project-2,但如果它们的触发器是同一分支,我不知道该怎么做。

我想要像这样的触发器触发器:-branch-1 ..project-1

那可能吗?如果可能的话,我不希望他们使用不同的分支。

devops azure-devops

1
推荐指数
1
解决办法
1万
查看次数