PlanSpec.java edited online with Bitbucket
This commit is contained in:
parent
d36e5d8dce
commit
bf3a87f710
@ -37,14 +37,10 @@ public class PlanSpec {
|
||||
|
||||
Plan buildPlan = new PlanSpec().createDockerBuildPlan();
|
||||
bambooServer.publish(buildPlan);
|
||||
Plan testPlan = new PlanSpec().createCypressTestPlan();
|
||||
bambooServer.publish(testPlan);
|
||||
|
||||
PlanPermissions buildPlanPermissions = new PlanSpec().createPlanPermission(buildPlan.getIdentifier());
|
||||
bambooServer.publish(buildPlanPermissions);
|
||||
|
||||
PlanPermissions testPlanPermissions = new PlanSpec().createPlanPermission(testPlan.getIdentifier());
|
||||
bambooServer.publish(testPlanPermissions);
|
||||
}
|
||||
|
||||
private PlanPermissions createPlanPermission(PlanIdentifier planIdentifier) {
|
||||
@ -54,60 +50,27 @@ public class PlanSpec {
|
||||
.userPermissions("tbejan", PermissionType.ADMIN, PermissionType.EDIT, PermissionType.VIEW,
|
||||
PermissionType.CLONE, PermissionType.BUILD)
|
||||
.userPermissions("dbarbu", PermissionType.VIEW, PermissionType.CLONE, PermissionType.BUILD)
|
||||
.userPermissions("aispas", PermissionType.VIEW, PermissionType.CLONE, PermissionType.BUILD)
|
||||
.loggedInUserPermissions(PermissionType.VIEW).anonymousUserPermissionView();
|
||||
return new PlanPermissions(planIdentifier.getProjectKey(), planIdentifier.getPlanKey()).permissions(permission);
|
||||
}
|
||||
|
||||
private Project project() {
|
||||
return new Project().name("GCPIM").key(new BambooKey("GCPIM"));
|
||||
}
|
||||
|
||||
public Plan createCypressTestPlan() {
|
||||
|
||||
return new Plan(project(), "instantli-webapp-ui-tests", new BambooKey("GINCYPRESS"))
|
||||
.description("Cypress UI tests for gin-cloud-platform.")
|
||||
.stages(new Stage("UI Test Stage").jobs(createCypressJob("cypress")))
|
||||
.linkedRepositories("gin-cloud-platform").triggers(new BitbucketServerTrigger()).planBranchManagement(
|
||||
new PlanBranchManagement().createForVcsBranch()
|
||||
.delete(new BranchCleanup().whenInactiveInRepositoryAfterDays(30)).notificationForCommitters());
|
||||
return new Project().name("RED").key(new BambooKey("RED"));
|
||||
}
|
||||
|
||||
public Plan createDockerBuildPlan() {
|
||||
return new Plan(project(), "instantli-webapp-images", new BambooKey("GINCPN"))
|
||||
return new Plan(project(), "instantli-webapp-images", new BambooKey("REDUI"))
|
||||
.description("Docker build for gin-cloud-platform.").stages(
|
||||
new Stage("Build Stage").jobs(creatGinCloudPlatformImagesJob("weaver"))
|
||||
.jobs(creatGinCloudPlatformImagesJob("database-modeler"))
|
||||
.jobs(creatGinCloudPlatformImagesJob("landing-page"))
|
||||
.jobs(creatGinCloudPlatformBrowserExtentionImagesJob("browser-extension")))
|
||||
.stages(new Stage("Upstream Push Stage").jobs(creatGinCloudPlatformUpstreamJob()))
|
||||
.linkedRepositories("gin-cloud-platform").triggers(new BitbucketServerTrigger()).planBranchManagement(
|
||||
.linkedRepositories("RED / ui").triggers(new BitbucketServerTrigger()).planBranchManagement(
|
||||
new PlanBranchManagement().createForVcsBranch()
|
||||
.delete(new BranchCleanup().whenInactiveInRepositoryAfterDays(30)).notificationForCommitters());
|
||||
}
|
||||
|
||||
private Job createCypressJob(String project) {
|
||||
return new Job("Cypress Job: " + project, new BambooKey(project.toUpperCase().replaceAll("-", ""))).tasks(
|
||||
new VcsCheckoutTask().description("Checkout Default Repository")
|
||||
.checkoutItems(new CheckoutItem().defaultRepository()),
|
||||
|
||||
new ScriptTask().description("Build").inlineBody(
|
||||
"#!/bin/bash\n" + "set -e\n" + "imageName=\"nexus.iqser.com:5001/gin5/gcp-" + project + "\"\n"
|
||||
+ "dockerfileLocation=\"build/docker/" + project + "/Dockerfile\"\n"
|
||||
+ "docker build -t ${imageName}:latest -f ${dockerfileLocation} .\n"),
|
||||
new ScriptTask().description("Run Tests").inlineBody(
|
||||
"#!/bin/bash\n" + "set -e\n" + "imageName=\"nexus.iqser.com:5001/gin5/gcp-" + project + "\"\n"
|
||||
+ "docker run -v $PWD:/e2e -w /e2e ${imageName}:latest\n" + "sleep 10")
|
||||
// for some reason disk isn't synced in real-time from docker
|
||||
|
||||
).finalTasks(
|
||||
TestParserTask.createJUnitParserTask().description("Cypress Test Results").defaultResultDirectory())
|
||||
.dockerConfiguration(new DockerConfiguration().image("nexus.iqser.com:5001/infra/release_build:2.9.1")
|
||||
.volume("/var/run/docker.sock", "/var/run/docker.sock"))
|
||||
.artifacts(new Artifact("videos").location("./cypress/videos").copyPattern("**/*.mp4").shared(true),
|
||||
new Artifact("screenshots").location("./cypress/screenshots").copyPattern("**/*.png").shared(true));
|
||||
}
|
||||
|
||||
public Job creatGinCloudPlatformImagesJob(String project) {
|
||||
return new Job("Build Job: " + project, new BambooKey(project.toUpperCase().replaceAll("-", ""))).tasks(
|
||||
new VcsCheckoutTask().description("Checkout Default Repository")
|
||||
@ -157,7 +120,7 @@ public class PlanSpec {
|
||||
.inlineBody(
|
||||
"#!/bin/bash\n" + "set -e\n" + "if [[ \"${bamboo.planRepository.branchName}\" == \"master\" ]]\n"
|
||||
+ "then\n" + " ./versions.sh patch\n" + "fi\n"),
|
||||
new VcsCommitTask().commitMessage("chore(release)").repository("gin-cloud-platform")).dockerConfiguration(
|
||||
new VcsCommitTask().commitMessage("chore(release)").repository("RED / ui")).dockerConfiguration(
|
||||
new DockerConfiguration().image("nexus.iqser.com:5001/infra/release_build:2.9.1")
|
||||
.volume("/var/run/docker.sock", "/var/run/docker.sock"));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user