How to setup SCM via rd CLI

262 views
Skip to first unread message

Paulo Motta

unread,
Sep 3, 2023, 9:30:13 PM9/3/23
to rundeck-discuss
Hello, 

New to Rundeck here. I'd like to automate the process of setting up SCM for my projects.
I have installed the rd CLI, have a token and are able to use it. 
I'd like to keep the configuration in a file and pass as an argument:

rd projects configure set -p <myproject> -f <myconfigfile>

I can't seem to find informatio on what the input file should look like.

Thanks for any help.

rac...@rundeck.com

unread,
Sep 4, 2023, 8:59:27 AM9/4/23
to rundeck-discuss

Hi,

You can create a “SCM template” in json format and then use it on your projects.

  1. Get the config (import in this case):

rd projects scm config -p ProjectEXAMPLE -i=import -f=myfile.json

This generates a json file like the following one:

{ "config": { "strictHostKeyChecking": "yes", "gitPasswordPath": "keys/gitpasswd", "format": "xml", "dir": "/home/rundeck/projects/ProjectEXAMPLE/ScmImport", "branch": "master", "url": "http://user@git:8080/git/root/myrepo.git", "filePattern": ".*\\.xml", "useFilePattern": "true", "pathTemplate": "${job.id}.${config.format}", "importUuidBehavior": "preserve", "sshPrivateKeyPath": "", "fetchAutomatically": "true", "pullAutomatically": "true" } }

Edit the “dir” path to set a new directory:

{ "config": { "strictHostKeyChecking": "yes", "gitPasswordPath": "keys/gitpasswd", "format": "xml", "dir": "/home/rundeck/projects/NewProject/ScmImport", "branch": "master", "url": "http://user@git:8080/git/root/myrepo.git", "filePattern": ".*\\.xml", "useFilePattern": "true", "pathTemplate": "${job.id}.${config.format}", "importUuidBehavior": "preserve", "sshPrivateKeyPath": "", "fetchAutomatically": "true", "pullAutomatically": "true" } }
  1. Then, you can use that “template” on your “NewProject” project:

rd projects scm setup -p NewProject -i=import -f=myfile.json -t=git-import

Of course, you can create an script to automate this.

Hope it helps!

Paulo Motta

unread,
Sep 5, 2023, 9:48:45 AM9/5/23
to rundeck-discuss
Thank you! Worked like a charm/

Paulo Motta

unread,
Sep 5, 2023, 9:31:23 PM9/5/23
to rundeck-discuss
Actually, I get the following error message:

# WARNING: RD_INSECURE_SSL=true, no hostname or certificate trust verification will be performed
Setup config Validation for file: /Data/rundeck/scm_templates/windows_scm_config.json failed
Some input values were not valid.

rac...@rundeck.com

unread,
Sep 6, 2023, 8:06:20 AM9/6/23
to rundeck-discuss
Hi, the first line it's just a warning (becuase RD_INSECURE_SSL=true, check this). About the JSON  file validation, it seems that exist some integrity problem with the file, could you double check if the generated file is valid? Could you post a reproducible example?

Regards.

Paulo Motta

unread,
Sep 9, 2023, 10:34:57 AM9/9/23
to rundeck-discuss
The problem was on my side, I did not have the property "useFilePattern":"true" configured. 
Thanks for the help!

Reply all
Reply to author
Forward
0 new messages