Configuring source code management triggers for CVS

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

This page provides instructions on how to configure CVS to send message events that trigger the execution of Bamboo plans.

You only need to configure CVS to send these message events if The repository triggers the build when changes are committed trigger has been configured for one or more of your Bamboo plans.

Configuring CVS to trigger a build

This section explains how to configure CVS to trigger a build when the repository is changed. This involves installing two scrips:

  1. A pre-commit trigger keeps track of the last directory to be processed, so we know when the commit has completed.
  2. A post-commit trigger that waits until it has processed the last directory of the commit before instructing the Bamboo server to execute the relevant plan(s).

このページの内容

(warning) The following commands and script files assume that your CVS server runs on a UNIX- or Linux-based operating system. If your CVS server runs on any other operating system, then you will need to modify the script files and if necessary, the commands below to suit that operating system.

Step 1. Checking out the CVSROOT

First check out your repository's CVSROOT directory into a temporary directory:

cvs -d cvsroot-to-your-repository checkout CVSROOT

ここで:

  • cvsroot-to-your-repository is the root directory pathname of the CVS repository.
    (info) Using -d cvsroot-to-your-repository overrides the any $CVSROOT environment variable setting.

The following files should be checked out:

U CVSROOT/checkoutlist
U CVSROOT/commitinfo
U CVSROOT/config
U CVSROOT/cvswrappers
U CVSROOT/editinfo
U CVSROOT/loginfo
U CVSROOT/modules
U CVSROOT/notify
U CVSROOT/rcsinfo
U CVSROOT/taginfo
U CVSROOT/verifymsg

Step 2. Install the pre-commit trigger

Add a line like the following example's to the CVSROOT/commitinfo pre-commit trigger file. The CVSROOT/commitinfo file contains the list of programs to run whenever a file is about to be committed to the repository.

^Moo /path-to-your-bamboo-installation/scripts/cvs-triggers/preCommit.sh %r/%p

ここで:

  • ^Moo is the regular expression used to identify the name of the module (called Moo) being updated.
  • /path-to-your-bamboo-installation/scripts/cvs-triggers/preCommit.sh is the Bamboo shell script used to detect the last file of the check in.
    (info) If your Bamboo installation and CVS server are on different machines, refer to the note below.

ステップ 3: post-commit トリガーをインストールする

Add a line like the following example's to the CVSROOT/loginfo post-commit trigger file. The CVSROOT/loginfo file contains the list of programs to run whenever a file has been successfully committed into the repository.

^Moo /path-to-your-bamboo-installation/scripts/cvs-triggers/postCommitBuildTrigger.sh %r/%p http://bamboo-base-url MOO-KEY

ここで:

  • ^Moo is the regular expression used to identify the name of the module (called Moo) being updated.
  • /path-to-your-bamboo-installation/scripts/cvs-triggers/postCommitBuildTrigger.sh is the Bamboo shell script to trigger the build.
    (info) If your Bamboo installation and CVS server are on different machines, refer to the note below.
  • %r/%p

    is how CVS tells the postCommitBuildTrigger.sh script which directory it is committing.

  • http://bamboo-base-url

    is the URL of the Bamboo server.

  • MOO-KEY the key of the Bamboo plan to be executed.

Step 4. Save the changes back to CVS

Commit the changes you made to the CVSROOT/commitinfo and CVSROOT/loginfo files in step 2 and 3, respectively, back to the repository.

cvs -d cvsroot-to-your-repository commit

ここで:

  • cvsroot-to-your-repository is the root directory pathname of the CVS repository.
    (info) Using -d cvsroot-to-your-repository overrides the any $CVSROOT environment variable setting.

ステップ 5: テスト コミットを行う

「テスト」コミットを行います。数秒後、Bamboo によって関連プランの作成が開始されます。

Bamboo のログ ファイルには、次のようなエントリが含まれているはずです。

[INFO] com.atlassian.bamboo.build.UpdateAndBuild - Bamboo build was triggered by remote http call from 127.0.0.1

  • The postCommitBuildTrigger.sh is only triggered when the last file of the commit has been committed.
  • The preCommit.sh and postCommitBuildTrigger.sh must have sufficient privileges to be executed by the CVS user.
  • If your Bamboo installation is not running on the same machine as the CVS server, you will also need add the Bamboo preCommit.sh and postCommitBuildTrigger.sh files to the CVSROOT directory and add the names of these files to the end of the checkoutlist file.

注意

Build Trigger Security — Bamboo will only accept remote build triggers if the triggers originated from the CVS server(s) identified in the CVS root paths of any Bamboo plans. Requests originating from other CVS servers will be rejected by Bamboo.

最終更新日 2019 年 7 月 17 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.