Gitlab CI对发布版或调试版的依赖性
我正在学习gitlab runner的工作原理,并创建一个脚本来运行windows C#项目的构建 我在shell上安装了一个运行程序,并安装了构建所需的所有工具,但现在我需要创建一个好的.yml脚本来运行 我已经有了一些代码,但我不知道是否有可能像或那样有多个依赖项 这是我想要的设置方式: 这就是我现在所拥有的:Gitlab CI对发布版或调试版的依赖性,gitlab,gitlab-ci,gitlab-ci-runner,Gitlab,Gitlab Ci,Gitlab Ci Runner,我正在学习gitlab runner的工作原理,并创建一个脚本来运行windows C#项目的构建 我在shell上安装了一个运行程序,并安装了构建所需的所有工具,但现在我需要创建一个好的.yml脚本来运行 我已经有了一些代码,但我不知道是否有可能像或那样有多个依赖项 这是我想要的设置方式: 这就是我现在所拥有的: variables: PROJECT_LOCATION: "ProjectFolder" PROJECT_NAME: "ProjectName" before_scrip
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
但是正如您所看到的,我给它提供了依赖构建,它不喜欢这样,因为我有build:debug和build:release。有办法解决这个问题吗?
如果还有其他的建议我需要记住,欢迎。。。(就像我说的,我还在学习)我找到了答案,显然你可以有多个依赖项,这是一个or语句 例如:
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