Hi,
You don’t need to export to use them across your jobs,
project.globals.AUTH_TOKEN=mytoken
.echo ${globals.AUTH_TOKEN}
(command steps) or echo @globals.AUTH_TOKEN@
(inline scripts).Now, if you want to create “truly global variables” (across all projects), you can add them to the framework.properties
file, take a look at this.
Greetings.
--
You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/SyCcu1Pv09I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/1a7f4dcf-f7bd-4155-8227-d19acbe9f058n%40googlegroups.com.
I see,
A good way is to call your python script from the “Script file or URL” and call the globals directly using the RD_GLOBALS_MYGLOBAL
format (similar to “external bash scripts” ), clicking on the “advanced” link you can set the full python 3 path, and .ps1
as the file extension.
I made an example:
I created the global variable in the “project.properties” config, e.g: project.globals.AUTH_TOKEN=mytoken
.
I used this job:
- defaultTab: nodes
description: ''
executionEnabled: true
id: 18982e00-7ab7-4d89-98bc-46404b96360b
loglevel: INFO
name: PythonEXAMPLE
nodeFilterEditable: false
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- exec: echo ${globals.AUTH_TOKEN}
- fileExtension: .pl
interpreterArgsQuoted: false
scriptInterpreter: /usr/bin/python3
scriptfile: /Users/user/Downloads/printenv.pl
keepgoing: false
strategy: node-first
uuid: 18982e00-7ab7-4d89-98bc-46404b96360b
The job calls this printenv.pl
python 3 script:
import os
print(os.environ['RD_GLOBALS_AUTH_TOKEN'])
In that way, you can avoid the “export” extra step.
Regards!