Category: solution

  • Jenkins rebuild old build – by git commit

    Jenkins rebuild old build – by git commit

    Problem

    Jenkins is a great tool for automation server, with a huge number of available plugins. As such it is sometimes hard to find the right one. As I navigated across the sea of automation, there was always a concern -> How do we restore a previous build if the current build completes, but the deployed version has a non-expected error.

    Setting up a rebuild scenario in Jenkins brought to life a new dimension issues I was not expecting.

    Solution

    I completed the requirement by using the Rebuild plugin which adds a nice rebuild button to all the old builds. Got to the plugins page and check for Rebuild plugin. Restart Jenkins afterward just so we are sure everything is picked up correctly. The button to rebuild will be present in the old build details in every project. Rebuild will trigger the build with  same configuration as the original build was build with. The issue is that when using a versioning system (like GIT), the configuration stays the same. In my case it was still building the latest commit to the repository as the project was configured to get the latest version.

    The solution is to set a string parameter to your job. I set my parameter default value to develop as if no parameter is specified to I want to download the latest version of the develop branch.

    String parameter:

    • Name: COMMIT
    • Default value: develop

    Branches to build set to value: ${COMMIT}.

    Afterward I can run a Build  with Parameters and input a git revision of a previous build.

    To rebuild using old code check the old job details (revision number):

    then go to the project and press Build with parameters button.

    Paste the git revision in the input field and lunch the build.

    This way Jenkins builds (and deploys if configured) the current application with the requested revision from GIT.

    Hope it help anyone.

  • Oracle 12c RESTRICTED mode, disabled functionality

    Oracle 12c RESTRICTED mode, disabled functionality

    oracle databaseToday I learned a lot when our production database went in restricted mode. We had huge issues with our Oracle 12c database that was patched unsuccessfully. After the patch did not finish the database always restarted in RESTRICTED MODE, which means only admin / sys can connect to the database. All of our application could not access the database, which resulted in an all around panic situation. The cause was the half finished patch. The database detected that a patch did not finish correctly and because of that it always started restricted.

    The solution was to clear all data from the unsuccessful patch (I don’t know exactly where) and apply the patch again.

    Info about restricted database

    About it on Oracle page – https://docs.oracle.com/database/121/OSTMG/GUID-74FA4067-04D2-477B-A09C-40150BBCD702.html

    Below are some warnings from Oracle page about this special mode. Active sessions are not disconnected when enabling restricted mode. It is a good idea to start the database directly in restricted mode.

    To place an instance in restricted mode, where only users with administrative privileges can access it, use the SQL statement ALTER SYSTEM with the ENABLE RESTRICTED SESSION clause. After placing an instance in restricted mode, you should consider killing all current user sessions before performing any administrative tasks.

    To lift an instance from restricted mode, use ALTER SYSTEM with the DISABLE RESTRICTED SESSION clause.

    Useful commands

    You can check the status of the database with:

    SELECT logins from v$instance; — If “Allowed” , than the database is normally accessible.

    After that you can  enable or disable restricted session with:

    alter system enable restricted session;
    alter system disable restricted session;

    Granting users permission to access the restricted database with:

    grant restricted session to joshua;

    Disabled functionality

    Interesting thing is I could not find any info of what functionality is  disabled when database is in RESTRICTED MODE. I found on my own skin that the following thing do not work:

    • Scheduler (only if explicitly enabled)
    • APEX ( always asked for XDB username and password when accessing apex web page)
    • DB Links (failing with an awesome error as shown below)  After normal start the DB link was still not functioning. I am not sure if restricted mode disables it.
    DB link error message
    Error message when testing DB link from SQL Developer when the database is in restricted mode

     

    Hope it helps someone.

    Bye

  • Cntlm gateway mode setup for docker

    Cntlm gateway mode setup for docker

    In CNTLM we need to allow Gateway mode to allow other computers to connect trough our proxy. We used this in our corporate environment to allow docker images to be pulled from the web as docker does not have a nice way to hange proxies with NTLM authentication.

    We changed cntlm.ini around line 70.

    Uncommented Gateway flag

    # Enable to allow access from other computers
    #
    Gateway yes
    

    And for additional security specify specified who is allowed to connect to our proxy.

    # Useful in Gateway mode to allow/restrict certain IPs
    # Specifiy individual IPs or subnets one rule per line.
    #
    Allow 10.10.10.1
    Allow 127.0.0.1
    Allow 10.0.75.0/24
    Deny 0/0
    

    Be careful as docker for windows (not talking about docker toolbox) is not running under localhost, but its running in its own vhost environment. This means that you must specify the proxy in docker as http://10.10.10.1:3128/ and not use localhost or 127.0.0.1.

    Have a nice day.

  • Fingerprint driver for HP Elitebook 8560p Windows 10 64 bit

    I managed to finally set up my fingerprint sensor on HP Elitebook 8560p with Windows 10 64-bit.

    As HP does not provide drivers for Windows 10 for this model (I dont know why that is because it is still a great notebook in 2016), I luckily searched in google and found out that Asus also had the same problem when upgrading to Windows 10.

    Asus was also good enough to provide a driver for that. I found it on http://www.asus.com/Commercial-Notebooks/ASUSPRO_ESSENTIAL_PU551JD/HelpDesk_Download/ and the description of the driver is as follows:

    Synaptics Fingerprint Driver (For Windows 10 Upgrade)
    To avoid Windows login with fingerprints failing due to compatibility issue after upgrade to Windows 10, please un-install ” Fingerprint Driver” and “ASUS Fingerprint driver and utility”. And, update “Synaptics Fingerprint driver” to 4.5.306.0 or above. Then, you can login Windows 10 with new feature “Windows Hello” by fingerprints.

    I installed the driver and manually select it for the device in Device Manage (Like forcing windows to use it because they didn’t recommend it).

    Here is a fast image tutorial.
    1. Install driver
    2. Go to Device manager and manually select from the list

    fingerprint23. Check device installationfingerprint

    4. Go to Windows Hello to set up fingerprints.fignerprint3Hope it helps anyone.

  • Editing Word 2013 Table of Content

    Editing Word 2013 Table of Content

    Table of content
    Table of content for images
    Table of contents is build upon styles that are present in the text. Usually direct modification on a word or two are preserved even if the style for a paragraph changes.

    This phenomena can also be spotted when building table of contents for images or graphs. If your table of contents has some “Graph 1” bold and, lets say, “Graph 2” not bold, but in the text lower they are both bold, then styles kicked in. As you can see in the picture – “Slika 2” has a style of Heading 1 and it appears different from “Slike 1” which has style Caption. You should go to the caption text of “Graph 2”, mark the whole line and remove all styles. (Thus removing Heading 1)

    Then apply the changes you wish to have in the table of contents.

    Refreshing the ToC should pick up your custom formatting.

    ps: You should set up ToC properties when creating them. Afterwards modifications like line spacing or paragraph spacing cannot me made.

  • Fastest way to create a file list

    Dir helpThe fastest way on Windows to create a file with a list of all files in a directory and its subdirectories  is pretty simple. This should work on most windows desktops. Open the Command Prompt ( Start button -> cmd ) and run the following command.
    The /S switch searches all subdirectories.
    The /B switch ommits all header and other stuff.
    The > forwards all output to the specified filelist.txt file.

     

    dir /B /S > filelist.txt
    

    * For other switches check the output of

    dir /?

    Tested on a structure composed of 1,5M files. Works flawlessly.

  • Avast residues

    Avast is a really nice antivirus program with friendly user interface and easy setup.

    While it works efficiently, it amazed me that it has a really harsh internet firewall that you don’t even know it works. It occurred to me many times that it had something to do with playing lan games using old Hamachi. We could see the server hosted on the pc behind avast, but we could not connect to it. It would just start connecting forever and never coming to a point. Uninstallation of Avast resolved the problem immediately so we knew something was up wit hit. Later it showed up that even disabling only the firewall part worked well.

    The new story that amazed me was also related to avast. The program itself was uninstalled, but a service remained running in the background. Even after many computer restarts. The user could connect everywhere outside but nobody could connect to him. We tried with TeamViewer – no go (
    Error Code: WaitForConnectFailed ), Remote deskotp – didnt work (stalled at initializing … ), RealVNC didn’t work. Any connection to the user pc was failing. We noticed the problem because the user could not connect to an OpenVPN server, probably because the server wasn’t able to make a connection to the user. Firewall were disabled at all.

    Then I notice an avast service running in task manager and it came to my mind that it shouldn’t be there as Avast was previously uninstalled. The avast process could not be killed as the administrator didn’t have enough rights (right! clear as the sky on a rainy day). Fortunately Avast provides the right tool with clear instructions on how to remove it. The process is described at http://www.avast.com/uninstall-utility and easy to follow if you know what safe mode is.

    After removal everything started working normally again.