Teamcity agent configure nodejs version - teamcity

How can I configure the version of node that the teamcity agent uses when running my deployment?
Currently the agent uses node version 16.13 --> but I want it to use an older version.

According to the docs:
TeamCity uses node:lts by default, or, if there is an .nvmrc file inside your project, it will search for the image specification there.

Related

Application has been compiled by a more recent version of the Java Runtime (class file version 55.0), this versions up to 52.0

I am trying to run the docker image in AWS cloud so in the local ,compiled the application with jdk-11.0.1 and written docker file like this;
Please note that I have not installed any JDK in AWS ec2 instance because I have already included adoptopenjdk/openjdk11:latest image in the final image..
FROM adoptopenjdk/openjdk11:latest
ADD target/demo-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java","-jar","app.jar"]
EXPOSE 8080
1)create the docker image
2)pushed the docker image to docker hub
3)when I run the docker container then getting below error.
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/example/demo/DemoApplication has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Most probably java got updated in local so you are compiling with a different version than you think. Or the local version is different than "adoptopenjdk/openjdk11:latest".
I suggest you use a multi-stage build so that your classes are always compiled against the same java version.
How you write your build stage depends on your environment so I don't have enough information to post an example. But basically you need to replicated everything you do in local inside the build stage. Then you just copy the jar to the last stage. And this will always work.
Try changing your openjdk version to latest i.e FROM:openjdk:12 work for me as i am using latest java version, use respective openjdk versions to match at runtime
To avoid this kind of issue It is recommend to be very specific about the images.
i.e. FROM adoptopenjdk/openjdk11:jre-11.0.9.1_1-alpine
For this kind of best practices I would suggest to go through this article I found while looking for the solution.

No agent found in pool Hosted which satisfies the specified demands: svn maven

Using VSTS, and following this step by step guide, I still get this error.
Am using the hosted pool, and have verified it has maven
What could be missing?
Thanks in advance!
That's actually the svn capability which is missing on the hosted agent. You might have to add a user capability and add a task to run a non-installed version of it and set the path on the current machine.
The other solution would be to install your build machine with all the tools you need

Modify a service inside GitLab CI

I'm attempting to set up GitLab CI and I have some integration tests that run against elasticsearch. I'd like to install elasticsearch using the official docker image, so:
services:
- elasticsearch:2.2.2
But I want the mapper-attachments plugin. I have had no luck adding a command in the before_script section to install the mapper-attachments plugin, because the elasticsearch files don't seem to be in the environment that the before_script section is running inside of. How can I modify the elasticsearch image that has been installed into the runner?
You should create you custom elasticsearch container.
You could adapt the following Dockerfile:
FROM elasticsearch:2.3
MAINTAINER Your Name <you#example.com>
RUN /usr/share/elasticsearch/bin/plugin install analysis-phonetic
You can find this image on Docker Hub.
Here are detailed steps:
Register at https://hub.docker.com and link you Github account with it
Create a new repo at Github, e.g. "elasticsearch-docker"
Create a Dockerfile which inherits FROM elasticsearch and installs your plugins (see this example)
Create an Automated build at Dockerhub form this github repo (in my case: https://hub.docker.com/r/tmaier/elasticsearch/)
Configure the Build Settings at Docker Hub
I added two tags. One "latest" and one matching the elasticsearch release I am using.
I also linked the elasticsearch repository, so that mine gets rebuilt when there is a new elasticsearch release
See that the Container gets built successfully by Docker Hub
Over at Gitlab CI, change the service to point to your new Docker image. In my example, I would use tmaier/elasticsearch:latest
See your integration tests passing

Jenkins Websphere Deployment doesnt retain application configurations

I am using Jenkins version 1.644 and trying to deploy a web application to Websphere 8.5 application server. Jenkins job completed successfully and application is visible through admin console. After the first install, i manually configured Three application configurations namely,
1. Virtual Host
2. Context Root and
3 Modules
after these setup application comes up fine.
Now when i run the Jenkins Job again (option used is Install/Update application), it overrides all the configurations.
Please Let me know how to keep the configurations after each build from Jenkins.
Websphere Plugin Configuration
You can create a build deploy job which will call wsadmin tool and there you can pass parameter in key value pairs
Here is an article which talks about how to build job with parameterized configuration.
http://www.touchdownconsulting.nl/2011/03/building-and-deploying-websphere-applications-with-jenkins-ci/
I have not tried this but looks like it suits your requirement.
Hope this helps!
Current Jenkins Websphere deploy plugin (1.3.4) version does not allow to pass
1. Virtual Host
2. Context Root and
3. Modules
I created a Jython script using AdminApp WAS Utility and updated these parameters
AdminApp.edit("appname", ['-MapWebModToVH', [["appname", "appname.war,WEB-INF/web.xml", "api_host"]]])
AdminApp.edit("appname", ['-CtxRootForWebMod', [["appname", "appname.war,WEB-INF/web.xml", "/appname"]]])
AdminApp.edit("appname",['-MapModulesToServers', [["appname","appname.war,WEB-INF/web.xml","WebSphere:cell=appcell01,node=node12v,server=web2+WebSphere:cell=Cell01,node=node11v,server=web1+WebSphere:cell=Cell01,cluster=api-cluster"]]])
AdminConfig.save()
Used Jenkins Remote SSH Plugin to invoke this script.

Unit test code analysis using "sonar.*" property and maven-sonar-plugin

I'm trying to do code analysis of Java unit test using maven sonar plugin. But the plugin doesn't seem to take into account my sonar properties "sonar.*". I've tried to modify simple examples and it did work either. According to MSONAR-70, the issue has been fixed and I'm using the version 2.4.
For the test, I've tried it on a simple case:
Clone sonar-examples.git
use the project sonar-examples/projects/languages/java/maven/java-maven-simple as example
Renamed src/main to src/test
In the pom.xml, add to the properties section :
<sonar.sources>src/test/java</sonar.sources>
<sonar.binaries>target/test-classes</sonar.binaries>
Run mvn sonar:sonar.
--> the code analysis didn't took into account my settings. The project is created on SonarQube but code as not been analyzed.
If I use the sonar-runner command line, it's analyzing the code:
sonar-runner [...] -Dsonar.sources=src/test/java
-Dsonar.binaries=target/test-classes
-Dsonar.language=java
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectKey=org.codehaus.sonar:example-java-maven
-Dsonar.projectName="Simple Java Maven Project"
-Dsonar.projectVersion=1.0-SNAPSHOT
According to a previous revision of the question, the OP solved their problem like this:
We were using SonarQube 4.0 version. Updating the version to 4.4, made the properties be taken into account.
That was in 2014; the current version now is 5.5.
The steps to upgrade can be found here:
Stop the old SonarQube server
Download and unzip the new SonarQube distribution in a fresh directory, let's say NEW_SONARQUBE_HOME.
Start it using the default H2 database and use the update center to install the plugins you need.
Manually install any custom plugins.
Stop the new server.
Update the content of the sonar.properties and wrapper.conf files located in the NEW_SONARQUBE_HOME/conf directory with the content of the related files in the OLD_SONARQUBE_HOME/conf directory (web server URL, database settings, etc.). Do not copy-paste the old files.
If a custom JDBC driver is used, copy it into NEW_SONARQUBE_HOME/extensions/jdbc-driver/.
Back up your database.
Remove the data/es directory.
Start the new web server
Browse to http://localhost:9000/setup (replace "localhost:9000" with your own URL) and follow the setup instructions.

Resources