yaml - 使用 Bamboo YAML 规范的工件依赖项(目标)
问题描述
我正在尝试使用 Bamboo YAML 规范(下面的 .yml 文件)设置 Bamboo 构建计划配置。在最后阶段(创建部署工件)中,我想使用上一阶段的共享工件。通过将作业的工件指定为“shared: true”,我可以在第二阶段使用它们。但是,它们位于同一目标文件夹中。使用 UI 可以轻松地对其进行编辑。
但是如何在 Bamboo YAML 规范中指定两个工件的目标文件夹,例如分别从“工作目录的根”到“./app”和“./wwwroot”?
---
version: 2
plan:
project-key: COCKPIT
key: BE
name: Cockpit - Continuous Build - Windows
stages:
- Build Stage:
- Build Backend
- Build Frontend
- Build Artifact:
- Create Deployment Artifact
Build Backend:
requirements:
- Visual Studio Build Tools (32-bit)
tasks:
- checkout:
repository: cockpit_backend
path: 'cockpit_backend'
force-clean-build: false
- script:
- dotnet publish .\cockpit_backend\src\Cockpit.WebApi\ --configuration Release
artifacts:
-
name: BackendBuild
location: cockpit_backend/src/Cockpit.WebApi/bin/Release/netcoreapp3.1/publish
pattern: '**/*.*'
required: true
shared: true
Build Frontend:
requirements:
- os_linux
tasks:
- checkout:
repository: 'Cockpit / cockpit_frontend'
path: 'cockpit_frontend'
force-clean-build: false
- script:
- cd cockpit_frontend
- npm install
- script:
- cd cockpit_frontend
- npm run build-prod
docker:
image: node:alpine
artifacts:
-
name: FrontendBuild
location: cockpit_frontend/dist
pattern: '**/*.*'
required: true
shared: true
Create Deployment Artifact:
requirements:
- os_windows
tasks:
- script:
interpreter: powershell
scripts:
- $buildDir = "Cockpit"
- $dest = "Cockpit_${bamboo.buildNumber}.zip"
- Add-Type -assembly "system.io.compression.filesystem"
- '[io.compression.zipfile]::CreateFromDirectory($buildDir, $dest)'
artifacts:
-
name: Completebuild
pattern: 'Cockpit_${bamboo.buildNumber}.zip'
required: true
解决方案
YAML 规范不支持工件依赖项管理,您需要在“创建部署工件”作业中有脚本任务,以便在压缩之前将它们从根目录放入单独的文件夹中
推荐阅读
- python - 类中的 python 函数与 java/c++ 中的函数有何不同?
- php - php在一个语句中通过未知索引获取数组的值
- javascript - fetch-mock:没有为 POST 定义回退响应
- java - Java方法引用选择窄类型
- spring - spring如何将请求参数的value属性的数据转换为字符串内容
- http - 如何在 nodejs 中创建 http 和 https 服务器?
- sql-server - 如果发送邮件失败,请多次尝试实施发送邮件任务
- corda - 如何在corda上获取账户的交易历史
- react-native - 如何删除错误:捆绑失败:ReferenceError:未计算文件的 SHA-1
- c# - Selenium C#:添加扩展并启动 Firefox 时出现 System.ArgumentOutOfRangeException