Child pages
  • Commit Gateway

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

CVS Trigger

To configure the version control systems to trigger commit events, two step are necessary:

  1. A mechanism is needed which notifies when a commit has happended.
  2. We need to react to this notification accordingly

1. loginfo

For CVS the first mechanism can be implemented by editing the loginfo file, which executes abritrary scripts whenever cvs commit log information are sent. In addition it is possible to pass some parameters to the invoked script:

ALL $CVSROOT/CVSROOT/postcommit.sh %{psv}

To call a script you have to state for which projects in the repository the script should be executed on cvs commit log events. In the sample code above, the script is executed for every project (ALL). Also you need to provide the script's path and name (e.g$CVSROOT/CVSROOT/postcommit.sh).

Since the postcommit script requires the path, filename and version of the file for which the commit log info event occured, you also need to pass them to the postcommit script (%{psv}).

2. postcommit-script

The second mechanism is implemented via an script which fires an http get request to the backend passing the required values.

#!/bin/sh

REPO='seu_tools'
IFS=","
set – $1

PATH=$(echo "$1" | sed 's/.$//')
FILE=$2
VERSION=$3
/usr/bin/curl http://lde7117t:8080/emi.commit.event.gateway/rest/commitevents.json/send/cvs/$REPO/$PATH/$FILE/$VERSION

#Eat extra input

 /bin/cat > /dev/null

Basically this script only fires a http get request to the provided url. But since the backend service retrieves the file via the provided webinterface of viewvc, you need to provide the root repositoriy name of the viewvc url (e.g. REPO='seu_tools', assuming your root repository is located unter http://your.url/viewvc/seu_tools). The other required parameters (path, filename, version) are just extracted from the passed input. Because they were concatenated with a comma (e.g. path/to,filename.pdf,1.00), the script first needs to split this input:

IFS=","
set – $1
PATH=$(echo "$1" | sed 's/.$//')
FILE=$2
VERSION=$3

As you may notice, PATH isn't just assigned with $1 (i.e. the first part of the splitted input), but also its last character is deleted. This is necessary since at the myEMI setup at GDIS a whitespace is passed along with the path.