Azure DevOps-清理生成目录 [英] Azure DevOps - Clean build directory

查看:105
本文介绍了Azure DevOps-清理生成目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅提及我正在使用自托管代理运行我的构建和发布管道.

Just to mention I am using a self-hosted agent for running my build and release pipelines.

问题是当我运行任何版本时,由于管道中的某些问题而失败.从远程克隆的分支位于_work目录中.第二次运行还选择了相同的工作目录,并且我已从代理_work目录手动检查,没有克隆新目录,我还可以从Azure Pipeline日志中验证它们是否使用相同的旧目录.

The problem is when I run any build and it failed due to some issues in the pipeline. The cloned branch from remote sits in the _work directory. The second run also picks up the same work directory, and I have checked manually from the agent _work directory no new directory was cloned and I can also verify from Azure Pipeline logs they are using the same old directory.

我为临时解决此问题所做的工作,我进入了旧目录(即/home/user/_work/13),并手动删除了13个目录,然后将其固定在_work下的新文件夹中,例如14.查看来自遥控器的最新克隆代码.

What I did temporarily to solve this, I went into the old directory(i.e. /home/user/_work/13) and manually delete that 13 directories then azure pick it up the new folder say 14 under _work, and I could see the latest cloned code from the remote.

因此,如果发生任何故障,如何自动删除工作文件夹(代理构建目录,即_work下的13/14).

So how to automatically delete the work folder(agent build directory i.e. 13/14 under _work) in case of any failure happen.

PS:当我的管道成功完成时,我已经有清理步骤了,最后我将运行该清理步骤.另外,我正在编写基于.yml的管道.

PS: I already have cleanup steps in place when my pipeline complete with success, which I run at the end. Also, I am writing .yml based pipelines.

请让我知道是否需要任何信息以更好地理解.

Please let me know if any information is required for a better understanding.

推荐答案

Azure DevOps-清理构建目录

Azure DevOps - Clean build directory

获取源代码"选项卡上有一个 Clean 选项,该选项可以在运行构建之前对私人代理的工作目录执行不同的清除操作:

There is an Clean option on the Get Source tab, which could perform different kinds of cleaning of the working directory of your private agent before the build is run:

我们可以将值设置为 true 来清理您的私人代理的工作目录.即使构建失败.

We could set the value to true to clean the working directory of your private agent. Even if the build is failed.

您可以检查文档

You could check the document Clean the local repo on the agent for some more details.

更新:

但这是针对经典管道的,我们没有任何标签我们只在yml管道中定义了

But this is meant for the classic pipeline, do not we have any tag which we define in yml pipeline only

jobs:
- job: string  # name of the job (A-Z, a-z, 0-9, and underscore)
  ...
  workspace:
    clean: outputs | resources | all # what to clean up before the job runs

检查此文档 YAML模式参考以获取一些详细信息.希望这会有所帮助.

Check this document YAML schema reference for some details. Hope this helps.

这篇关于Azure DevOps-清理生成目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