The Jenkins Server cartridge (OpenShift) uses OpenJDK 7u55.
How to update to OpenJDK 7u60 or 8u05 or Oracle JDK (7u60 or 8u05), please?
You can do this using OpenShift's action hooks. Add a script which will check for the existence of the JDK you want to use, and download it if it doesn't exist.
For example, in .openshift/action_hooks/deploy, add this snippet:
#! /bin/bash
JDK_HOME=$OPENSHIFT_DATA_DIR/jdk1.8.0
if [[ ! -L $JDK_HOME && ! -d $JDK_HOME ]]
then
cd $OPENSHIFT_DATA_DIR
wget http://www.java.net/download/jdk8u20/archive/b17/binaries/jdk-8u20-ea-bin-b17-linux-x64-04_jun_2014.tar.gz
tar xvf *.tar.gz
rm -f *.tar.gz
ln -s jdk1.8.0_20 jdk1.8.0
fi
In Jenkins, you can then configure builds to use this JDK by configuring the PATH variable, in an "Execute Shell" action, like so:
export PATH=$OPENSHIFT_DATA_DIR/jdk1.8.0/bin:$PATH
This example retrieves 8u20. Sorry, I'm not sure of the links to use for the exact versions you mention. Also, word of warning, this download is over HTTP, without performing a check against the published MD5 checksums. If you're doing anything serious, you should edit to code snippet to perform that check.
Related
I'm trying to write a bash script for automating the installation of anydesk by wget with the help of the following code:
echo -e "[ - ] Installing AnyDesk..."
wget --max-redirect 1 --trust-server-names 'https://anydesk.com/en/downloads/thank-you?dv=deb_64' -O anydesk.deb
sudo apt install ./anydesk.deb
echo -e "[ ✔ ] AnyDesk ➜ INSTALLED\n"
The problem is that https://anydesk.com/en/downloads/thank-you?dv=deb_64 returns a HTML page, not a Debian package.
How can I parse the HTML page to find the download link to the Debian package?
I examined page source of https://anydesk.com/en/downloads/thank-you?dv=deb_64 and download is triggered by JavaScript depending on User-Agent of browser, wget does not support JavaScript execution therefore you are actually getting HTML page source not actual .deb file. Use tool which support JavaScript execution to get actual file.
You can run the following command:
wget -O anydesk.deb https://download.anydesk.com/linux/anydesk_6.2.1-1_amd64.deb
this will allow you to download Anydesk, via wget.
I am fairly new to Informatica. I am trying to automate deployment of Powercenter code from one environment to another using jenkins.
Script:
node('')
{
def application = 'powercenter'
stage('deploy'){
sshagent(['group']) {
sh """ssh -o StrictHostKeyChecking=no user#123.com 'cd /opt/hub/infapwc/server/bin && pmrep connect -r Repository_Service_L1 -d domain -n username -x password'"""
}
}
}
My job is failing with error: pmrep command not found. Informatica is installed on the linux server i am doing ssh in. This works fine in putty. I am not sure what the issue is. Can anyone please help?
You can use $INFA_HOME/bin to $PATH or you can use absolute path of pmrep file.
pmrep file is available in $INFA_HOME/bin. You can check with infa admin person about path.
That won't work; pmrep uses a couple of libraries which are located in the .../server/bin directory as well.
In order to make this work, please add the .../server/bin directory of the PowerCenter installation path (resp. ...\server\bin on Windows) to the PATH environment variable of the user ID which runs the Jenkins script before trying to invoke pmrep.
I am learning all of these new technologies. I have a home server for private development with latest version of centos 7.6 (minimal installation). I am trying to keep the server as light as possible.
I have installed jenkins (v2.164.2) and it is up and running correctly. I have created a new Freestyle project to compile a g++ project hosted on another own gogs server. I have defined gogs url and credentials and then added the following in the execute shell command:
which g++; make clean; make;
When I press the "Build Now" button, it fails with the following message:
which: no g++ in (/sbin:/usr/sbin:/bin:/usr/bin)
Cloning the repository, etc seems to be working fine.
I have NOT installed the default g++ version but instead I have installed the one that comes with devtools-7 (g++ v7.3.1). I have created a new file under /etc/profile.d/devtools.sh with the following text:
!#/bin/bash
source scl_source enable devtoolset-7
If I login into a bash shell in the server and then run which g++, I get the expected output.
Finally, the question: why jenkins is not picking this up? As far as I know, adding that file under /etc/profile.d ensures that everyone will be able to access g++.
Thanks very much in advance for any help.
I have managed to fix it at the end. I leave the question just in case someone else runs into the same problem. I only had to add the following line as first line in the "execute shell" command field:
#!/bin/bash -l
make clean; make;
That #!/bin/bash -l did the trick. (Please mind the -l).
Found it here: What shell does Jenkins use?
I have 2 RHEL machines setup in a Master/Slave configuration using Jenkins ver. 1.609.2
The slave is being launched via SSH Slaves Plugin 1.10.
I'm trying to use the Slave Setup Plugin v 1.9 to install the tools that will be necessary for my slave machine to run builds. In particular I am installing sqlplus.
Here is the script that I am running in order to try installing sqlplus:
if command -v sqlplus >/dev/null; then
echo "sqlplus already setup. Nothing to do."
else
#Create directory for sqlplus and unzip it there.
mkdir /jenkins/tools/sqlplus
tar -xvf sqlplussetup/instantclient-basiclite-linux.x64-12.1.0.2.0.tar.gz -C /jenkins/tools/sqlplus || { echo 'unzip failed' ; exit 1; }
tar -xvf sqlplussetup/instantclient-sqlplus-linux.x64-12.1.0.2.0.tar.gz -C /jenkins/tools/sqlplus || { echo 'unzip failed' ; exit 1; }
cd /jenkins/tools/sqlplus/instantclient_12_1
#Create links for the Oracle libs
ln -s libclntsh.so.12.1 libclntsh.so || { echo 'Could not create link' ; exit 1; }
ln -s libocci.so.12.1 libocci.so || { echo 'Could not create link' ; exit 1; }
#Add two lines to .bashrc only if they don't already exist. Export LD_LIBRARY_PATH and add sqlplus to PATH.
grep -q -F 'export LD_LIBRARY_PATH=/jenkins/tools/sqlplus/instantclient_12_1:$LD_LIBRARY_PATH' /home/jenkins/.bashrc || echo 'export LD_LIBRARY_PATH=/jenkins/tools/sqlplus/instantclient_12_1:$LD_LIBRARY_PATH' >> /home/jenkins/.bashrc
grep -q -F 'export PATH=$PATH:/jenkins/tools/sqlplus/instantclient_12_1' /home/jenkins/.bashrc || echo 'export PATH=$PATH:/jenkins/tools/sqlplus/instantclient_12_1' >> /home/jenkins/.bashrc
#Export variables so they can be used right away
export LD_LIBRARY_PATH=/jenkins/tools/sqlplus/instantclient_12_1:$LD_LIBRARY_PATH
export PATH=$PATH:/jenkins/tools/sqlplus/instantclient_12_1
echo "sqlplus has been setup."
fi
This script runs successfully and everything appears to work until I try to run a build and execute the sqlplus command. The build fails because sqlplus is not a recognized command.
My main question is this:
What is the proper way to automatically add an environment variable when launching a slave?
Please note I am looking for an automated way of doing this. I don't want to go into the configuration screen for my slave, tick a checkbox and specify an environment variable. That is counter-productive to what I am trying to achieve which is a slave that is immediately usable for builds once connected.
I pretty much understand why my script doesn't work. When Jenkins is launching the slave it first makes an SSH connection and then it runs my setup script using the command
/bin/sh -xe /jenkins/tmp/hudson8035138410767957141.sh
Where the contents of hudson8035138410767957141.sh is my script from above. So obviously, the export isn't going to work. I was hoping adding the exports to the .bashrc file would get around this but it does not work. I think this is because this script is executed after the ssh connection is established and therefore the .bashrc has already been read.
Problem is I can't figure out any way to work around this limitation.
Bash does not read any of its startup files (.bashrc, .profile etc) for non-interative shells that don't have the --login option set explicitly -- that's why the exports don't work.
So, solution "A" is to keep the bashrc magic that you suggest above, and to add the --login option by changing the first line in your build step to
#!/bin/bash --login
<your script here>
The explicit shebang at on the first line will also prevent excessive debug output that you get from the default's -x option (see your console snippet above).
Alternative solution "B" uses the fact that bash will source any script whose name is given in $BASH_ENV (if that variable is defined and the file exists). Define that variable globally in your slave properties (e.g., set to /jenkins/tools/setup.sh) and add exports as needed during slave setup. Every bash shell build step will read the settings then.
With solution "B" you don't need to use the --login option and you don't have to mess up the .bashrc. However, the "BASH_ENV" feature is only active when bash runs in "bash mode". As Jenkins starts the shell via sh, bash tries to emulate historic sh, which does not have that feature. So, also for B, you need a shebang:
#!/bin/bash
<your script here>
But that you'd need anyway to get rid of the tracing output that's usually too much in production setups.
I'm using Neo4j with Node.js to build a REST API.
I'd like to write some tests for this API. How do I use a "test database" during those tests?
With MySQL or MongoDB, I'd fiddle the resource URL to use a different database like "app-test" vs "app".
What's the smart way to do that in neo4j?
Thanks!
SOLUTION: This is what I did:
Made a directory db/test. In that dir, put:
two bash scripts below
a test.zip with backup of the database you want
install.sh
#!/bin/bash
VERSION=neo4j-community-2.1.5
# Download a copy of the server
wget http://dist.neo4j.org/$VERSION-unix.tar.gz
# Unpack it here
tar -xvzf $VERSION-unix.tar.gz
# Change the default port to http->7475 https->7476
sed -i.bak s/7474/7475/g $VERSION/conf/neo4j-server.properties
sed -i.bak s/7473/7476/g $VERSION/conf/neo4j-server.properties
restart.sh
#!/bin/bash
VERSION=neo4j-community-2.1.5
echo === stop the server
$VERSION/bin/neo4j stop
echo --- replace the database
rm -rf $VERSION/data/graph.db
unzip -q test.zip -d $VERSION/data/graph.db
echo --- start the server
$VERSION/bin/neo4j start
Then added it to gruntfile using grunt-run:
run: {
restartTestDb: {
exec: 'cd db/test && ./restart.sh',
}
},
Works.
You can do the same thing with neo4j. Just install another copy of neo4j in a separate location, and configure it to use a different port.
After each test, you can delete the graph.db file to clear all the data.
I'm currently busy with a project that can manage and switch databases from the command line.
I'm busy with fixing the neo4j download feature, this is still in WIP but the more users, the more quickly stable it can be.
I should push on github within an hour or two.
EDIT: Repository here https://github.com/neoxygen/neo4j-toolkit
Live video here http://recordit.co/YRVhOJKXdj