Search in sources :

Example 6 with CIMessageNotifier

use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheck.

public void _testSimpleCIEventTriggerWithCheck() throws Exception {
    FreeStyleProject jobA = j.createFreeStyleProject();
    jobA.getBuildersList().add(new Shell("echo job ran"));
    attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), jobA);
    FreeStyleProject jobB = j.createFreeStyleProject();
    jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, null, MESSAGE_CHECK_CONTENT)));
    j.buildAndAssertSuccess(jobB);
    waitUntilScheduledBuildCompletes();
    j.assertBuildStatusSuccess(jobA.getLastBuild());
    j.assertLogContains("echo job ran", jobA.getLastBuild());
}
Also used : Shell(hudson.tasks.Shell) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) FreeStyleProject(hudson.model.FreeStyleProject) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)

Example 7 with CIMessageNotifier

use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheckOnPipelineJob.

public void _testSimpleCIEventTriggerWithCheckOnPipelineJob() throws Exception {
    WorkflowJob jobA = j.jenkins.createProject(WorkflowJob.class, "jobA");
    jobA.setDefinition(new CpsFlowDefinition("node('master') {\n sleep 10\n}", true));
    attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), jobA);
    FreeStyleProject jobB = j.createFreeStyleProject();
    jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, null, null, MESSAGE_CHECK_CONTENT)));
    j.buildAndAssertSuccess(jobB);
    waitUntilScheduledBuildCompletes();
    j.assertBuildStatusSuccess(jobA.getLastBuild());
}
Also used : CpsFlowDefinition(org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck) FreeStyleProject(hudson.model.FreeStyleProject)

Example 8 with CIMessageNotifier

use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerWithCheckWithTopicOverride.

public void _testSimpleCIEventTriggerWithCheckWithTopicOverride() throws Exception {
    FreeStyleProject jobA = j.createFreeStyleProject();
    jobA.getBuildersList().add(new Shell("echo job ran"));
    attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData("otopic", null, null, new MsgCheck(MESSAGE_CHECK_FIELD, MESSAGE_CHECK_VALUE)))), jobA);
    FreeStyleProject jobB = j.createFreeStyleProject();
    jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("otopic", null, null, MESSAGE_CHECK_CONTENT)));
    j.buildAndAssertSuccess(jobB);
    waitUntilScheduledBuildCompletes();
    j.assertBuildStatusSuccess(jobA.getLastBuild());
    j.assertLogContains("echo job ran", jobA.getLastBuild());
}
Also used : Shell(hudson.tasks.Shell) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) FreeStyleProject(hudson.model.FreeStyleProject) MsgCheck(com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)

Example 9 with CIMessageNotifier

use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventSubscribeWithTopicOverrideAndVariableTopic.

public void _testSimpleCIEventSubscribeWithTopicOverrideAndVariableTopic() throws Exception {
    FreeStyleProject jobA = j.createFreeStyleProject();
    jobA.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("MY_TOPIC", "my-topic", "")));
    jobA.getBuildersList().add(new CIMessageSubscriberBuilder(getSubscriberProviderData("$MY_TOPIC", "HELLO", "CI_TYPE = 'code-quality-checks-done'")));
    jobA.getBuildersList().add(new Shell("echo $HELLO"));
    scheduleAwaitStep(jobA);
    FreeStyleProject jobB = j.createFreeStyleProject();
    jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData("my-topic", MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "CI_STATUS = failed", "Hello World")));
    j.buildAndAssertSuccess(jobB);
    waitUntilScheduledBuildCompletes();
    j.assertBuildStatusSuccess(jobA.getLastBuild());
    j.assertLogContains("Hello World", jobA.getLastBuild());
}
Also used : Shell(hudson.tasks.Shell) StringParameterDefinition(hudson.model.StringParameterDefinition) ParametersDefinitionProperty(hudson.model.ParametersDefinitionProperty) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIMessageSubscriberBuilder(com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder) FreeStyleProject(hudson.model.FreeStyleProject)

Example 10 with CIMessageNotifier

use of com.redhat.jenkins.plugins.ci.CIMessageNotifier in project jms-messaging-plugin by jenkinsci.

the class SharedMessagingPluginIntegrationTest method _testSimpleCIEventTriggerOnPipelineJob.

public void _testSimpleCIEventTriggerOnPipelineJob() throws Exception {
    WorkflowJob jobA = j.jenkins.createProject(WorkflowJob.class, "jobA");
    jobA.setDefinition(new CpsFlowDefinition("node('master') {\n sleep 10\n}", true));
    attachTrigger(new CIBuildTrigger(false, Collections.singletonList(getSubscriberProviderData(null, null, "CI_TYPE = 'code-quality-checks-done' and CI_STATUS = 'failed'"))), jobA);
    FreeStyleProject jobB = j.createFreeStyleProject();
    jobB.getPublishersList().add(new CIMessageNotifier(getPublisherProviderData(null, MessageUtils.MESSAGE_TYPE.CodeQualityChecksDone, "CI_STATUS = failed", "Hello World")));
    j.buildAndAssertSuccess(jobB);
    waitUntilScheduledBuildCompletes();
    j.assertBuildStatusSuccess(jobA.getLastBuild());
}
Also used : CpsFlowDefinition(org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition) CIMessageNotifier(com.redhat.jenkins.plugins.ci.CIMessageNotifier) CIBuildTrigger(com.redhat.jenkins.plugins.ci.CIBuildTrigger) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) FreeStyleProject(hudson.model.FreeStyleProject)

Aggregations

CIMessageNotifier (com.redhat.jenkins.plugins.ci.CIMessageNotifier)35 FreeStyleProject (hudson.model.FreeStyleProject)34 CIBuildTrigger (com.redhat.jenkins.plugins.ci.CIBuildTrigger)23 Shell (hudson.tasks.Shell)23 MsgCheck (com.redhat.jenkins.plugins.ci.messaging.checks.MsgCheck)11 ParametersDefinitionProperty (hudson.model.ParametersDefinitionProperty)10 StringParameterDefinition (hudson.model.StringParameterDefinition)10 CpsFlowDefinition (org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition)10 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)10 CIMessageSubscriberBuilder (com.redhat.jenkins.plugins.ci.CIMessageSubscriberBuilder)8 FreeStyleBuild (hudson.model.FreeStyleBuild)4 EnvironmentVariablesNodeProperty (hudson.slaves.EnvironmentVariablesNodeProperty)2 Test (org.junit.Test)2 CIMessageBuilder (com.redhat.jenkins.plugins.ci.CIMessageBuilder)1 ActiveMQPublisherProviderData (com.redhat.jenkins.plugins.ci.provider.data.ActiveMQPublisherProviderData)1 ActiveMQSubscriberProviderData (com.redhat.jenkins.plugins.ci.provider.data.ActiveMQSubscriberProviderData)1 RabbitMQPublisherProviderData (com.redhat.jenkins.plugins.ci.provider.data.RabbitMQPublisherProviderData)1 Initializer (hudson.init.Initializer)1 MatrixProject (hudson.matrix.MatrixProject)1 AbstractProject (hudson.model.AbstractProject)1