Simplest Enterprise Continuous Integration Solutions

Saturday, February 25, 2012

Enterprise Linux: Local Yum Repository

Steps to create a Local Yum Repository for Puppetlabs Puppet Open Source on Red Hat 5

# Red Hat 5

[root@linux64-yum-repo-server ~]# uname -a
Linux linux64-yum-repo-server 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

# Puppetlabs yum.repo config file

[root@linux64-yum-repo-server ~]# cat /etc/yum.repos.d/puppetlabs.repo
[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/el/5/products/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
[puppetlabs_dependencies]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/el/5/dependencies/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs

# install Apache httpd

[root@linux64-yum-repo-server ~]# yum install httpd
[root@linux64-yum-repo-server ~]# chkconfig httpd on
[root@linux64-yum-repo-server ~]# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]

# install yum-utils, createrepo 

[root@linux64-yum-repo-server ~]# yum install yum-utils createrepo

# get a temp copy of puppetlabs, puppetlabs_dependencies RPMS

[root@linux64-yum-repo-server ~]# reposync -r puppetlabs
puppetlabs                                                                                                              
[root@linux64-yum-repo-server yum.repos.d]# reposync -r puppetlabs_dependencies

# create Local Yum Repository folder structure

[root@linux64-yum-repo-server ~]# mkdir -p /var/www/html/puppet/el/5/products/x86_64

# move the temp local copy of RPMs into local yum repository folder

[root@linux64-yum-repo-server ~]# mv /root/puppetlabs/* /var/www/html/puppet/el/5/products/x86_64/ 
[root@linux64-yum-repo-server ~]# mkdir -p /var/www/html/puppet/el/5/dependencies/x86_64/
[root@linux64-yum-repo-server ~]# mv /root/puppetlabs_dependencies/* /var/www/html/puppet/el/5/dependencies/x86_64/

# create Local Yum Repository 

[root@linux64-yum-repo-server ~]# cd /var/www/html/puppet/el/5/products/x86_64/
[root@linux64-yum-repo-server x86_64]# createrepo -u http://linux64-yum-repo-server/puppet/el/5/products/x86_64/ -d .
80/80 - puppetlabs-release-5-1.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@linux64-yum-repo-server ~]# cd /var/www/html/puppet/el/5/dependencies/x86_64/ 
[root@linux64-yum-repo-server x86_64]# createrepo -u http://linux64-yum-repo-server/puppet/el/5/dependencies/x86_64/ -d .
24/24 - rubygem-stomp-doc-1.2.2-1.el5.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@linux64-yum-repo-server ~]# ls -al /var/www/html/puppet
total 16
drwxr-xr-x 3 root root 4096 Feb  5 17:09 .
drwxr-xr-x 4 root root 4096 Feb  5 17:02 ..
drwxr-xr-x 3 root root 4096 Feb  5 16:57 el
-rw-r--r-- 1 root root 1711 Feb  5 17:11 RPM-GPG-KEY-puppetlabs

# Local Yum Repository Web



# generate Local Yum Repository associated yum.repo config file 

[root@linux64-yum-repo-server ~]# cat /etc/yum.repos.d/ puppetlabs.repo
[puppetlabs]
name=(local yum repo of) Puppet Labs Packages
baseurl=http://linux64-yum-repo-server/puppet/el/5/products/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://linux64-yum-repo-server/puppet/RPM-GPG-KEY-puppetlabs
[puppetlabs_dependencies]
name=(local yum repo of) Puppet Labs Packages
baseurl=http://linux64-yum-repo-server/puppet/el/5/dependencies/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://linux64-yum-repo-server/puppet/RPM-GPG-KEY-puppetlabs

# get Yum Repository List

