我正在为构建计划编写Bamboo Specs,我正在尝试从bitbucket克隆存储库。这是我的Java规范代码
update
my_entity
set
field=field+1
where
id=?"
错误:
package tutorial;
import com.atlassian.bamboo.specs.api.BambooSpec;
import com.atlassian.bamboo.specs.api.builders.AtlassianModule;
import com.atlassian.bamboo.specs.api.builders.BambooKey;
import com.atlassian.bamboo.specs.api.builders.BambooOid;
import com.atlassian.bamboo.specs.api.builders.Variable;
import com.atlassian.bamboo.specs.api.builders.applink.ApplicationLink;
import com.atlassian.bamboo.specs.api.builders.permission.PermissionType;
import com.atlassian.bamboo.specs.api.builders.permission.Permissions;
import com.atlassian.bamboo.specs.api.builders.permission.PlanPermissions;
import com.atlassian.bamboo.specs.api.builders.plan.Job;
import com.atlassian.bamboo.specs.api.builders.plan.Plan;
import com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier;
import com.atlassian.bamboo.specs.api.builders.plan.Stage;
import com.atlassian.bamboo.specs.api.builders.plan.artifact.Artifact;
import com.atlassian.bamboo.specs.api.builders.plan.artifact.ArtifactSubscription;
import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup;
import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement;
import com.atlassian.bamboo.specs.api.builders.plan.configuration.AllOtherPluginsConfiguration;
import com.atlassian.bamboo.specs.api.builders.plan.configuration.ConcurrentBuilds;
import com.atlassian.bamboo.specs.api.builders.project.Project;
import com.atlassian.bamboo.specs.api.builders.repository.VcsChangeDetection;
import com.atlassian.bamboo.specs.api.builders.task.AnyTask;
import com.atlassian.bamboo.specs.builders.repository.bitbucket.server.BitbucketServerRepository;
import com.atlassian.bamboo.specs.builders.repository.viewer.BitbucketServerRepositoryViewer;
import com.atlassian.bamboo.specs.builders.task.CheckoutItem;
import com.atlassian.bamboo.specs.builders.task.CommandTask;
import com.atlassian.bamboo.specs.builders.task.MsBuildTask;
import com.atlassian.bamboo.specs.builders.task.ScriptTask;
import com.atlassian.bamboo.specs.builders.task.VcsCheckoutTask;
import com.atlassian.bamboo.specs.builders.trigger.BitbucketServerTrigger;
import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties;
import com.atlassian.bamboo.specs.util.BambooServer;
import com.atlassian.bamboo.specs.util.MapBuilder;
import com.atlassian.bamboo.specs.api.builders.deployment.*;
/**
* Plan configuration for Bamboo.
* Learn more on: <a href="https://confluence.atlassian.com/display/BAMBOO/Bamboo+Specs">https://confluence.atlassian.com/display/BAMBOO/Bamboo+Specs</a>
*/
@BambooSpec
public class PlanSpec {
/**
* Run main to publish plan on Bamboo
*/
public static void main(final String[] args) throws Exception {
//By default credentials are read from the '.credentials' file.
BambooServer bambooServer = new BambooServer("http://localhost:8085");
Plan plan = new PlanSpec().createPlan();
Deployment deploy = new PlanSpec().createDeployment();
bambooServer.publish(plan);
bambooServer.publish(deploy);
PlanPermissions planPermission = new PlanSpec().createPlanPermission(plan.getIdentifier());
bambooServer.publish(planPermission);
}
PlanPermissions createPlanPermission(PlanIdentifier planIdentifier) {
Permissions permission = new Permissions()
.groupPermissions("bamboo-admin", PermissionType.ADMIN)
.anonymousUserPermissionView();
return new PlanPermissions(planIdentifier.getProjectKey(), planIdentifier.getPlanKey()).permissions(permission);
}
Project project = new Project().name("Bamboo Specs").key("DRAGON");
Plan createPlan() {
return new Plan(
project,
"Java Specs Plan 2", "JSPTT2")
.description("Plan created from (enter repository url of your plan)")
.planRepositories(new BitbucketServerRepository()
.name("New Pattern Playbook")
.repositoryViewer(new BitbucketServerRepositoryViewer())
.server(new ApplicationLink()
.name("Bitbucket")
.id("bca01bef-a3d8-3da3-9187-91b73d0f1f77"))
.projectKey("ALM")
.repositorySlug("pattern.dotnet")
.sshPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2ETaXXCvEeZqcJWxybcMA91jiskcjrh5PB2UqLNenhiGRdh2kZBUgBMur/JsBYzFF2tNTlWdOXW1oRhSQ38PeUGXVRg3pMR5mxvOO/K/wO1DB6ZqjzRgwLFBJJMqCk58I213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9eHiZcR8/KA6RhcHjwjydKe+cD0M/asoA/l1AcaquO\ngpllhs00+YqAmIUZT17xTlP77DCiMfFP71mwOAUUb68zih8bSrf/dBsCgYEA1rE0\nIuM46bLq9ru5deatl6N3RR0uX8qZaIg8S1ur7O3rTgWUvsmvVkSgHHOEPawcuioQ\n4HbLeMIVcA3roxGV9TD+uG0qGtv3G6ZUJ/izdNi5czp1N/XCMtagjWe2G33FscTT\neugQIbSRGOehimPtJsOuPMscAbDroChYwJLQizECgYBjDaiOBKT0mlovTnYaRBFN\n/rKnj0iKefKRdxMYZntG/jZ3+uJoYXfX/JYga3lT8S0PDF2Ny0RME6HPw9Tq9wXH\nL6M9vBCWYGj9q2P0TEIOm7FoCqdMjEYTlIXcQZjgGq+d52yq6DjVckBJfc8jVmUQ\nYi2jAb5XTusHJDZBmz407QKBgQCoCyHU4OeuPKYfJAbhWwKrO37isRmYTvtOz7vp\n/EIQ/JT+h+3KfBDqxGJSgrSSlUITEVQObc2Lotam066J//zRY10tO/0F8wBzOviK\nJOdKYUye/bW8bHdp1Ybrx67Jy+NO5tHlVPkzeKNNzBgsO1Tnz6h020H7rOBxhsMZ\nUJE9MQKBgDqRwfKmnBUcOElwvhQ1iH7aJL8zD5Ugbu0Xd72XUXcli1BcixvGdRyI\nWjnACbAVfPA/mcT8Ztto9uM/ZvH1rsAaqVnjKdxtlPYefuTff5QYUNWeR5C7FlJh\ntEJaTQdg/yXvnKpKCAtp+KJVfLyuRtuPwppR3yIGfpJNMYxUxHRb\n-----END RSA PRIVATE KEY-----\n")
.sshCloneUrl("ssh://git@stash-lab.cdk.com:7999/alm/pattern.dotnet.git")
.remoteAgentCacheEnabled(false)
.changeDetection(new VcsChangeDetection()))
.stages(new Stage("Stage 1")
.jobs(new Job("First Job","JOB1")
.tasks(new ScriptTask()
.inlineBody("echo Hello World")
)));
}
Deployment createDeployment() {
return new Deployment(new PlanIdentifier("DRAGON", "JSPTT"),
"Java Specs Plan Deployment")
.releaseNaming(new ReleaseNaming("release-1")
.autoIncrement(true))
.environments(new Environment("Java Specs environment")
.tasks(new ScriptTask().inlineBody("echo Hello world!")));
}
}
答案 0 :(得分:0)
我自己解决了。
解决方案:我正在使用Bamboo版本6.3.1并尝试使用仅与Bamboo 6.4及更高版本兼容的Bamboo Specs 6.4版本。
所以,我引用较旧的API参考来解决这个问题并且它有效。