use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class ArtifactoryPluginTest method gradle_integration.
@Test
@WithPlugins("gradle")
@Ignore
@Issue("JENKINS-39323")
public void gradle_integration() {
final ArtifactoryContainer artifactory = artifactoryContainer.get();
waitForArtifactory(artifactory);
configureArtifactory(artifactory);
GradleInstallation.installGradle(jenkins, "gradle 2.0", "2.0");
FreeStyleJob job = jenkins.jobs.create();
job.copyDir(resource("/artifactory_plugin/quickstart"));
ArtifactoryGradleConfiguratior gradleConfig = new ArtifactoryGradleConfiguratior(job);
gradleConfig.refresh();
GradleStep gradle = job.addBuildStep(GradleStep.class);
gradle.setVersion("gradle 2.0");
// gradle.tasks.set("build --stacktrace --debug");
gradle.setTasks("build");
job.save();
Build build = job.startBuild().shouldSucceed();
String log = build.getConsole();
assertThat(log, containsString("build artifactoryPublish"));
assertThat(log, containsString("[buildinfo]"));
assertThat(log, containsString("Deploying artifact"));
assertThat(log, containsRegexp("Deploying build (info|descriptor) to: " + artifactory.getURL() + "/api/build"));
}
use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_job_parameters_as_project_properties.
@Test
public void run_gradle_job_parameters_as_project_properties() {
GradleInstallation.installGradle(jenkins);
final FreeStyleJob job = jenkins.jobs.create();
job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
job.addParameter(StringParameter.class).setName("PROJ_PARAM_1").setDefault("hello");
job.addParameter(StringParameter.class).setName("SYS_PARAM_1").setDefault("hello");
final GradleStep step = job.addBuildStep(GradleStep.class);
step.setVersion(GradleInstallation.DEFAULT);
step.setTasks("jobParametersAsProjectProperties jobParametersAsSystemProperties");
step.setProjectProperties("PROJ_PARAM_2=world");
step.setSystemProperties("SYS_PARAM_2=world");
step.setPassAllAsProjectProperties();
step.setPassAllAsSystemProperties();
step.setSwitches("--no-daemon");
job.save();
final Build build = job.startBuild().shouldSucceed();
assertThat(build.getConsole(), containsString("Project Properties: hello world"));
assertThat(build.getConsole(), containsString("System Properties: hello world"));
}
use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_script.
@Test
public void run_gradle_script() {
GradleInstallation.installGradle(jenkins);
FreeStyleJob job = jenkins.jobs.create();
job.copyResource(resource(GRADLE_SCRIPT), "gradle/hello.gradle");
GradleStep step = job.addBuildStep(GradleStep.class);
step.setFile("hello.gradle");
step.setVersion(GradleInstallation.DEFAULT);
step.setTasks("environmentVariables");
step.setDir("gradle");
step.setSwitches("--quiet --no-daemon");
job.save();
final Build build = job.startBuild();
build.shouldSucceed();
assertThat(build.getConsole(), containsRegexp("gradle.* --quiet"));
assertThat(build.getConsole(), containsString("Build Number: " + build.getNumber()));
assertThat(build.getConsole(), containsString("Build Name: " + build.getName()));
}
use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_with_switches.
/**
* Verify the execution of gradle build script with switch parameter.
*/
@Test
public void run_gradle_with_switches() {
GradleInstallation.installGradle(jenkins);
final FreeStyleJob job = jenkins.jobs.create();
job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
final GradleStep step = job.addBuildStep(GradleStep.class);
step.setVersion(GradleInstallation.DEFAULT);
step.setSwitches("--quiet");
step.setTasks(FIRST.getName() + " " + SECOND.getName());
job.save();
final Build build = job.startBuild().shouldSucceed();
assertThat(build.getConsole(), containsRegexp("gradle.* --quiet"));
assertThat(build.getConsole(), containsString(SUCCESSFUL_BUILD));
}
use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_add_project_properties.
/**
* Verify the execution of gradle build script with committed gradle project properties.
*/
@Test
public void run_gradle_add_project_properties() {
GradleInstallation.installGradle(jenkins);
final FreeStyleJob job = jenkins.jobs.create();
job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
final GradleStep step = job.addBuildStep(GradleStep.class);
step.setVersion(GradleInstallation.DEFAULT);
step.setProjectProperties("TEST_PARAM_1=hello\nTEST_PARAM_2=world");
step.setTasks(JOB_PARAM_AS_PROJECT_PROPERTIES.getName());
job.save();
final Build build = job.startBuild().shouldSucceed();
assertThat(build.getConsole(), containsString("Gradle Properties: hello world"));
}
Aggregations