【发布时间】:2017-12-18 21:47:46
【问题描述】:
您好,我正在尝试使用环境变量作为 Gitlab 运行程序设置上的 MSBuild 过程的一部分,以传递 CI_PIPELINE_ID 和 CI_COMMIT_SHA 以使用增量构建 ID 构建应用程序并提交 sha 以跟踪二进制文件版本。
我的 .gitlab-ci.yml 配置如下:
variables:
Solution: Project.sln
before_script:
- "echo off"
- 'call "%VS140COMNTOOLS%\vsvars32.bat"'
- echo.
- set
- echo.
- echo %HALCONROOT%|find "13" >nul
- if errorlevel 1 (echo not13) else (set HALCONVERSION=HALCON_13)
stages:
- build
build:
stage: build
script:
- echo building...
- 'msbuild.exe /p:Configuration="Release" /p:Platform="x64" "%Solution%"'
tags:
- "HALCON 13"
except:
- tags
我需要做什么才能在我的 c++ 项目中访问这样的环境变量?
#ifndef CI_COMMIT_SHA
#define COMMIT_SHA 0
#else
#define COMMIT_SHA CI_COMMIT_SHA
#endif
【问题讨论】:
标签: c++ visual-studio msbuild gitlab