I'm having a TON of problems getting the pipeline system setup and working.
One issue in particular is troubling me. I have a shared library that has a
custom step in vars/publishToS3.groovy. It looks like this:
#!/usr/bin/env groovy
package com.seven10;
def call(hashmap){
def src_file = hashmap['src_file']
def target_path = hashmap['target_path']
def bucket_name = hashmap.get('bucket_name', '...')
def region = hashmap.get('region', '...')
def credentials = hashmap.get('credentials', '...')
withAWS(credentials: credentials, region: region) {
s3Upload bucket: bucket_name, file: src_file, path: target_path
}
}
But I kept getting weird errors in my build job (like
'groovy.lang.MissingPropertyException:
No such property: publish for class: groovy.lang.Binding') So in order to
attempt to debug it, I created the following script in the script console.
def call(hashmap){
def src_file = hashmap['src_file']
def target_path = hashmap['target_path']
def bucket_name = hashmap.get('bucket_name', '...')
def region = hashmap.get('region', '...')
def credentials = hashmap.get('credentials', '...')
try {
withAWS(credentials: credentials, region: region) {
try {
s3Upload(bucket: bucket_name, file: src_file, path: target_path)
}
catch(error){
println('inner-try: ' + error)
throw error
}
}
}
catch(error){
println('outer-try: ' + error)
}
}
call src_file: 'blah', target_path: 'blahblah'
But when I execute this script I get the error:
outer-try: groovy.lang.MissingMethodException: No signature of method:
Script1.withAWS() is applicable for argument types: (java.util.LinkedHashMap,
Script1$_call_closure1) values: [[credentials:..., region:...],
Script1$_call_closure1@47e8f461] Possible solutions: with(groovy.lang.Closure)
The docs for the withAWS step show it being called with a closure block in just
this way (see here <https://github.com/jenkinsci/pipeline-aws-plugin#withaws>).
The only other thing I can think of is that its not actually finding the
withAWS step (as demonstrated by the fact that it is called "Script1.withAWS")
if thats the case, how would I make sure its finding the actual plugin step
instead of trying to find a local variable?
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/30eea0d8-10a5-4fce-b050-3064c2c475fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.