Jenkins parameters - populate from MSSQL database? - sql-server

I'm very new to Jenkins and just hacking my way through it, please forgive me if this is a simple question. I'm using Extended Choice Parameter Plug-In to create a multi select box for a build, pretty much just a list of locations to copy files to. I have the list hardcoded in the build. This has been working great...
however I would like to have this list generated from a database table I have in MSSQL. I've poked around and I've found references to 'groovy scripts' and a variety of other plug-ins, and many of these posts are very dated. So I don't want to hunt down the wrong path and build something out of date.
What is the suggested plugin to use to created a multi select in a Jenkins build that can be populated from a MSSQL database? Do I need a 'groovy' plug-in as well?
If it's helpful, I'm skilled with python and perl, if 'groovy' isn't optimal. Thank you for your patience and time!

I find a solution to fix the problem. But it's a little bit dirty.
directly import your Driver in your class :
import net.sourceforge.jtds.jdbc.Driver;
DriverManager doesn't manage to find the good driver when you use it in Jenkins so you can simply instantiate your driver :
this.p = new Properties();
p.put("user", "user");
p.put("password", "password");
Driver d = new Driver();
con = d.connect("jdbc:jtds:sqlserver://"+p.getProperty("db.host")+":1433;databaseName="+p.getProperty("db.name")+";instance="+p.getProperty("db.instance"),p);
then, you will probably have a new error with SSO. So you can follow this guide : I/O Error: SSO Failed: Native SSPI library not loaded
You simply have to add a dll in your jdk/bin folder to make your driver work.
That's the only way I found and I think it's more a hack than a real solution ! Happy coding ;)

Related

Work with Database using Spock and Geb.

I hope someone have already faced an issue to verify that application shows correct data from database. I reviewd how groovy used SQL, but I have no idea where and how I should do that. I'm just starting to use gradle+Spock+Geb for testing application. I have a few files where I described a couple of pages from application, a couple of modules and a file with spock specification. Where and how I need to connect to Oracle DB, use SQL and compare result's data with application's ones?
P.S. I write everything in notepad++ and launch from command line writing 'gradlew firefoxTest'. Does exist any more comfortable way to work with gradle+spock+geb?
Thanks in advance.
Because there are no other answers, I wanted to provide a solution someone at my company thought of. This assumes you already have a project that uses some sort of JDBC. In our case it is JDBI.
The idea is to extend Classloader and then use that to directly access the data access object class via the JVM. That idea should work.
I have not tested it out because it doesn't completely fit our use-case. I'll admit that this does not completely apply to your use case, but technically you could just run the jar of an existing project, which can access the database.

how to transfer wordpress sql/database from local to live

So for backing up any/all my WordPress sites i use a tool called "BACKUP BUDDY" and its
a great tool and all but lately its been really buggy and today finally it went kaboom!
Usually my workflow is that i develop the site on my local machine using WAMP/MAMP.
when done and ready for testing i use the tool, move it to my personal test server to test and when happy and work is approved, i move to the real server.
Since my tool stopped working(uploads half the content) i decided to just do it manually by installing Wordpress first on the real webserver(done), Applying my theme(done),
then exporting the database sql from the local server(done), and thereafter importing it to the real server(done) and the 2xs that ive done it the site comes up blank.(outcome equals major fail!)
im assuming that something has to be changed/done in order for it to work but not sure what.
unlike a normal DB where i can talk to the info as normal, since WP is a CMS im assuming that it ties the info to the domain but again, i dont know how it 100% works...
Any ideas as to what im doing wrong? because as of now, if i cant do it like this, id have to manually create ALL the pages. Plus, if i was going to then move it from my real test server to final real destination then id have to manually redo it all again...
Thanks in advanced.
you aren't doing anything wrong. It sounds like your particular workflow could be as follows.
Upload the contents of the site via FTP
Create & Import the database via PHPMyAdmin, changing any info in wp-config.php
Define the site url, in wp-config.php [See below]
Use a tool to find & replace any hard-coded site-urls that wordpress loves to use. [See below]
Example code:
Define site urls
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Find replace tool
Replace
http://localhost/
with
http://www.your-new-site.com/
That should be it. It's live!
You can export it using phpMyAdmin and then use bigdump to import it. download bigdump from here and make sure you read the first note about the exporting process, found here
http://www.ozerov.de/bigdump/usage/
here is a bash script you can use to automate this entire process for you: https://github.com/jplew/SyncDB

How do create a custom database driver for CodeIgniter

