Jenkinsfile加载groovy文件无法按预期工作

时间:2017-09-08 19:18:30

标签: jenkins groovy jenkins-pipeline jenkins-declarative-pipeline

我有一个Jenkins文件,其中包含以下内容:

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)
    }

当我执行此操作时似乎结帐了scm,但之后没有打印任何内容。之后退出。在我的dynamo.groovy里面,我有:

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

继承执行结果:

public static class

不打印到此处或我的jenkins文件中的语句后面的作业状态发送到dynamodb pib-deployments

1 个答案:

答案 0 :(得分:0)

根据它的外观,我想你忘了在你的groovy脚本中添加slackToken参数。

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