Maven Build and Deployment - Verigreen/verigreen GitHub Wiki
Maven 3.0.4 or higher in your PATH.
1.7.21 <= JDK version < 1.7.51 .seems like there is an issue with JDK version 1.7.51 and up so better choose a lower version. we will solve it soon hopefully.
- Clone Verigreen repository, as such
git clone https://github.com/Verigreen/verigreen.git
- Set the
JAVA_HOME
environment variable to your Java path. - If needed, copy and configure a
settings.xml
under the user's.m2
folder under the home folder (copy to local mvn folder). Here is a samplesettings.xml
:
<settings>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>securecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>securecentral</id>
<!--Override the repository (and pluginRepository) "central" from the
Maven Super POM -->
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>your-proxy.yourcompany.com</host>
<port>yourport</port>
<nonProxyHosts>127.0.0.1|localhost</nonProxyHosts>
</proxy>
</proxies>
</settings>
- Build the entire project from the Verigreen root directory:
# if using a settings.xml file
mvn clean install -s $HOME/.m2/settigs.xml
or
# no settings.xml file
mvn clean install
- After a successful build, create a folder to hold the hook's jars and run the shell script
copyHook.sh
as such:
./copyHook.sh <path to the folder created above>
- Log into the Stash server and activate the External Pre-Receive Hook Plugin. Alternatively for a pure git environment - configure the pre-receive hook of the bare repo.
- Copy the git hook jars to the Stash server and give
stash
owner/group ownership + execute bit should be on. - Copy or create a
hook.properties
file in your Stash server that will provide thecollector.address
to push events to the Verigreen Collector. Here is an example of how ahook.properties
file should look like:
#Collector address
collector.address=http://myvgcollector.example.com:8080/rest
- On the stash machine, create a caller script file which will run the hook jar when a new commit is being pushed to the protected repository. The caller file must call the specific hook jar configured to the correct collector address, the one which was generated during the build process. Example:
#!/bin/bash
export JAVA_HOME=/usr/java/1.7u21
export VG_HOOK=/hook_properties_location
read LINE;
echo $LINE > /tmp/xxx.log`
java -jar /DATA/stash/hooks/verigreen/xxx/git-hook.jar $LINE
Important: Make sure that the
VG_HOOK
is pointing to the completehook.properties
file path in your Stash server.
- Configure the External Pre-Receive Hook plugin on the required repo to protect (or the pre-receive hook) to call the caller script file. For example:
/DATA/stash/hooks/verigreen/agm.sh
- Pass an argument to the hook. This parameter is an arbitrary one for the script but it better be the repository name, to make sense. For Example:
my-cool-repo,another-repo,..
and so on.