use of hudson.plugins.copyartifact.CopyArtifact in project copyartifact-plugin by jenkinsci.
the class LegacyJobConfigMigrationMonitorTest method setupAnonymousJob.
private void setupAnonymousJob() throws Exception {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
MockAuthorizationStrategy auth = new MockAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
FreeStyleProject toBeCopied = j.createFreeStyleProject("to-be-copied");
auth.grant(Item.READ).onItems(toBeCopied).toEveryone();
toBeCopied.getBuildersList().add(new FileWriteBuilder("test.txt", "test"));
toBeCopied.getPublishersList().add(new ArtifactArchiver("**"));
FreeStyleProject copier = j.createFreeStyleProject("copier");
copier.getBuildersList().add(new CopyArtifact(toBeCopied.getFullName()));
}
use of hudson.plugins.copyartifact.CopyArtifact in project copyartifact-plugin by jenkinsci.
the class LegacyJobConfigMigrationMonitorMigrationTest method migrate_freestyle_to_freestyle.
@Test
public void migrate_freestyle_to_freestyle() throws Exception {
FreeStyleProject src = j.createFreeStyleProject();
src.getBuildersList().add(new FileWriteBuilder("artifact.txt", "artifact content"));
src.getPublishersList().add(new ArtifactArchiver("**/*"));
j.assertBuildStatusSuccess(src.scheduleBuild2(0));
FreeStyleProject dst = j.createFreeStyleProject();
dst.getBuildersList().add(new CopyArtifact(src.getFullName()));
j.assertBuildStatusSuccess(dst.scheduleBuild2(0));
CopyArtifactConfiguration.get().setMode(CopyArtifactCompatibilityMode.PRODUCTION);
j.assertBuildStatus(Result.FAILURE, dst.scheduleBuild2(0));
assertTrue(applyAutoMigrationToAll());
j.assertBuildStatusSuccess(dst.scheduleBuild2(0));
}
use of hudson.plugins.copyartifact.CopyArtifact in project copyartifact-plugin by jenkinsci.
the class LegacyJobConfigMigrationMonitorMigrationTest method migrate_pipeline_to_maven.
@Test
public void migrate_pipeline_to_maven() throws Exception {
WorkflowJob src = j.createProject(WorkflowJob.class);
src.setDefinition(new CpsFlowDefinition("node {" + "writeFile(text: 'artifact', file: 'artifact.txt');" + "archiveArtifacts(artifacts: 'artifact.txt');" + "}", true));
j.assertBuildStatusSuccess(src.scheduleBuild2(0));
ToolInstallations.configureMaven3();
MavenModuleSet dst = j.createProject(MavenModuleSet.class);
dst.setScm(j.getExtractResourceScm(tempFolder, getClass().getResource("../maven-job")));
dst.setRunHeadless(true);
dst.setGoals("clean package -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8");
dst.getPrebuilders().add(new CopyArtifact(src.getFullName()));
j.assertBuildStatusSuccess(dst.scheduleBuild2(0));
CopyArtifactConfiguration.get().setMode(CopyArtifactCompatibilityMode.PRODUCTION);
j.assertBuildStatus(Result.FAILURE, dst.scheduleBuild2(0));
assertTrue(applyAutoMigrationToAll());
j.assertBuildStatusSuccess(dst.scheduleBuild2(0));
}
use of hudson.plugins.copyartifact.CopyArtifact in project copyartifact-plugin by jenkinsci.
the class LegacyJobConfigMigrationMonitorMigrationTest method migrate_pipeline_to_matrix.
@Test
public void migrate_pipeline_to_matrix() throws Exception {
WorkflowJob src = j.createProject(WorkflowJob.class);
src.setDefinition(new CpsFlowDefinition("node {" + "writeFile(text: 'artifact', file: 'artifact.txt');" + "archiveArtifacts(artifacts: 'artifact.txt');" + "}", true));
j.assertBuildStatusSuccess(src.scheduleBuild2(0));
MatrixProject dst = j.createProject(MatrixProject.class);
AxisList axisList = new AxisList(new Axis("axis1", "value1", "value2"));
dst.setAxes(axisList);
dst.getBuildersList().add(new CopyArtifact(src.getFullName()));
j.assertBuildStatusSuccess(dst.scheduleBuild2(0));
CopyArtifactConfiguration.get().setMode(CopyArtifactCompatibilityMode.PRODUCTION);
j.assertBuildStatus(Result.FAILURE, dst.scheduleBuild2(0));
assertTrue(applyAutoMigrationToAll());
j.assertBuildStatusSuccess(dst.scheduleBuild2(0));
}
use of hudson.plugins.copyartifact.CopyArtifact in project copyartifact-plugin by jenkinsci.
the class LegacyJobConfigMigrationMonitorTest method setupRestrictedJob.
private void setupRestrictedJob() throws Exception {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
MockAuthorizationStrategy auth = new MockAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
FreeStyleProject toBeCopied = j.createFreeStyleProject("to-be-copied");
auth.grant(Item.READ).onItems(toBeCopied).to("admin");
toBeCopied.getBuildersList().add(new FileWriteBuilder("test.txt", "test"));
toBeCopied.getPublishersList().add(new ArtifactArchiver("**"));
FreeStyleProject copier = j.createFreeStyleProject("copier");
copier.getBuildersList().add(new CopyArtifact(toBeCopied.getFullName()));
}
Aggregations