How do you create a custom database driver to extend CodeIgniter's functionalities to other types of database systems? I'm using iRODS (www.irods.org). I have a version of the site created using MySQL, but I want to be able to change the database backend with minimal changes. Is there an easy way to add this function, like how you can add a custom library in CI? I haven't been able to find any so far.
I'm assuming you mean how do you create a custom Active Record driver for codeigniter? Otherwise I'm probably far off the mark here but:
There is no way I know of to simply extend or override the DB classes it is not a common thing. You can implement your own and patch up your CI config to use the new DB though.
Under system/database/drivers you find all the AR driver source. You would need to reimplement each function in each of the four files (may be able to skip on forge if you don't use it.)
I'd use the MySQL driver as a starting template as you mention you already use that, in which case you'll want to make sure all the features you use are re-implemented.
It sounds like a daunting task if you're not too experienced but I assure you the code is pretty simple.

Joomla! Quickstart package manual

I made some custom template and I still struggling with the most significant problem, how could I make a quickstart?
All the information what I found, doesn't helped me, including (http://www.youtube.com/watch?v=nqG6Z8nhyBU), which is briefly:
Copy the designed database
Delete configuration.php from copied root
Copy default Joomla! Installation folder to copied root
Export sql.file from original database to copied installation/sql/msql
Rename that to sample_data.sql
Upload whole content to the server
Install as a usual Joomla! site
All the time I getting:
Error: the XML response that was returned from the server is invalid.
in this reason I have to skip this message) when I select install sample data in my Joomla! pack installation. My template not appears as deafult and the places of module postions these are messages for e.g:
Warning: DB reports: DB function failed with error number 1146
Table 'masolat.jos_sobi2_language' doesn't exist SQL=SELECT * FROM jos_sobi2_language ORDER BY sobi2Lang in C:\wamp\www\masolat\components\com_sobi2\config.class.php on line 2534
...and so on.....
So prorbaly the whole process that I've made is false. That's why I would like ask you some help.
Have you any idea, how can I accomplish without any kind of Joomla! copy/restore extension?
Short guide, review, link, explanation will be appreciated.
Thank you in advance!
Regards: Nehogymar
There are two ways that you can install Joomla, the way that you described or the easy way for non-programmers.
Try to install joomla the easy way, There is very good explanation in Joomla documentation. try: http://help.joomla.org/content/view/39/132
There is also a excellent guide for installing Joomla on WAMP:
http://www.compassdesigns.net/joomla-tutorials/how-to-install-joomla-15
The simple way to make a copy of a Joomla website to install is to use Akeeba Backup. It makes a nice ZIP package with all of the files, settings, and database with a nice install script. I have a base install with all of the extensions I use to speed up configuration time.
http://extensions.joomla.org/extensions/access-a-security/site-security/backup/1606

Can Silverlight (SLOOB) start a process even with full trust?

I have been tasked with writing an installer with a silverlight out of browser application. I need to.
get the version off a local EXE
check a web service to see that it is the most recent version
download a zip if not
unpack the zip
overwrite the old EXE
start the EXE
This installer app is written in .NET WinForms now but the .NET framework is an obstacle for people to download.
The recommended solution is to use a SLOOB however i am not sure how to assign full trust. If i assign full trust can I start a process.
Thanks
Looking into this, I suspect you're going to have to create the process using WMI through the COM interface. At the end of the day, that makes this a very difficult option and very subject to failure due to a host of reasons (WMI being disabled or secured, user won't give full trust, etc.) I suspect you would be much better off creating a .msi deployment package or something similar that was able to go out and download the framework, if necessary. There are a lot of deployment models available, almost all of which feel superior to this one.
That said, if you're going to do this:
To get the COM object, you're going to want to use the AutomationFactory.CreateObject(...) API. Tim Heuer provides a sample here.
To actually do the WMI scripting, you're going to want to create the WbemScripting.SWbemLocator object as the root. From there, use the ConnectServer method to get a wmi service on the named machine. You can then interrogate the Win32_Process module to create new processes.
Edit: I spent a little time working on this and, even on my local machine as Admin I'm running into security problems. The correct code would be something similar to:
dynamic locatorService = AutomationFactory.CreateObject("WbemScripting.SWbemLocator");
dynamic wmiService = locatorService.ConnectServer("winmgmts:{impersonationLevel=impersonate,authentationLevel=Pkt}//./root/cimv2");
dynamic process = wmiService.Get("Win32_Process");
dynamic createParameters = process.Methods_["Create"].InParameters.SpawnInstance_;
createParameters.CommandLine = "cmd.exe";
wmiService.ExecMethod("Win32_Process", "Create", createParameters);
Silverlight 4 will have support for something like this: http://timheuer.com/blog/archive/2010/03/15/whats-new-in-silverlight-4-rc-mix10.aspx#sllauncher

Resources