5

We have a GoCD installation where we like to keep the pipeline configuration XML files (cruise-config.xml) in a separate git repository, and install it (preferably via a pipeline and automatically) to the GoCD server whenever it is changed.

However we couldn't find an easy way to validate the XML config file before sending it off to GoCD, and obviously we do't want to install invalid configs, as that would break our pipelines. Are there any tools, or utilities that help us with validating the config file?

  • If nonne exist, I'm afraid the solution would be to write a linting program for this configuration file – Tensibai Mar 3 '17 at 17:41
4

The best solution we found so far, is using the MagicalGoConfigXmlLoader interface from the go source code, as it calls an internal validateCruiseConfig command, that does all validations, or die if the file is invalid:

MagicalGoConfigXmlLoader loader = new MagicalGoConfigXmlLoader(new ConfigCache());
loader.loadConfigHolder(configAsString);

The main problem with this solution that it essentially requires the whole GoCD server source code checked out, in a working state to work properly. Also as it's an internal API it is subject to changes between GoCD versions, making GoCD upgrades harder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.