Hi I'm trying to use environmental variables as part of the MSBuild process on a Gitlab runner setup to pass the CI_PIPELINE_ID and CI_COMMIT_SHA to build the application with an increment build id and commit sha to track the binaries version.
My .gitlab-ci.yml is configured as below:
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
What do I need to do to access the environmental variables like this in my c++ project?
#ifndef CI_COMMIT_SHA
#define COMMIT_SHA 0
#else
#define COMMIT_SHA CI_COMMIT_SHA
#endif