Jenkinsfile load groovy file doesn't work as expected

752 views Asked by At

I have a Jenkinsfile with the following :

node('buildprod_iamsg'){

              echo "\u001B[34mSending status to dynamodb pib-deployments ...\u001B[0m"
              checkout scm
              def dynamo = load "aws/dynamo.groovy"
              dynamo.add_metadata(substring, stripped_env, "down", lz, slackChannelName, slackToken, awsAccount, stack, ldapCommaSepList, githuburl, approver_name, time)
              echo "\u001B[34mJob status sent to dynamodb pib-deployments\u001B[0m"
}

When I execute this It seems to checkout scm but then doesn't print anything. after and exits out. Inside my dynamo.groovy I have :

public add_metadata(substring, stripped_env, statuss, lz, slackChannelName, awsAccount, stack, ldapCommaSepList, githuburl, approver_name, time){
    echo "reached here"
    //--projection-expression lz
    def expression_attribute_values = readFile("expression_attribute_values.json").trim()
    echo expression_attribute_values
    parseralgo(expression_attribute_values)
    }

heres the result of execution :

Running on build_iamsg in /home/jenkins/workspace/djin_aweb_sample
[Pipeline] {
[Pipeline] echo
Sending status to dynamodb pib-deployments ...
[Pipeline] checkout
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://githubnet/djin-productivity/Deptwo.0.git/ # timeout=10
Fetching upstream changes from https://githubnet/djin-productivity/Deptwo.0.git/
 > git --version # timeout=10
 > git fetch --tags --progress https://githubnet/djin-productivity/Deptwo.0.git/ +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/dbint^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/dbint^{commit} # timeout=10
Checking out Revision 7daa4d196eafe4698f941f01631f5ccb13947793 (refs/remotes/origin/dbint)
Commit message: "adding dynamo integration with groovy load"
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 7daa4d196eafe4698f941f01631f5ccb13947793
[Pipeline] load
[Pipeline] { (aws/dynamo.groovy)
[Pipeline] }
[Pipeline] // load
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // timeout
[Pipeline] // wrap
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: UNSTABLE

doesn't print reached here or the statement after in my jenkinsfile which is Job status sent to dynamodb pib-deployments

1

There are 1 answers

0
Kelrak On

By the looks of it I think you forgot to add the slackToken parameter in your groovy script.

public add_metadata(substring, stripped_env, statuss, lz, slackChannelName, awsAccount, stack, ldapCommaSepList, githuburl, approver_name, time){