Troubleshoot
Issue | What to Do |
---|---|
Get help on the DSL methods |
To get the complete list of supported DSL methods, log into
To get help on a particular DSL method, enter the following command:
For example, to get help on the
Related topics: |
The DSL script completes successfully using the |
Log into
For example, to evaluate the
The To evaluate a DSL file (rather than a code snippet), enter:
For example, to debug a DSL file named
Related topics: |
ecTool evalDSL with |
The overwrite mode works correctly only for the format in which the DSL is exported by the property 'myPropSheet1', { myProp1 = 'myValue1' } property 'myPropSheet2', { myProp2 = 'myValue2' } |
FAQs
-
I am comfortable with Perl and already use the CloudBees CD/RO Perl API for scripting. Do I need to switch to CloudBees CD/RO DSL?
DSL is a dynamic scripting language to provide a cleaner and much easier syntax for non-technical users to understand. However, the CloudBees CD/RO Perl API and the REST API are supported as well, and you can continue to use them if they suit your scripting needs.
-
CloudBees CD/RO DSL is based on Groovy. Are all Groovy constructs available for use in a DSL script?
Yes, most Groovy constructs, such as closures, named arguments, and others, can be used in your DSL script.
-
How do I create a DSL script for the CloudBees CD/RO objects that I have created through the UI or using the CloudBees CD/RO Perl API?
You can use the
generateDsl
command to create a DSL script for any CloudBees CD/RO object, as shown below.ectool generateDsl /projects/Default/applications/MyApp
-
How do I create or update access control for an object?
Use one of the following patterns to define access control for objects in your DSL script. These patterns allow the DSL runtime engine to deterministically find the correct CloudBees CD/RO object for creating or updating access control entries (ACEs).
-
Nest access control entries inside the DSL method of the object for which the access control is being defined. For example, the following script provides the user named " joe " full access to project called Foo .
project 'Foo', { aclEntry principalName: 'joe', principalType: 'user', readPrivilege: 'allow', modifyPrivilege: 'allow', changePermissionsPrivilege: 'allow' }
-
Use the
objectType
argument to declare the type of object for which the access control is being defined if the access control method is not enclosed within the DSL method for the object. This can be used to define ACEs for objects such as server and other system objects because they do not have a DSL method similar to other regular objects.// Removing any previously set ACL for 'Everyone' deleteAclEntry ( principalType: 'group', principalName: 'Everyone', objectType : 'server', systemObjectName : 'server' ) aclEntry principalName: 'joe', principalType: 'user', objectType : 'server', systemObjectName : 'server', readPrivilege: 'allow', modifyPrivilege: 'allow', changePermissionsPrivilege: 'allow'
or
aclEntry principalName: 'joe', principalType: 'user' objectType : 'systemObject', systemObjectName : 'resources', readPrivilege: 'allow', modifyPrivilege: 'allow', changePermissionsPrivilege: 'allow'
-
-
How do I deal with multibyte characters in DSL files?
DSL files containing multibyte characters must be encoded in UTF-8 to be CloudBees CD/RO-compatible. DSL files generated by CloudBees CD/RO are in UTF-8 by default, but if you are using a file that was created outside of CloudBees CD/RO, you must ensure that the encoding is in UTF-8.
Convert the encoding for a DSL file to UTF-8 via a text editor that is capable of doing the conversion, such as Notepad++. To ensure proper encoding you can either:
-
Open the DSL Editor in the CloudBees CD/RO UI and paste in the file’s contents to see if the characters rendered properly (and then use the text editor to make corrections if needed).
-
Run
ectool evalDsl --dslFile <filename>.dsl
and check the console output forunexpected char
errors (and then use the text editor to make corrections if needed).
-
-
Why is
evalDsl
returning aNo signature of method: dsl.myMethod()..
error wheremyMethod
is a dynamic method added to the outer closure’s metaclass?As of CloudBees CD/RO version 10.10 when using nested closures with dynamic methods added to the
outer closure
metaclass, the DSL script evaluation fails with aNo signature of method: dsl.<dynamic-method>() is applicable for argument types
error.Example scriptError messageef myClosure = { foo('outer closure bar value') def myInnerClosure = { foo('inner closure bar value') } myInnerClosure() } myClosure.getMetaClass().foo << { String bar -> println(bar) } myClosure()
$> ectool evalDsl --dslFile test.dsl ectool error [InvalidScript]: Invalid DSL object at line 4: 'foo' Details: No signature of method: dsl.foo() is applicable for argument types: (String) values: [inner closure bar value] Possible solutions: run(), run(), any(), find(), find(groovy.lang.Closure), use([Ljava.lang.Object;)
The above
evalDsl
error is due to a change in behavior of GroovyInterceptable, version 3.0.9. ec-groovy or ec-perl are not affected because GroovyInterceptable is used internally byevalDsl
.Solutions:
-
Change the resolve strategy for the inner closure.
myInnerClosure.resolveStrategy = Closure.DELEGATE_FIRST
-
Use the
ExpandoMetaClass.enableGlobally()
method.Using this option will result in higher memory usage, which will impact performance. Refer to the Groovy ExpandoMetaClass documentation for more information. ExpandoMetaClass.enableGlobally()
-