Ruby cucumber and Jenkins - ruby

I have feature files in cucumber ,for its step definition I am using Ruby-selenium.I am trying to integrate with my local Jenkins but I am unable to do the same.
Any headsup how to proceed

When things about Jenkins, it is mostly about Environment Variables. I recommend you to check if your local env vars are correctly passed to Jenkins.

Related

How to install Jmeter on Gitlab runner machine?

I am new to using JMeter with GitLab CI/CD. I have created loadTest suite and want to configure it in Gitlab CI/CD pipeline. I have run.sh file in my loadTest project which do following:
Create and set up test data
Download JMeter dependencies and plugins (if JMeter already exists, skip this step)
Run the test
Clean up test data
Questions:
Is it a good idea to download JMeter in your project folder while you run the script or use JMeter docker image and run the tests ? I am concern about keeping JMeter folder in GitLab repo and occupying unnecessary space.
How to install Jmeter on Gitlab runner machine ?
Thank you in advance.
If your run.sh script downloads JMeter you don't need to put JMeter into Github repo. Using Docker is also possible, you can either check existing images or create your own with your own test data and plugins.
Gitlab runners are normal Linux machines (if you choose the relevant executor), my expectation is that your run.sh should work just fine there as it is (or with minimal amendments, like installing Java prior to installing JMeter)

How to run JMeter test from Jenkins

How to run jmeter test from Jenkins, here i want to run my jmeter test with jenkins and tried to configure the Jenkins with Performance plugin based on the information got after googling.
In Google the solution is provided where jenkins is hosted locally and in Build we configure command line execution by providing jmx file path and so on...
the problem comes when my jenkins is in other server like http://172.27.80.57:8080/... here if i give Command line execution by providing jmx file path my build will fail..because my path is in different location..
So How to over come this as i am new to Jmeter and my boss want this result to be shown in jenkins ....and if there is any plugins which i need to install or is there any place where i am missing, please let me know ....this is very important for me....
OR is there any possibility that where we can push our changes to Git lab using CI tools such as Sourcetree...etc and then run those in Jenkins.
Thanks in advance.
You will need to install Jenkins build agent to the machine which you plan to use as JMeter load generator, check out Distributed Builds Jenkins Wiki page.
Also JMeter test is possible using Jenkins Pipeline feature. For more information check Running a JMeter Test via Jenkins Pipeline
Hope this helps.

Where does Jenkins store the project source

I have a Jenkins job that uses a script to build my project. On the following line, the script fails mvn -e -X -Dgit='$git' release:prepare.
Because I want to search for the cause of this, I want to go to the Jenkins server and run mvn -e -X -Dgit='$git' release:prepare from the command line, to see if it works.
Does Jenkins store the projects' source code somewhere, such that I can go to that folder and call Maven?
If yes, then where?
Yes, It Stores the project files for the job by default at
/var/lib/jenkins/workspace/{your-job-name}
This is where jenkins suppose the project files to be present or it pulls it from a source before start working/building from it.
Quote from Andrew M.:
"Hudson/Jenkins doesn't quite work that way. It stores configurations and job information in /var/lib/jenkins by default (if you're using the .deb package). If you want to setup persistence for a specific application, that's something you'll want to handle yourself - Hudson is a continuous integration server, not a test framework.
Check out the Wiki article on Continuous Integration for an overview of what to expect."
From this Question on serverfault.
This worked for me:
/var/jenkins/workspace/JobNameExample
but, if your build machine (node) is a different than the one where Jenkins is running (manager), You need specify it:
/var/jenkins/workspace/JobNameExample/label/NodeName
Where you can define label too:
jenkins stores its workspace files currently in /var/jenkins_home/workspace/project_name
I am running from docker though!

Maven environment variable used for AEM credentials in pom.xml ignored by Jenkins jobs

