スクリプト化された Jenkinsfile 内からビルドが実行された原因を特定する方法を見つけようとしています。その理由は、cron ジョブで実行したい docker コンテナーにスクリプトがあるためです。したがって、cron ジョブがトリガーされたときにコンテナーを実行するだけで、変更をプッシュするときに、それをチェックアウトしたいのです。コードを作成し、コンテナーを再構築し、静的コード分析を実行し、テストを実行します。cron の実行では、そのすべてを行う必要はありません。
どうすれば原因をつかむことができますか?試してみcurrentBuild.getCauses()
ましたが、得られます
groovy.lang.MissingMethodException: No signature of method: org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getCauses() is applicable for argument types: () values: []
私は試しprintln currentBuild.getRawBuild().getCauses()
ましたが、得ました
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild
jenkinsfile でビルドの原因を特定するにはどうすればよいですか?