use of com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testJobRename.
public void _testJobRename() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, "CI_TYPE = 'code-quality-checks-done' and CI_STATUS = 'failed'"))), jobA);
jobA.getBuildersList().add(new Shell("echo CI_TYPE = $CI_TYPE"));
Thread.sleep(1000);
jobA.renameTo("ABC");
Thread.sleep(3000);
assertThat("Trigger not subscribed", isSubscribed("ABC"));
}
use of com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithRegExpCheck.
public void _testSimpleCIEventTriggerWithRegExpCheck() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck("$.compose.compose_id", "Fedora-Atomic.+")))), jobA);
jobA.getBuildersList().add(new Shell("echo job ran"));
jobA.getBuildersList().add(new Shell("echo CI_MESSAGE = $CI_MESSAGE"));
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, null, "{ \"compose\": { \"compose_id\": \"Fedora-Atomic-25-20170105.0\" } }")));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("echo job ran", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithPipelineSendMsg.
public void _testSimpleCIEventTriggerWithPipelineSendMsg() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new Shell("echo CI_TYPE = $CI_TYPE"));
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, "CI_TYPE = 'code-quality-checks-done' and CI_STATUS = 'failed'"))), jobA);
WorkflowJob job = j.jenkins.createProject(WorkflowJob.class, "job");
job.setDefinition(new CpsFlowDefinition("node('master') {\n def message = sendCIMessage " + " providerName: '" + DEFAULT_PROVIDER_NAME + "', " + " messageContent: '', " + " messageProperties: 'CI_STATUS = failed'," + " messageType: 'CodeQualityChecksDone'}\n", true));
j.buildAndAssertSuccess(job);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTrigger.
public void _testSimpleCIEventTrigger() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, "CI_TYPE = 'code-quality-checks-done' and CI_STATUS = 'failed'"))), jobA);
jobA.getBuildersList().add(new Shell("echo CI_TYPE = $CI_TYPE"));
FreeStyleProject jobB = j.createFreeStyleProject();
jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "CI_STATUS = failed", null)));
j.buildAndAssertSuccess(jobB);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("echo CI_TYPE = code-quality-checks-done", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.CIBuildTrigger in project jms-messaging-plugin by jenkinsci.
the class JMSMessagingWorker method trigger.
public void trigger(String jobname, String messageSummary, Map<String, String> params) {
CIBuildTrigger trigger = findTrigger(jobname);
if (trigger != null) {
log.info("Scheduling job '" + jobname + "' based on message:\n" + messageSummary);
trigger.scheduleBuild(params);
} else {
log.log(Level.WARNING, "Unable to find CIBuildTrigger for '" + jobname + "'.");
}
}
Aggregations