在释放或调试版本Gitlab CI依赖

问题描述 投票:0回答:1

我学习gitlab亚军是如何工作的,并创建一个脚本运行构建一个窗口C#项目。

我安装我的壳流道,并安装所有需要的工具来建立,但现在我在,我需要创造一个良好的.yml脚本运行的步骤。

我已经有一些代码,但我不知道是否有可能有多个依赖像OR?

这是我想将它设置方式:The steps

这就是我现在:

variables:
  PROJECT_LOCATION: "ProjectFolder"
  PROJECT_NAME: "ProjectName"

before_script:
  - echo "starting build for %PROJECT_NAME%"
  - cd %PROJECT_LOCATION%

stages:
  - build
  - artifacts
  - test
  - deploy

build:debug:
  stage: build
  script:
  - echo "Restoring NuGet Packages..."
  - 'nuget restore "%PROJECT_NAME%.sln"'
  - echo "Starting debug build..."
  - 'msbuild /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Debug /verbosity:quiet /p:AllowUnsafeBlocks=true /nr:false "%PROJECT_NAME%.sln"'
  except:
    - master
  tags:
    - windows

build:release:
  stage: build
  script:
  - echo "Restoring NuGet Packages..."
  - 'nuget restore "%PROJECT_NAME%.sln"'
  - echo "Starting release build..."
  - 'msbuild /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet /p:AllowUnsafeBlocks=true /nr:false "%PROJECT_NAME%.sln"'
  only:
    - master
  tags:
    - windows

artifacts:
  stage: artifacts
  script:
  - echo "Creating artifacts..."
  dependencies: 
    - build
  artifacts:
    name: "Console"
    paths:
      - Project.Console/bin/
    expire_in: 2 days
    untracked: true

    name: "Service"
    paths:
       - Project.Service/bin/
    expire_in: 1 week
    untracked: true
  only:
    - tags
    - master
    - schedules
  tags:
    - windows

test:unit:
  stage: test
  script:
  - echo "Running tests..."
  dependencies: 
    - build
  tags:
    - windows

test:integration:
  stage: test
  script:
  - echo "Running integration tests..."
  dependencies: 
    - build
  only:
    - tags
    - master
    - schedules
  tags:
    - windows

deploy:
  stage: deploy
  script:
  - echo "Deploy to production..."
  dependencies: 
    - build
  environment:
    name: production
  only:
    - tags
  tags:
    - windows

但你可以看到我给它的依赖性构建和它不喜欢这一点,因为我有建:调试和编译:释放。有没有办法来解决这个问题?

如果有其他的指针,我需要记住永远欢迎...(就像我说的,我还是性学习的)

gitlab gitlab-ci gitlab-ci-runner
1个回答
0
投票

我找到了答案显然你可以有多个依赖关系,这是一个或陈述。

因此,例如:

artifacts:
  stage: artifacts
  script:
  - echo "Creating artifacts..."
  dependencies: 
    - build:debug
    - build:release
  artifacts:
    name: "Console"
    paths:
      - Project.Console/bin/
    expire_in: 2 days
    untracked: true

    name: "Service"
    paths:
       - Project.Service/bin/
    expire_in: 1 week
    untracked: true
  only:
    - tags
    - master
    - schedules
  tags:
    - windows
© www.soinside.com 2019 - 2024. All rights reserved.