I am currently trying to get my Jenkins (version 2.35) Jobs for AEM (6.2) author/publishers up and running. In this setup I have Dev, Staging and Production environments. To avoid version controlling my credentials in my pom.xml I have made the use of environment variables in maven (version 3.3.9).
<properties>
<aem.host>localhost:4502</aem.host>
<aem.protocol>http</aem.protocol>
<aem.user>${env.AEM_AUTHOR_USER}</aem.user>
<aem.password>${env.AEM_AUTHOR_PASSWORD}</aem.password>
</properties>
On my local environment I have tested setting those environment variables to the correct and then incorrect values and it behaves as one would think it would.
The thing here is that when I build the Dev Author job on my Jenkins server, it seems to succeed whether the environment variables are set to the correct values or not. It is so weird and at this point I have no clue to what is going on. I am setting the environment variables on the Jenkins server via a simple.
source ~/path/to/file
Where ~/path/to/file would look something like the following:
AEM_AUTHOR_USER="admin"
AEM_AUTHOR_PASSWORD="admin"
Also I should mention that previously to using environment variables in maven I had the AEM credentials directly in the pom.xml just for Dev jobs.
I'm wondering if Jenkins has cached the maven properties thus the credentials and re-setting the environment variables has no effect. I should also mention I have tried re-creating the workspace on each new build to see if it would clear some caching system but no dice.
Is Jenkins or Maven caching my maven properties somewhere that my environment variables are being ignored ?
Has anyone ran into the issue I am describing ?
Should I be using the EnvInject Plugin Jenkins plugin ?
Any help is welcomed.
Thanks,
Nicola
In the case of my Develop Jobs it seems that Jenkins uses some sort of caching system that I wasn't able to clear. Even after deleting the workspace or deleting the cache folder in
/home/jenkins/.jenkins/cache
Anyways after trying a lot of things to attempt regaining control over the value of the AEM credentials set in my pom.xml I figured out how to control the values of the pom.xml environment variables which solved my problems. The way I did that was to install the EnvInject Plugin after which I was able to configure my maven environment variables individually on all my jobs. Everything works great now.

How to set up a CI environment using jenkins, rvm and cucumber

I am new to CI and would like your thoughts and input on how to go about my problem. I would like to first start off that I have been wrestling with this for 2 days(and I don't have that much background in sys ad) so please play nice?(I am mainly a front-end web dev) :)
Basically my plan was to install jenkins then make a CI env with these steps:
poll for any changes to github
if there are, run the build script:
a. migrate the development and test dbs?(does that mean i have to put the config/database.yml in my repo?)
b. run cucumber
c. if all tests pass go to 3, else fail
run any rake setup stuff
run the server(deploy)
I have done some of the stuff by cheating:
in my local, i switch my rvm to the correct one i need(rvm use 1.8.7-p174#mygemset)
run jenkins(java -jar jenkins.war) so that it gets the RVM ruby as default
run spork in a separate terminal(because for some reason my cucumbers don't run without spork - that's another problem)
build the project manually by clicking Build
so basically, I want to automate these stuff. Maybe what I need is a set of steps to follow(general or specific, depending on your taste) so I can setup my CI up and running.
Keep in mind that my "cheats" won't do as I want to test different projects with different setups and the startup cheat just won't do. Currently, my project build was successful because all I did was to run cucumber(and all my cukes pass). I want it to be able to deploy after it passes so maybe some help there also? Thanks
Okay I will try and help you as best I can.
poll for any changes to github
This can be easily done with the Github Plugin located here
if there are, run the build script: a. migrate the development and test dbs?(does that mean i have to put the config/database.yml in my
repo?) b. run cucumber c. if all tests pass go to 3, else fail
Then all you would is run the build script you have configure in the in the build from
Select "Add Build Step" -> "Execute shell".
You can either do that which is probably what I would do because when you create build you want them to be portable so you can start up in new jenkins instances, so you dont have to setup your build machine, with build specific files.
Then you run your tests, if they fail the build should fail regardless here is some information on running ruby on rails tests. if you need to manually fail a build in a script based on a result usually exiting a script with non-zero will fail the build. If not continue and run your rake and deployment scripts.
Just a few notes on Jenkins it wont do everything for you but if you can do it manaually Jenkins can automate it. So anything you have setup running manually with a little bit of effort you can get up and running automated with Jenkins
Here is another answer you might find helpful in your general setup and ideology behind Jenkins.
Goodluck!

Resources