小编Krz*_*tof的帖子

根据计划将不同的参数值传递到 Azure DevOps Pipeline

我有一个长期运行的 DevOps 管道,每天早上都会设置一个复杂的环境。

它有一个参数;我们称之为“版本”。

我需要安排管道每天早上自动运行 3 次,版本值为 1、2 和 3。

查看触发器,调度触发器和管道触发器似乎都不允许传递参数值。

有没有办法做到这一点?重要的是它们彼此独立运行。每次执行需要 30 到 60 分钟。因此,一个接一个地循环运行它们并不是一种选择。


这是我的 YAML 代码当前的样子:

trigger: none
pr: none
schedules:
  - cron: 0,5,10 12 * * mon,tue,wed,fri
    displayName: Scheduled most mornings
    branches:
      include:
      - CIBranch
    always: true

parameters:
- name: Version
  type: string
  default: '3'
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-pipelines

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

有没有办法为 Azure DevOps 管道任务或作业配置重试?

目前,我有一个 OneBranch DevOps 管道,在恢复包时偶尔会失败。通常它会因为一些暂时性错误(例如套接字异常或超时)而失败。重新尝试该作业通常可以解决问题。

有没有办法配置作业或任务重试?

azure-devops azure-pipelines azure-pipelines-yaml

11
推荐指数
2
解决办法
7621
查看次数

如何查看 Azure Devops 中的预定义变量

我想查看预定义变量的路径值,就像$(System.DefaultWorkingDirectory)我想查看其中存储的值一样。我无法找到这个变量值,所以我在 Azure DevOps 中哪里可以找到它。

简而言之,我如何检查该特定发布管道中使用的 Build.SourcesDirectory 或 Build.Repository.LocalPath 是什么?

azure azure-devops azure-pipelines azure-devops-self-hosted-agent azure-pipelines-tasks

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

是否可以以编程方式取消 Azure DevOps 管道作业?

由于可以在 Azure DevOps 管道中停止单个步骤:

echo "##vso[task.complete result=Succeeded;]DONE"
Run Code Online (Sandbox Code Playgroud)

请参阅:https : //github.com/microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md#task-logging-commands

是否还可以检查条件并根据该条件停止整个管道运行或作业?

附注。我知道,您可以为作业设置条件,但在我的情况下,整个管道是单个作业,由于其他原因,将其拆分为多个作业是没有意义的。

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

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

如何在 super() 中使用 configService?

我有一个关于设置环境变量的问题。

在官方文档中,它说在这种情况下使用ConfigModule,但我的情况是一个例外情况。

因为我想在构造函数的 super() 中使用它。

我的代码如下。

这种情况有什么解决办法吗?

如果您需要更多信息,请告诉我。

谢谢大家的支持!!

// jwt.strategy.ts

