gpt4 book ai didi

azure - 如何避免在环境中的 Azure Agent for Pipeline 中创建新文件夹

转载 作者:行者123 更新时间:2023-12-03 00:55:46 30 4
gpt4 key购买 nike

我已为虚拟机创建了 Azure 代理环境,我将版本下载到该文件夹​​中。我有以下 yaml 文件

# Python package
# Create and test a Python package on multiple Python versions. OK
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/python

trigger:
paths:
include:
- Flytteordre

pool:
vmImage: 'ubuntu-latest'
name: Azure Pipelines
variables:
python.version: '3.6'

stages:
- stage: Build
displayName: Build stage
jobs:
- job: build
displayName: build
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version) copy'
inputs:
versionSpec: '$(python.version)'

# We actually don't need to install these dependencies here. It needs to happen in the deploy yaml file.
- task: CmdLine@2
inputs:
script: |
python -m pip install --upgrade pip
python -m pip install selenium
python -m pip install pdfplumber
python -m pip install pandas
displayName: 'Install dependencies'

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: dist'
inputs:
PathtoPublish: Flytteordre
ArtifactName: dist

- stage: Deployment
displayName: Deployment stage
jobs:
- deployment: deploymentJob
displayName: Deploy
environment:
name: Production
resourceType: VirtualMachine
strategy:
runOnce:
deploy:
steps:
- download: none
- downloadBuild: none
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'dist'
downloadPath: 'C:/azagent/A1/_work/myfolder/'

我的问题是,每次运行管道时,它都会在 _work 环境中创建一个名为 1、2 等的文件夹。

enter image description here

我想避免这种情况,以便我可以完全控制创建哪些文件夹。如您所见,我已指示我的工件应下载到文件夹路径 C:/azagent/A1/_work/myfolder/,但这将创建两个文件夹。一个是我指定的文件夹,另一个是标题为数字的文件夹。我现在这是默认设置,但我想知道是否有办法关闭此默认设置,或者至少能够更改预定义路径变量 PIPELINE.WORKSPACE 或 Agent.BuildDirectory?

最佳答案

How to avoid creating new folder in Azure Agent for Pipeline in Environment

根据文档Agent variables :

enter image description here

因此,每个构建定义都会进入代理工作目录中自己的目录。

众所周知,管道有输入和输出。每当我们创建新管道时,我们都会增加一个数字来命名创建的新工作文件夹。这样做的好处是,共享相同存储库副本的多个正在运行的构建迟早会互相干扰。

I would prefer the option of being able to name the directory myselfin case I need to find a particular project and open it on the localagent.

如果您想在本地代理上打开它,您可以使用代理变量来显示路径:

Agent.BuildDirectory

关于azure - 如何避免在环境中的 Azure Agent for Pipeline 中创建新文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69270851/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com