Skip to content

Commit 2e39da0

Browse files
committed
Add documentation, for #313
1 parent b1ee343 commit 2e39da0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Jenkins Setup
2+
3+
Injecting environment variables is not supported in Jenkins natively, but Jenkins plugins exist that provide this functionality. Of these plugins [EnvInject] appears to be the most popular with over 20k downloads per month.
4+
5+
To inject the GitVersion variables as environment variables for a build job using [EnvInject], do the following:
6+
7+
1. Add an **Execute Windows batch command** build step with *Command*:
8+
`gitversion /output buildserver`
9+
1. Add an **Inject environment variables** build step and use value 'gitversion.properties' for the *Properties File Path* parameter
10+
11+
This assumes GitVersion.exe is available on the command line.
12+
13+
You can verify correct injection of environment variables by adding another "Execute Windows batch command" build step with the following *Command*:
14+
15+
```
16+
@echo Retrieving some GitVersion environment variables:
17+
@echo %GitVersion_SemVer%
18+
@echo %GitVersion_BranchName%
19+
@echo %GitVersion_AssemblySemVer%
20+
@echo %GitVersion_MajorMinorPatch%
21+
@echo %GitVersion_Sha%
22+
```
23+
24+
[EnvInject]: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

0 commit comments

Comments
 (0)