[root@linux64-yum-repo-server ~]# yum repolist
Loaded plugins: security
repo id                                     repo name                                                                              status
el5_u5_base                                 Enterprise Linux 5 Update 5 installation media copy (x86_64)                           enabled: 4,372
puppetlabs                                  (local yum repo of) Puppet Labs Packages                                               enabled:    80
puppetlabs_dependencies                     (local yum repo of) Puppet Labs Packages                                               enabled:    24
repolist: 13,726

Saturday, February 18, 2012

JIRA security: Anonymous user access

Make sure JIRA Anonymous user has read only access

1. JIRA: Administration -> Issues -> Permission Schemes -> bla bla Schemes -> Permissions -> Browse Projects, Add -> Group (Anyone)
2. Within JIRA project associated Workflow:
All of Transitions has conditions: Only users in group jira-users can execute this transition
3. without login into JIRA, browsing http://<MY_JIRA_SERVER>:8080/browse/<MY_JIRA_PROJECT_KEY>-123 will see below Login button

Saturday, February 11, 2012

JIRA migration: BugZilla multi-line desc/comments

BugZilla MySQL database

The longtext table contains each bug_id's associated multi-line desc and multi-line comments.


MySQL query to get bug_id and the text result

SELECT 

    bug_id
    , thetext
FROM
    bugs.longdescs as T1
where
    T1.bug_id in (SELECT 
           bug_id
        FROM
            bugs.bugs
        where
            product_id in (SELECT 
                    id
                FROM
                    bugs.products
                where
                    (name like 'MY_BUGZILLA_PROJECT')))
Order by T1.bug_id
For each of bug_ids associated multi-line thetext entries: 
First entry is the bug_id associated desc
Remaining entries (if existed) are the bug_id associated comments.


Migrate BugZilla multi-line desc & comments into JIRA

1. create a BugZilla query for JIRA migration without multi-line desc/comments
2. JIRA, Administration -> System -> Import & Export -> Import External projects -> CSV Import
3. create a MySQL query to only contains bug ids, and save the query result as XML format

SELECT 
    bug_id
FROM
    bugs.bugs
where
    product_id in (SELECT 
            id
        FROM
            bugs.products
        where
            (name like ' MY_BUGZILLA_PROJECT ')))
Order by bug_id
4. run a PERL script (i.e. xmlBugIdExportIntoJIRA.pl) through JIRA cli interface updating desc/comments on Linux platform from where BugZilla's desc/comments UTF-8 code issue will be solved)

NAME

    xmlBugIdExportIntoJira.pl

