Skip to end of banner
Go to start of banner

How to get build plan's repository id

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Description

This question was asked on http://answers.atlassian.com and reproduced here. A build plan can have 0 or more associated repositories. This provides the answer for the normal case of a single source repository. There is no formal remote API for retrieving it, so, we have to resort to using the UI. This works against 4.2 to 5.0 (at least).

Example

This uses the standard renderRequest action together with findReplaceRegex parameter to parse the response data looking for the first repositoryId field. Blank is returned if no repositories are specified.

CLI action to retrieve a build plan's source repository id
--action renderRequest --quiet --request "/chain/admin/config/editChainRepository.action?buildKey=XXX-DEF" --findReplaceRegex ".*repositoryId=(\d+).*|.*:\$1"
 
To get:
37159110
  • No labels