import { UnauthorizedException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { InjectRepository } from '@nestjs/typeorm';
import { Strategy, ExtractJwt } from 'passport-jwt';
import { JwtPayload } from './jwt-payload.interface';
import { UserRepository } from './user.repository';
export class JwtStrategy extends PassportStrategy(Strategy) {
    constructor(
        @InjectRepository(UserRepository)
        private userRepository: UserRepository,
        private configService: ConfigService,
    ) {
        super({
            jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
            secretOrKey: configService.get('JWT_TOKEN'),
        });
    }

    async validate(payload: JwtPayload) …
Run Code Online (Sandbox Code Playgroud)

nestjs nestjs-passport nestjs-config nestjs-jwt

10
推荐指数
2
解决办法
4763
查看次数

错误:请求的资源需要用户身份验证:在 AzureCLI 任务构建管道中

我无法从 azureCLI 任务触发 azure 管道构建

任务 :

- task: AzureCLI@2
  inputs:
    azureSubscription: 'Free Trial(My subscription)'
    scriptType: 'pscore'
    scriptLocation: 'inlineScript'
    inlineScript: |
      az --version
      echo "Running : az account show"
      az account show
      #export AZURE_DEVOPS_EXT_PAT='mypat'
      $env:AZURE_DEVOPS_EXT_PAT='mypat'
      az pipelines create --name newPipeline --org https://dev.azure.com/AbiNilOrg/ --project azure-devops-kubernetes-terraform --branch master
Run Code Online (Sandbox Code Playgroud)

输出有错误:

Running : az account show
{
  "environmentName": "AzureCloud",
  "homeTenantId": "***",
  "id": "73c1af29-384c-4574-bd88-92d7bb392cfc",
  "isDefault": true,
  "managedByTenants": [],
  "name": "Free Trial",
  "state": "Enabled",
  "tenantId": "***",
  "user": {
    "name": "***",
    "type": "servicePrincipal"
  }
}
WARNING: This …
Run Code Online (Sandbox Code Playgroud)

azure azure-cli azure-devops azure-pipelines azure-pipelines-yaml

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

Azure、.Net、Cobertura - ##[警告]找到多个文件或目录匹配项

您好,我正在尝试在 azure 管道中使用 .net5 获取代码覆盖率。

运行测试(不是整个文件)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results File: /home/vsts/work/_temp/_fv-az43-964_2021-08-25_08_31_59.trx

Attachments:
  /home/vsts/work/_temp/f5dd5e9f-e260-437d-80ef-4fb917215b09/coverage.cobertura.xml
Passed!  - Failed:     0, Passed:    16, Skipped:     0, Total:    16, Duration: 732 ms - /home/vsts/work/1/s/sda2021_webapi/Test/sda2021_api.tests/bin/Release/net5.0/sda2021_webapi.tests.dll (net5.0)
Result Attachments will be stored in LogStore
Run Attachments will be stored in LogStore
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently …
Run Code Online (Sandbox Code Playgroud)

.net unit-testing azure azure-devops azure-pipelines

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

在 Azure DevOps 管道中使用 .NET Core CLI 任务 (DotNetCoreCLI@2) 抑制警告

尝试使用 .NET Core CLI 任务 (DotNetCoreCLI@2) 抑制 Azure DevOps 管道中的警告,但出现以下错误:

MSBUILD:错误 MSB1001:未知开关。开关:--noWarn:MSB3277

以下是代码示例,类似于我在与 msbuild cli 参考相关的几篇文章中使用开关的方式:

- task: DotNetCoreCLI@2
  displayName: Release Build
  inputs:
    command: 'build'
    projects: '${{ parameters.solutionPath }}'
    arguments: --configuration Release --noWarn:MSB3277
Run Code Online (Sandbox Code Playgroud)

我也尝试过小写 --nowarn ,但仍然没有运气,所以任何有关此问题的帮助将不胜感激。

预先感谢您的支持,

特里

azure-devops dotnet-cli azure-pipelines

9
推荐指数
2
解决办法
3620
查看次数

GitHub 上的“操作”选项卡丢失

我正在尝试创建 GitHub 操作,但我的存储库中不存在“操作”选项卡:

缺少“操作”选项卡的图像

此 GitHub 文档页面建议导航到“设置”选项卡,然后从左侧边栏中选择“操作”并启用它们。

“设置”选项卡中缺少“操作”选项卡的图像

我的下一个想法是我的组织禁用了操作,因此我按照此 GitHub 文档页面上有关管理组织操作的步骤进行操作。但我再次转到“您的组织”->“设置”并在左侧边栏中查找“操作”,却找不到它。

组织设置中缺少“操作”选项卡的图像

然后我想也许我缺少管理员权限,所以我检查了我的组织下的“人员”选项卡,我是一个“所有者”,我的研究告诉我它与管理员相同。

所有者特权形象

所以我们到了。关于为什么我的组织中到处都缺少“操作”选项卡,您有什么想法吗?

github github-enterprise github-actions

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

是否可以在 Azure DevOps 上升级到性能更高的 Microsoft 托管构建代理?

我的开发团队正在使用 Azure Devops 的 Microsoft 托管构建代理,但希望拥有性能更高的构建代理。目前我们的构建时间有时会超过 5 分钟,这是不可取的。

我们不想走自托管路线,因为那样我们将需要管理我们自己的构建代理的任务。现阶段我们根本没有资源来完成这样的任务。

是否可以在 Azure DevOps 上升级到性能更高的 Microsoft 托管构建代理?

可能只是我们需要优化构建构建的方式,然后缩短构建时间 - 但想知道这样的选项是否可用。

谢谢你!

upgrade azure build-agent azure-devops azure-pipelines

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