如何编写Bamboo构造脚本以调用REST端点

问题描述

我有这个端点

@RequestMapping(value = "/refresh")
public DataSource getMostRecentData() {
    return s3DataStoreService.getMostRecentSource();
}

我想知道是否有可能编写一个击中此端点的Bamboo脚本,作为构建项目的构建任务的一部分。我是Bamboo的新手,所以即使是开始如何做我也将不胜感激。 谢谢。

解决方法

您可以使用“脚本”任务并使用curl或类似方法进行REST调用。您还可以在远程服务器上使用自定义脚本,然后从Bamboo上执行它。如果您在PlanSpec.java文件中有您的计划,则可以有method,它像这样:

private ScriptTask executeREST() {
        return new ScriptTask()
                .description("execute my rest endpoint")
                .inlineBody("curl call to your endpoint");
    }