SYNOPSIS

  DESCRIPTION

    This script is going to migrate exported XML format from BugZilla MySQL with bug_id, thetext file into Jira.

  VERSION

    Version 1.0

  USAGE

       perl xmlBugIdExportIntoJira.pl --jira_project_key "[jira_project_key]" --jira_field_for_bug_id "[jira_field_for_bug_id]" --jira_field_for_bugzilla_thetext "[jira_field_for_bugzilla_thetext]" --exported_xml_format_bugzilla_mysql_id_description_file "[exported_xml_format_bugzilla_mysql_id_description_file]" --jira_cli "[jira_cli]"
    *   --jira_project_key "[jira_project_key]" - Jira Project Key. *Required*
    *   --jira_field_for_bug_id "[jira_field_for_bug_id]" - Jira field maps to bug_id field. *Required*
    *   --jira_field_for_bugzilla_thetext="[jira_field_for_bugzilla_thetext]" - Jira field maps to bug_id Description field. *Required*
    *   --exported_xml_format_bugzilla_mysql_id_description_file "[exported_xml_format_bugzilla_mysql_id_description_file]" - Fullpath of exported xml format BugZilla MySQL bug_id file. *Required*
    *   execute MySQL query SELECT bug_id FROM bugs.bugs where product_id=(SELECT id FROM bugs.products where name = "MY_BUGZILLA_PROJECT" and save the results into xml
        SELECT bug_id, thetext FROM bugs.longdescs as T1 where T1.bug_id = id Order By bug_when
    *   --jira_cli "[jira_cli]" - Full path of atlassian-cli. *Required*

  EXAMPLE

       1. Migrate exported XML format BugZilla bug_id, thetext file into Jira.
       perl /tmp/xmlBugIdExportIntoJira.pl --jira_project_key "MY_JIRA_PROJECT_KEY" --jira_field_for_bug_id "bug_id" --jira_field_for_bugzilla_thetext "description" --exported_xml_format_bugzilla_mysql_id_description_file /tmp/BugZilla_MySQL_id_longdescs.xml --jira_cli /opt/atlassian-cli-2.4.0/jira.sh

Saturday, February 4, 2012

Enterprise Linux: CollabNet Subversion Edge

# get CollabNetSubversionEdge

Download CollabNetSubversionEdge-2.2.1_linux-x86_64.tar.gz from http://www.open.collab.net/downloads/subversion/

CollabNet Subversion Edge 2.2.1 (for Linux 64 bit)
   License: GNU Affero General Public License 3.0 (AGPLv3)
   Certified platforms: Red Hat Enterprise Linux 5.x
                        Red Hat Enterprise Linux 6.x
                        CentOS 5.x
                        SuSE Linux Enterprise 11.x
   NOTE: These are the platforms we formally certify when testing.  CollabNet
   Subversion Edge is known to work on virtually all Linux distributions and is
   informally tested on others such as Ubuntu and Fedora.
  
   Requirements
   * Java 1.6 JRE/JDK must be installed. We recommend the JRE provided by
     Sun/Oracle.  When testing on 64-bit Linux we have used the 64-bit JVM.
   * Python 2.4 to 2.6 must be installed.

# Java 1.6

[root@linux64-svn-server ~]# rpm -Uvh /tmp/ jdk-6u23-linux-amd64.rpm
[root@linux64-svn-server ~]# echo "export JAVA_HOME=/usr/java/jdk1.6.0_23" >> /etc/profile
[root@linux64-svn-server ~]# source /etc/profile

# Python version

[root@linux64-svn-server ~]# python –V
Python 2.4.3

# extract CollabNetSubversionEdge tar.gz using none root, sudo user

[root@linux64-svn-server ~]# useradd csvn
[root@linux64-svn-server ~]# su - csvn
[csvn@linux64-svn-server ~]$ chmod a+x /tmp/CollabNetSubversionEdge-2.2.1_linux-x86_64.tar.gz
[csvn@linux64-svn-server ~]$ tar zxf /tmp/CollabNetSubversionEdge-2.2.1_linux-x86_64.tar.gz
[csvn@linux64-svn-server ~]$ exit # as root now
[root@linux64-svn-server ~]# cp –pr /tmp/csvn /opt
[root@linux64-svn-server ~]# cd /opt/csvn/bin
[root@linux64-svn-server bin]# ./csvn install
Detected RHEL or Fedora:
Installing the CSVN Console daemon..
Setting RUN_AS_USER to: 'root'. Please edit '../data/conf/csvn.conf' if this needs to be adjusted
Setting JAVA_HOME to: '/usr/java/jdk1.6.0_23'. Please edit '../data/conf/csvn.conf' if this needs to be adjusted.
./csvn start
Starting CSVN Console......
CSVN Console started
Waiting for application to initialize (this may take a minute).................
CSVN Console is ready at http://localhost:3343/csvn
./csvn-httpd install
Detected RHEL or Fedora:
Installing the Subversion Edge Apache Server daemon..
./csvn-httpd start
Starting Subversion Edge Apache Server:                    [  OK  ]

# change port from 18080 to 443 or 80

[root@linux64-svn-server ~]# chown root:csvn /opt/csvn/lib/httpd_bind/httpd_bind
[root@linux64-svn-server ~]# chmod u+s /opt/csvn/lib/httpd_bind/httpd_bind

# make sure csvn has access permission for repositories

[root@linux64-svn-server ~]# chown –R csvn /opt/csvn/data/repositories

# http://localhost:4434/csvn