首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用竹子YAML规范的工件依赖项(目标)

使用竹子YAML规范的工件依赖项(目标)
EN

Stack Overflow用户
提问于 2020-05-29 15:39:20
回答 1查看 1.2K关注 0票数 2

我正在尝试使用竹子YAML规范(下面的.yml文件)来设置竹子构建计划配置。在最后一个阶段(创建部署工件),我想使用上一阶段的共享工件。通过将作业的工件指定为"shared: true“,我可以在第二阶段中使用它们。但是,它们位于相同的目标文件夹中。使用UI可以很容易地对其进行编辑。

Artifact dependencies

但是我如何才能指定这两个工件的目标文件夹,比如从"Root of working directory“到"./app”和"./wwwroot“呢?

代码语言:javascript
复制
---
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
EN

回答 1

Stack Overflow用户

发布于 2020-05-30 15:10:42

YAML规范不支持工件依赖管理,您需要在“创建部署工件”作业中使用脚本任务,以便在压缩之前将它们从根目录放入单独的文件夹中

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62080970

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档