小编Krz*_*tof的帖子

devops 管道 yaml 忽略 DotNetCoreCLI@2 任务的失败测试

我有一个 devops yaml 管道,它运行 DotNetCoreCLI@2 任务来恢复、构建和测试。

如果一个或多个测试失败,我希望管道继续并发布为 DevOps 版本做好准备的输出。

最初,如果测试失败,整个管道执行将报告“构建失败”。在构建管道 yaml 的顶部添加以下内容后:

  jobs:
  - job: Build
    continueOnError: true
Run Code Online (Sandbox Code Playgroud)

我现在得到“构建部分成功”。

但是,当我检查管道执行摘要页面时,我发现有 0 个工件:

在此输入图像描述

即使测试失败,如何使管道发布?

为了完整起见,完整的 yaml 如下

    stages:
- stage: Build
  jobs:
  - job: Build
    continueOnError: true

    pool:
      name: Hosted Windows 2019 with VS2019
      demands:
      - msbuild
      - visualstudio

    variables:
      solution: '**/*.sln'
      projects: '**/Interfaces.Avaloq.Presentation.AzureFunctions.csproj'
      unitTestProjects: '**/*Testing.Unit*/*.csproj'
      integrationTestProjects: '**/*Testing.Integration*/*.csproj'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Debug'

    steps:
    - script: |
    - task: DotNetCoreCLI@2
      displayName: Restore Functions
      inputs:
        command: restore
        projects: '$(projects)'
        feedsToUse: config
        nugetConfigPath: …
Run Code Online (Sandbox Code Playgroud)

yaml .net-core azure-devops azure-pipelines azure-pipelines-yaml

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

无法使用 pg_dump PostgreSQL 备份超表 TimescaleDB 数据库

用于备份的命令

C:\Program Files\PostgreSQL\12\bin>pg_dump  -h localhost -U postgres -p 5432  -Fc -f "D:\Database Backup\temp_10.bak" GESEMS_Performace_Test.
Run Code Online (Sandbox Code Playgroud)

错误 :

pg_dump:注意:超表数据在块中,不会复制任何数据。

详细信息:超级表的数据存储在超级表的块中,因此超级表的 COPY TO 不会复制任何数据。

参考图片:

有什么建议可以备份 TimescaleDB 超表?

postgresql timescaledb

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

如何从 DevOps 管道安全地登录 Az CLI

我想从我的 Azure DevOps Pipeline 执行 AZ cli 命令。在我的 YAML 文件中,我有这个:

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '3.x'
    architecture: 'x64'

# Updating pip to latest
- script: python -m pip install --upgrade pip
  displayName: 'Upgrade pip'

# Updating to latest Azure CLI version.
- script: pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge
  displayName: 'upgrade azure cli'

- script: az --version
  displayName: 'Show Azure CLI version'

- script: az extension add -n azure-devops
  displayName: …
Run Code Online (Sandbox Code Playgroud)

azure azure-cli azure-devops azure-pipelines

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

Azure DevOps:仅当上一个任务运行时才运行任务

我希望该PublishTestResults@2任务仅在前一个任务script(运行单元测试)实际运行时才运行。

  • 如果我使用condition: succeededOrFailed()thenPublishTestResults@2运行,即使上一步没有运行 - 我认为这就是目的condition: always()
  1. 即使前一个任务失败了,如何使任务取决于前一个任务?
  2. always()和 和有什么区别succeededOrFailed()

参考

    # This step only runs if the previous step was successful - OK
    - script: |
        cd $(System.DefaultWorkingDirectory)/application/src
        yarn test:unit --silent --ci --reporters=jest-junit
      displayName: 'Jest Unit Tests'
      env:
        JEST_JUNIT_OUTPUT_DIR: $(System.DefaultWorkingDirectory)/testresults
        JEST_JUNIT_OUTPUT_NAME: 'jest-junit.xml'

    # This step ALWAYS runs - NO
    #  This step should ONLY run if the previous step RAN (success OR fail)
    - task: PublishTestResults@2
      displayName: …
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-pipelines azure-pipelines-yaml

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

