Jenkins - trigger builds automatically after server restart - deployment

Is it possible to trigger Jenkins to run jobs after server is restarted (that is, when Jenkins is started, for example)?
I thought this would be pretty simple but haven't found answer with brief googling.
Backround is that our Jenkins automatically deploys two Play applications after their tests pass at the same server for test use. (For both applications, we have a test build that triggers deployment build). Now it would be nice that applications would be up and running after server reboot.

There is an app... err plugin, for that :)
https://wiki.jenkins-ci.org/display/JENKINS/Startup+Trigger

Related

How to run junit system integration tests in kubernetes/service mesh?

We have a service mesh/kubernetes working via the terminal, showing all the different pods with their different name spaces. Inside of each pod, you can console in and see the app.jar.
Recently, boss/client asked how we can run the various SYSTEM INTEGRATION tests for any particular JAR from the service mesh/kubernetes command line. Google says to use 'mvn clean install', 'javac' or 'java -jar junit-platform-console-standalone-1.7.2.jar --class-path target --select-class '. These all fail for various reasons (mvn not present, javac not present, jar says that port is in use. Of course the port is in use, the same aforementioned jar is using it).
When I look at a pod in Gitlab (or Intellij) I see all the tests it has. But how I can run these SYSTEM INTEGRATION tests from the pod console? Ideally a command to run all tests, that would make things a lot easier.
edit:
lol at the heat in the comments. I clarified with the boss, she said that we want to run system integration tests from the service mesh, not unit tests. These pods are not isolated, some of them depend on each other.
Generally the comment from the user jonrsharpe could be an answer to the question:
That makes no sense as a request - you run the unit tests on the source code, then build and deploy the container if they pass. They shouldn't even be included in what's in the deployed jar.
If you need to test an application, do so before deploying it. You should have a separate environment where you will test your application, and only use Kubernetes when the application is working properly. You can of course use some CI type solution. Look at this page - Running JUnit tests with GitLab CI for Kubernetes-hosted apps.
EDIT
If you are looking for a solution to make integration testing with Kubernetes you can read a couple of docs. It all depends on what specifically you want to test. I present several possibilities:
Overcome Kubernetes Application Integration Testing Challenges with Telepresence
How we approached integration testing in Kubernetes, and why we stopped using Helm tests
Testing Kubernetes deployments within CI Pipelines

Web Deployment runs with error, but does nothing

I'm running a CI pipeline on Azure DevOps. Part of the release pipeline is deploying a website to our web server (running IIS).
We changed hardware recently and did a fresh install of Windows. Of course I also installed the WebDeploy handlers and everything. But since then, the deployment runs without error, but it doesn't actually update any files. If I publish the website from VS2019, everything is fine.
How would I troubleshoot this?
I forgot to include the new server into the deployment group. Only noticed it when we finally turned off the old server and got the error message that the target was offline.

Is it possible to fail an Azure Release Pipeline stage if startup command is not successful?

I have an ASP.NET Core app and trying to automate deployment to a Linux-based Azure App Service through the on-premises Azure DevOps server. I managed to build everything and deploy the code to the App Service.
At this moment, the Startup Command which should run the application (dotnet dllname) fails. When I open the URL of my web app, I see the default Azure "welcome" page (served from opt/defaultsite).
I don't have a problem with this particular failure - I did not configure the connection string and other settings yet, so it was expected. However, I wonder how it is supposed to handle such failures. I have these concerns:
How do I know that the startup failed without visiting the web app manually? The Deploy task finishes successfully with a green mark despite the fact that the startup was not successful.
When the app fails to start, I would like to see the error message in the browser rather than the default site (at least for the non-prod environments). Otherwise, the only way to understand that I have a problem and see the reason is to go to the Kudu console and see the log stream.
If my app crashes, would it restart it or it will switch to the opt/defaultsite page again?
At this moment, to address the first concern, I am going to add another task to the Stage - a simple PowerShell script which would send a request to one of the app endpoints, however, I wonder if Microsoft suggests some better/more native solution.
Basically, the stage will be failed if there are errors/exceptions during the deployment.
However we cannot fail an Azure Release Pipeline stage if startup command is not successful, because the deployment is actually complete.
As a workaround you can add another task to run scripts to request the endpoints to detect that as you did.

Running UI test in Jenkins Docker-Slave

With the use of Jenkins Docker Plugin we can provision the slaves dynamically.
My need is to run UI tests on the automatically created slaves. Is that feasible? If yes, how can we achieve that?
UI tests are WindowTester test cases for eclipse based tool.
I am doing same kind of stuff, On successful build we are running all automated test cases on windows machine.
In your Jenkins, you need to add Windows machine as a Slave machine.
Try below tutorial -
https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows
Once node is up and running then in your Job make sure you selected windows slave node.

Eclipse - Why does Azure deployment take so long

I'm trying to deploy my HelloWorld application in Windows Azure which was developed in Java using eclipse. The application working fine when I tested under tomcat and Azure sdk. I created hosted service in Window Azure Management Portal and deploy my application. It almost 3 hours and it still deploying.
I went to What Happens When You Deploy on Windows Azure? and checked but still unclear.Can anyone advice why it took so long to deploy and any suggestion how to make the deployment process more faster.
Please refer the image below.
I changed the startup.cmd, instead of copy my tomcat to azure i changed the startup.cmd to download the tomcat online. now its working fine.
Does you start-up script finish after tomcat start?
The instances will be marked as ready only after the start-up script finished, so if you start tomcat blocking the start-up script it won't reach this state unless tomcat crashes...
You should use "start" (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true) command to start tomcat in a separated process allowing the start-up script to finish.
(In my memories the provided example in the eclipse plugin had the issue)