How to get build steps that will run on a particular job before build start? - jenkins-plugins

I am working on a Jenkins plugin that needs to know information about the build steps that are about to run.
I need this information before the jobs actually run.
I was not able to find this info neither on AbstractBuild or BuildListener classes.
Ideally i will use this info inside BuildStepListener but i as i am writing the plugin can collect it on any extension point
#Extension
public class MyBuildStepListener extends BuildStepListener{
#Override
public void started(AbstractBuild build, BuildStep bs, BuildListener listener) {
listener.getLogger().println("Get all build steps here");
}
...
}

An AbstractBuild just provides information about the current build — you need to get information from the job that this build belongs to.
You can use AbstractBuild#getProject() to do so, and then use AbstractProject#getBuilders() to get the build steps.

Related

object johnsnowlabs is not a member of package com

I am very new to Zeppelin/spark and couldn't get an accurate description of steps to configure new dependencies like that of NLP libraries.
Found similar issue here.
I was trying to use Johnsnowlabs NLP library in Zeppelin notebook (spark version2.2.1).
Setup included :
In Zeppelin's Interpreters configurations for Spark, include the following artifact:
com.johnsnowlabs.nlp:spark-nlp_2.11:2.5.4
Then, in conf/zeppelin-env.sh, setup SPARK_SUBMIT_OPTIONS.
export SPARK_SUBMIT_OPTIONS=” — packages JohnSnowLabs:spark-nlp:2.2.2". Then restarted Zeppelin.
But the below program gives the error :
%spark
import com.johnsnowlabs.nlp.base._
import com.johnsnowlabs.nlp.annotator._
<console>:26: error: object johnsnowlabs is not a member of package com
import com.johnsnowlabs.nlp.base._
^
<console>:27: error: object johnsnowlabs is not a member of package com
import com.johnsnowlabs.nlp.annotator._
Can someone please share how this can be done? I referred this link .
TIA
you don't need to edit the conf/zeppelin-env.sh (anyway you're using it incorrectly, as you're specifying completely different version), you can make all changes via Zeppelin UI. Go to the Spark interpreter configuration, and put com.johnsnowlabs.nlp:spark-nlp_2.11:2.5.4 into spark.jars.packages configuration property (or add it if it doesn't exist), and into the Dependencies at the end of configuration (for some reason, it isn't automatically pulled into driver classpath).

Vespa Tutorial – HTTP API use-case fails to activate with IllegalArgumentException

I'm currently following the Vespa tutorials, and ran into an issue with the HTTP API use-case. Everything works fine from the mvn install package to the vespa-deploy prepare target/application.zip.
The call to vespa-deploy activate returns normally, but the application then never gets available on localhost:8080. Looking at /opt/vespa/logs/vespa/vespa.log (in the VM) one finds the following stack trace:
Container.com.yahoo.jdisc.core.StandaloneMain error Unexpected:
exception=
java.lang.IllegalArgumentException: Could not create a component with id 'com.mydomain.demo.DemoComponent'.
Tried to load class directly, since no bundle was found for spec: sample-app-http-api-searcher.
If a bundle with the same name is installed, there is a either a version mismatch or the installed bundle's version contains a qualifier string.
at com.yahoo.osgi.OsgiImpl.resolveFromClassPath(OsgiImpl.java:48)
...
This occurred using a fresh Docker image with a clean clone of the sample-apps git repository. Preparing and activating the basic sample as well as the other http example did work seamlessly.
I checked the sources and the xml files for obvious problems but don't have any clue about what is failing and where.
target/application.zip contains
application/components/http-api-using-searcher-1.0.1-deploy.jar
application/hosts.xml
application/searchdefinitions/basic.sd
application/services.xml
And the jar itself does contain a com/mydomain/demo/DemoComponent.class file (among other things).
Potentially related issue on the github tracker: https://github.com/vespa-engine/vespa/issues/3479 I'll be posting a link to this question there as well, but I still think it's worth a SO question, at least to get some action behind the vespa tag :)
The bundle id in the application's services.xml file was wrong. Please pull the application from git and try again now. See also PR: https://github.com/vespa-engine/sample-apps/pull/18
Brief explanation: The bundle id given in the bundle="<id>" declaration in services.xml must match the 'Bundle-SymbolicName' in the bundle's manifest. When the bundle has been built with the Vespa bundle-plugin, the symbolic name is by default the same as the project's artifactId. Hence, in most cases you just have to verify that the bundle id matches the artifactId.

How do I set up Allure with JUnit in an IntelliJ project?

I've been reading in the Allure wiki however I do not seem to be able to get started with Allure.
I have an IntelliJ project which I use to run JUnit tests with Selenium. I want to add Allure for better feedback after test runs. However I've not been able to understand how Allure would integrate with the rest of my project.
On the wiki page for JUnit it looks like Allure with JUnit only supports maven projects? How can I set up allure to work with an IntelliJ project?
I want to add Allure for better feedback after test runs
It is strange that you don't have a build tool.
But for single test (as you mention) following will work.
Dependencies - you need aither allure-junit-adaptor or allure-testng-adaptor
Allure implements test listener, which should be added to test runner:
For TestNG it happens automatically (once you add adaptor dependency).
For JUnit you should add listener manually. I don't know how to add it to Intellij Idea JUnit runner, but you can always run tests programmatically:
public static void main(String[] args) {
JUnitCore runner = new JUnitCore();
runner.addListener(new AllureRunListener());
runner.run(CalculatorTest.class);
}
That will generate XML report in target/allure-results folder.
If you need advanced Allure features like file attachments and test steps you need another dependency (aspectjweaver) and according JVM args, e.g.
-javaagent:lib/aspectjweaver-1.8.7.jar
To generate HTML report from existing XML report you can:
either use Allure CLI (requires tool installation http://wiki.qatools.ru/display/AL/Allure+Commandline)
or use 'mvn site' on existing project (e.g. https://github.com/allure-examples/allure-junit-example)
Open your HTML report in Firefox (or look here how to open locally generated report in Chrome).
To have allure-results after launching JUnit4 tests from IDE using context menu or controls on the gutter I use #RunWith anntotation where I set my custom runner with AllureJUnit4 listener.
CustomRunner class
package ru.atconsulting.qa.system.junit4runners;
import io.qameta.allure.junit4.AllureJunit4;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.InitializationError;
public class CustomRunner extends BlockJUnit4ClassRunner {
/**
* Creates a BlockJUnit4ClassRunner to run {#code klass}
*
* #param klass
* #throws InitializationError if the test class is malformed.
*/
public CustomRunner(Class<?> klass) throws InitializationError {
super(klass);
}
#Override
public void run(RunNotifier notifier) {
notifier.addListener(new AllureJunit4()); //just add listener
super.run(notifier);
}
}
Using #RunWith annotation in test classes
#RunWith(CustomRunner.class)
public class ExampleSuite {
#Test
public void testExample() {
....
}
}

Sencha Cmd v3 build error when implementing Bryntum Scheduler

Using Cmd 3.0.0.141, I have successfully generated a workspace and an Ext app in that workspace. The application builds correctly until I attempt to integrate the Bryntum Scheduler, where I encounter an error when I try to build:
"Failed to resolve dependency Sch.panel.SchedulerTree for file ExtCalendar.view.Tree"
the app is very simple at this point, uses Ext.application and follows the MVC pattern where I have a view defined "ExtCalendar.view.Tree" that extends 'Sch.panel.SchedulerTree". I also have models and stores that extend Bryntum classes as well, so I assume the compiler will trip over those as well, since it can't see the Sch namespace.
I've added a 'js' path to my app.json that points to the bryntum js file where 'Sch.panel.SchedulerTree' comes from. I've tried to run the 'refresh' command with the same results (Failed to resolve...). I've regenerated the bootstrap.js file manually using 'compile', but nothing from the Sch namespace ever gets added to it, despite the Brytum lib file being in the classpath.
What do I need to do in order to successfully run the 'build' command with libs like this?
Or, do I need to take a more granular approach using the 'compile' command?
With the help of the nice folks on the Sencha forums, I was able to resolve my build issues. The solution, for me, involved a shim. I added an external shim.js file to my index with as many //#require and //#define directives as needed in order to resolve the dependency issues.
According to the nice folks at Bryntum, once I upgrade from the free-trial version of the Bryntum Scheduler, I will be able to get rid of the shim and simply rely on the sencha.cfg classpath pointing at the Bryntum src.
Also, as an aside, the app.json file is not used in ExtJS apps, its inclusion in the generated files was a bug in build 141 of Cmd v3.
See this thread for more detail.

FUBAR after update to GAE-java-sdk-1.6.0/1.6.1 persistencemanager singleton

After I updated from GAE-JAVA-SDK-1.5.5 to 1.6.0 and 1.6.1 my app stop functioning properly. it started giving an error on the RPC service.
Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract void com.skip.school.client.service.AdminService.addStudent(com.skip.school.shared.Student)' threw an unexpected exception: java.lang.NoClassDefFoundError: Could not initialize class com.skip.school.server.PmfSingleton
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.skip.school.server.PmfSingleton
The whole log can be found here pastebin.
I have a singleton that should be initialized when the user starts there first rpc call.
The singleton I use should be correct there are many example found here on stackeroverflow and everywhere on the web.
public final class PmfSingleton {
private final static PersistenceManagerFactory pmfInstance = JDOHelper.getPersistenceManagerFactory("transactions-optional");
private PmfSingleton() { }
public static PersistenceManagerFactory get() {
return pmfInstance;
}
}
I call that class in all my server implementations like so.
PersistenceManager pm = PmfSingleton.get().getPersistenceManager();
this works on sdk 1.5.5 and below but not on sdk 1.6.0 and above, does anyone know what I' doing wrong what i should change if i want to use sdk 1.6.0 and above?
I read somewhere else that this problem is related to an out dated version of the datanucelus jars. I've updated to the latest version, v1.6.1 available from the eclipse plugin and I fixed it by deleting all old references to the old jars, leaving behind just these 3:
datanucleus-appengine-1.0.10.final.jar
datanucleus-core-1.1.5.jar
datanucleus-jpa-1.1.5.jar
I hope that works for you!
I had this same problem after upgrading to a newer version of AppEngine SDK. It turns out the problem was I had an older version of the appengine-api-1.0-sdk jar hanging around in the deployment folder.
Have a look in the war\WEB-INF\lib folder of your application and see if there are two different versions of appengine-api-1.0-sdk-1.x.y.jar. I fixed it by removing the appengine-api-1.0-sdk-1.5.x file.

Resources