From 59a49c3afaea9fa21da5e3fdbe9d712b6ede1ffe Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Fri, 9 Aug 2024 20:27:41 -0400 Subject: [PATCH] docs: add Jenkins example with Groovy Signed-off-by: Jennifer Power --- docs/tutorials/jenkins.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/tutorials/jenkins.md b/docs/tutorials/jenkins.md index a30a0355..1ad75c16 100644 --- a/docs/tutorials/jenkins.md +++ b/docs/tutorials/jenkins.md @@ -27,7 +27,7 @@ By specifying the git provider flags (i.e. `git-provider-type` and/or `git-serve -### Build a basic [Jenkins Job Builder](https://docs.openstack.org/infra/jenkins-job-builder/) job template for trestle-bot +## Build a basic [Jenkins Job Builder](https://docs.openstack.org/infra/jenkins-job-builder/) job template for trestle-bot 1. Install `jenkins-job-builder`: `pip install --user jenkins-job-builder` 2. [Configure](https://jenkins-job-builder.readthedocs.io/en/latest/execution.html) `jenkins-job-builder` @@ -62,4 +62,29 @@ By specifying the git provider flags (i.e. `git-provider-type` and/or `git-serve model: profile ``` +## Example with Groovy + +```groovy +pipeline { + agent { + docker { + image 'quay.io/continuouscompliance/trestle-bot:v0.10' + args "-v ${WORKSPACE}:/trestle-workspace -w /trestle-workspace --entrypoint=''" + reuseNode true + } + } + stages { + stage('Autosync') { + parameters { + string(name: 'MARKDOWN', defaultValue: 'md_profiles', description: 'Markdown path to use') + string(name: 'MODEL', defaultValue: 'profile', description: 'OSCAL model to author') + } + steps { + sh 'trestlebot-autosync --markdown-path=${params.MARKDOWN} --oscal-model=${params.MODEL} ' + } + } + } +} +``` +