Child pages
  • Commit Gateway

Versions Compared

Key

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

...

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:

Code Block
languagebash
titleloginfo
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).

...

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

Code Block
languagebash
titleNotify Commit Gateway script
#!/bin/sh

...


REPO='

...

some_

...

repository'

...


IFS=","

...


set  $1

...


PATH=$(echo "$1" | sed 's/.$//')

...


FILE=$2

...


VERSION=$3

...


/usr/bin/curl http://

...

<serverlocation and port>/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 in which serverlocation and port need to be substituted by your local values. 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='seusome_toolsrepository', assuming your root repository is located unter http://your.url/viewvc/seusome_toolsrepository). 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:

Code Block
languagebash
titleSplitting File information
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 some CVS servers may add an additional white space along with the path.  If this is not the case in your installation you need to change this.