Azure Devops - 发布管道工件:构建 ID 无效

在 Azure DevOps 中运行发布管道时,我遇到了“发布管道工件”任务的问题。

我得到的错误是 Build Id is not valid

输出中的值与BUILD_BUILDID“初始化作业”中的值相匹配,这也是 repo 的最新提交 ID。

我有点困惑,因为“buildid”是一个用户无法修改的系统变量。

我不确定其余的工作是否相关,但运行如下:

1. Node.js tool installer (10.x)
2. npm (install)
3. Command line (webpack)
4. Copy files (to build.artifactstagingdirectory)
5. Archive files (to $(Build.ArtifactStagingDirectory)/client.zip)
6. Publish Pipeline Artifacts ($(Build.ArtifactStagingDirectory)/client.zip) - error
Run Code Online (Sandbox Code Playgroud)

发布管道工件日志:

2021-01-08T08:40:21.7105147Z ##[debug]Evaluating: succeeded()
2021-01-08T08:40:21.7105624Z ##[debug]Evaluating succeeded:
2021-01-08T08:40:21.7106468Z ##[debug]=> True
2021-01-08T08:40:21.7107158Z ##[debug]Result: True
2021-01-08T08:40:21.7108186Z ##[section]Starting: Publish Pipeline Artifact
2021-01-08T08:40:21.7116705Z ==============================================================================
2021-01-08T08:40:21.7117060Z Task         : Publish Pipeline Artifacts
2021-01-08T08:40:21.7117393Z Description  : Publish (upload) a file …
Run Code Online (Sandbox Code Playgroud)

webpack azure-devops azure-pipelines

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

Pull Request 构建并跳过其他阶段

我在 Azure DevOps 中使用多阶段 YAML 管道,并且在一个阶段中构建并将工件部署到其他阶段。我已经设置了拉取请求构建,每当推送新代码时,管道中的所有阶段都会运行,这是不可取的。

我想要的是,每当新代码被推送到任何分支时,我想要运行构建阶段并跳过部署阶段。默认情况下,此选项在经典管道中可用,因为构建和发布是早期的单独组件

azure-devops azure-pipelines

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

有没有办法更改发布管道日志的字体颜色

在 Azure Devops 发布管道日志中,是否有选项可以将字体文本颜色更改为红色以表示例外。

azure-devops azure-pipelines azure-pipelines-release-pipeline

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

有条件地在 azure 管道中使用变量组

我知道可以在 azure pipelines yml 中有条件地设置变量。请参阅https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#conditional-insertion

是否也可以有条件地使用变量组?

假设如果管道运行变量已设置或具有特定值,则管道应使用变量组。如果不是,则不得使用该组。

谢谢

azure-devops azure-pipelines azure-pipelines-yaml

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

如何在构建工件文件中注入 Azure DevOps 管道运行号?

我希望在我部署的 Angular 应用程序中显示 Azure Devops 管道构建标识符(下面的红色)。请问我该怎么做有什么建议吗?

azure-devops azure-pipelines

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

Azure Pipeline DevOps 中的条件默认值

我使用 Azure Pipelines 来构建我的解决方案。手动构建时,用户可以决定使用哪个构建配置。现在我希望默认值(以及自动触发时的值)根据分支而不同。这是我的(非工作)方法:

name:   PR-$(Build.SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.r)
trigger:
  - develop
  - test 
  - master
pool:
  vmImage: 'windows-latest'
parameters:
- name: BuildConfiguration
  displayName: Build Configuration
  ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/develop') }}:
  default: Debug
  ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/test') }}:
  default: Release
  ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
  default: Release
  values:
  - Debug
  - Release
Run Code Online (Sandbox Code Playgroud)

条件部分 ( ${{...}) 根本不起作用。(* "A template expression is not allowed in this context")

还有其他方法可以实现这一点吗?

azure-devops azure-pipelines azure-pipelines-yaml

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