SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
Integrate Gitolite with Mantis
                   Jiahe Jou, 2012/08/31
Revisions
  DATE        Author              DESCRIPTION

2012/08/31   Jiahe Jou   Draft.
Outlines
● Main Idea of Synchronizing to Mantis

● Git Hooks Procedure

● Gitolite Common Hooks

● Intermediate Programs

● Send SMTP Mail
Main Idea of Synchronizing to Mantis


   User Git Push
                      Gitolite




                                     Post Hooks




                                 Intermediate Programs
      Mantis
Git Hooks Procedure
● The hooks procedure after git push:
    Receive Objects
                                             Post-commit Hook


                         Post-receive Hook
    Pre-receive Hook




                          Post-update Hook
       Update
      Repository
Gitolite Common Hooks
● /usr/share/gitolite/hooks/common/*
● post-receive:
   ...
   # read input objects
   while read oldrev newrev ref
   do
        # get the commit information
        subj=`git show -s --format="%s" $newrev`
        diff=`git show $newrev...$oldrev`
        msgs="$subj

   $diff"
         # excute pre-write perl script to sync mantis
         /home/gitolite/git2mantis.pl "$msgs"
         ...
   done
Gitolite Common Hooks
● Execute "gl-setup" to push common hooks to
  each repository
● Check whether hook scripts are pushed to
  each repositories
● Location: ~/repositories/*/hooks/*
Intermediate Programs
● /home/gitolite/git2mantis.pl
   #!/usr/bin/perl
   #
   # admin's ssh key must setup in 192.168.0.1
   # to log-in automatically.
   $host = "admin@192.168.0.1";

   $sshcmd = "/usr/bin/ssh ";
   $phpcmd = "/usr/bin/php";
   $checkincmd = "/var/www/mantis/scripts/git-checkin.php";

   $msg = $ARGV[0];

   # excute remote programs through ssh
   `$sshcmd $host $phpcmd $checkincmd <<< "$msg"`;
Intermediate Programs
● Mantis Server: 192.168.0.1:
  /var/www/mantis/scripts/git-checkin.php
   ...
   # Parsing the input to get issue number
   $t_commit_regexp = "/issueD*(d*)/";
   $t_line = readline("");
   iif (preg_match( $t_commit_regexp, $t_line, $t_matches ) == 0) {
          echo "Comment does not reference any issues.n";
          exit( 0 );
    }
   $t_issues[0] = $t_matches[1];
   ...
   # Call mantis helper function to insert issue note
   $t_issue_id = $t_issues[0];
   helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment,
   $t_history_old_value, $t_history_new_value, false );
Send SMTP Mail
● Modify ~/.gitolite/conf/gitolite.conf to add
  mailing list with "hooks.mailinglist"
   ...
   repo    testing
        config hooks.mailinglist = "alex.lin@innocomm.com, cc.
   chen@innocomm.com, cookie.liu@innocomm.com,
   ...
   jiahe.jou@innocomm.com, weili.luo@innocomm.com"
        RW+ = @all
        R         = daemon
        R         = gitweb
   ...
Send SMTP Mail
● Add the following to post-receive
   ...
   # get mailing list by git config
   recipients=`git config hooks.mailinglist`

   # execute pre-write script to send mail
   /home/gitolite/git2mail.py "$subj" "$diff" "$recipients"
   ...
Send SMTP Mail
● Send mail through SMTP with gmail
  #!/usr/bin/python
  import sys
  import smtplib

  subject = sys.argv[1]
  body = sys.argv[2]
  recipients = sys.argv[3]
  gmail_user = 'admin@gmail.com'
  gmail_pwd = 'password'

  smtpserver = smtplib.SMTP("smtp.gmail.com",587)
  smtpserver.ehlo()
  smtpserver.starttls()
  smtpserver.ehlo()
  smtpserver.login(gmail_user, gmail_pwd)

  header = 'To:' + recipients + 'n' + 'From: ' + gmail_user + 'n' + 'Subject:
  [Gitolite] ' + subject + ' n'
  msg = header + 'n' + body + 'nn'

  smtpserver.sendmail(gmail_user, recipients.split(', '), msg)
  smtpserver.close()
The End

Mais conteúdo relacionado

Mais procurados

Steam Learn: Composer
Steam Learn: ComposerSteam Learn: Composer
Steam Learn: Composerinovia
 
Central Iowa Linux Users Group June 2020 Meeting Apache Guacamole
Central Iowa Linux Users Group June 2020 Meeting  Apache GuacamoleCentral Iowa Linux Users Group June 2020 Meeting  Apache Guacamole
Central Iowa Linux Users Group June 2020 Meeting Apache GuacamoleAndrew Denner
 
gunicorn introduction
gunicorn introductiongunicorn introduction
gunicorn introductionAdam Lowry
 
Building serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformBuilding serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformLucio Grenzi
 
Analysing Github events with Neo4j
Analysing Github events with Neo4jAnalysing Github events with Neo4j
Analysing Github events with Neo4jChristophe Willemsen
 
Searched gems which supports only ruby 2.6
Searched gems which supports only ruby 2.6Searched gems which supports only ruby 2.6
Searched gems which supports only ruby 2.6Maki Toshio
 
Tomáš Čorej - OpenSSH
Tomáš Čorej - OpenSSHTomáš Čorej - OpenSSH
Tomáš Čorej - OpenSSHwebelement
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about gitSothearin Ren
 
Rust vs. Go: qual è il linguaggio più adatto al tuo progetto?
Rust vs. Go: qual è il linguaggio più adatto al tuo progetto?Rust vs. Go: qual è il linguaggio più adatto al tuo progetto?
Rust vs. Go: qual è il linguaggio più adatto al tuo progetto?Claudio Capobianco
 
Open Social Data (Jaca), Alejandro Rivero
Open Social Data (Jaca), Alejandro RiveroOpen Social Data (Jaca), Alejandro Rivero
Open Social Data (Jaca), Alejandro RiveroAragón Open Data
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GITArpit Mohan
 
Spark Day 2017- Spark 의 과거, 현재, 미래
Spark Day 2017- Spark 의 과거, 현재, 미래Spark Day 2017- Spark 의 과거, 현재, 미래
Spark Day 2017- Spark 의 과거, 현재, 미래Moon Soo Lee
 

Mais procurados (20)

Steam Learn: Composer
Steam Learn: ComposerSteam Learn: Composer
Steam Learn: Composer
 
Chef
ChefChef
Chef
 
Central Iowa Linux Users Group June 2020 Meeting Apache Guacamole
Central Iowa Linux Users Group June 2020 Meeting  Apache GuacamoleCentral Iowa Linux Users Group June 2020 Meeting  Apache Guacamole
Central Iowa Linux Users Group June 2020 Meeting Apache Guacamole
 
gunicorn introduction
gunicorn introductiongunicorn introduction
gunicorn introduction
 
Building serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformBuilding serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platform
 
Git beyond basics
Git   beyond basicsGit   beyond basics
Git beyond basics
 
Analysing Github events with Neo4j
Analysing Github events with Neo4jAnalysing Github events with Neo4j
Analysing Github events with Neo4j
 
Searched gems which supports only ruby 2.6
Searched gems which supports only ruby 2.6Searched gems which supports only ruby 2.6
Searched gems which supports only ruby 2.6
 
Tupperware
TupperwareTupperware
Tupperware
 
Tomáš Čorej - OpenSSH
Tomáš Čorej - OpenSSHTomáš Čorej - OpenSSH
Tomáš Čorej - OpenSSH
 
Puppet and Openshift
Puppet and OpenshiftPuppet and Openshift
Puppet and Openshift
 
Git setuplinux
Git setuplinuxGit setuplinux
Git setuplinux
 
Bash Scripting Workshop
Bash Scripting WorkshopBash Scripting Workshop
Bash Scripting Workshop
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Rust vs. Go: qual è il linguaggio più adatto al tuo progetto?
Rust vs. Go: qual è il linguaggio più adatto al tuo progetto?Rust vs. Go: qual è il linguaggio più adatto al tuo progetto?
Rust vs. Go: qual è il linguaggio più adatto al tuo progetto?
 
Open Social Data (Jaca), Alejandro Rivero
Open Social Data (Jaca), Alejandro RiveroOpen Social Data (Jaca), Alejandro Rivero
Open Social Data (Jaca), Alejandro Rivero
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
 
Socket.IO
Socket.IOSocket.IO
Socket.IO
 
Nginx-lua
Nginx-luaNginx-lua
Nginx-lua
 
Spark Day 2017- Spark 의 과거, 현재, 미래
Spark Day 2017- Spark 의 과거, 현재, 미래Spark Day 2017- Spark 의 과거, 현재, 미래
Spark Day 2017- Spark 의 과거, 현재, 미래
 

Destaque

Destaque (20)

Camping og facebook_til_download
Camping og facebook_til_downloadCamping og facebook_til_download
Camping og facebook_til_download
 
The perng mha ngan box
The perng mha ngan boxThe perng mha ngan box
The perng mha ngan box
 
General Catalog GFS Indonesia
General Catalog GFS IndonesiaGeneral Catalog GFS Indonesia
General Catalog GFS Indonesia
 
The perng mha ngan box
The perng mha ngan boxThe perng mha ngan box
The perng mha ngan box
 
видеокамера сони
видеокамера сонивидеокамера сони
видеокамера сони
 
Nicholas John Spykman
Nicholas John SpykmanNicholas John Spykman
Nicholas John Spykman
 
Membangun Nasionalisme melalui Upacara Bendera - Universitas Katolik Parahyan...
Membangun Nasionalisme melalui Upacara Bendera - Universitas Katolik Parahyan...Membangun Nasionalisme melalui Upacara Bendera - Universitas Katolik Parahyan...
Membangun Nasionalisme melalui Upacara Bendera - Universitas Katolik Parahyan...
 
Quotationsanddialogue 2014
Quotationsanddialogue 2014Quotationsanddialogue 2014
Quotationsanddialogue 2014
 
FA Catalog
FA CatalogFA Catalog
FA Catalog
 
Arro capabilities lean revised 2010
Arro capabilities   lean revised 2010Arro capabilities   lean revised 2010
Arro capabilities lean revised 2010
 
Apu presentation
Apu presentationApu presentation
Apu presentation
 
Showdonttell
ShowdonttellShowdonttell
Showdonttell
 
Algorithm Final Presentation
Algorithm Final PresentationAlgorithm Final Presentation
Algorithm Final Presentation
 
Reading
ReadingReading
Reading
 
Luat thue thu nhap ca nhan 2007
Luat thue thu nhap ca nhan 2007Luat thue thu nhap ca nhan 2007
Luat thue thu nhap ca nhan 2007
 
пдд азербайджана
пдд азербайджанапдд азербайджана
пдд азербайджана
 
Gallus2002 usermanual
Gallus2002 usermanualGallus2002 usermanual
Gallus2002 usermanual
 
Nokia n9 ug_ru
Nokia n9 ug_ruNokia n9 ug_ru
Nokia n9 ug_ru
 
Internet Week Yahoo! Academy: How Direct Can You Be?
Internet Week Yahoo! Academy: How Direct Can You Be?Internet Week Yahoo! Academy: How Direct Can You Be?
Internet Week Yahoo! Academy: How Direct Can You Be?
 
Wallander - Becka
Wallander - BeckaWallander - Becka
Wallander - Becka
 

Semelhante a Integrate gitolite with mantis

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git TutorialSage Sharp
 
Git the Wnderfull tool
Git the Wnderfull toolGit the Wnderfull tool
Git the Wnderfull toolAmitoj Singh
 
Git Workshop : Git On The Server
Git Workshop : Git On The ServerGit Workshop : Git On The Server
Git Workshop : Git On The ServerWildan Maulana
 
Getting started with git
Getting started with gitGetting started with git
Getting started with gitPawan Kumar.v
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How tolanhuonga3
 
Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?Celestine Omin
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 
Getting some Git
Getting some GitGetting some Git
Getting some GitBADR
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitJohn Ombagi
 

Semelhante a Integrate gitolite with mantis (20)

Advanted git
Advanted git Advanted git
Advanted git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Git the Wnderfull tool
Git the Wnderfull toolGit the Wnderfull tool
Git the Wnderfull tool
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git Workshop : Git On The Server
Git Workshop : Git On The ServerGit Workshop : Git On The Server
Git Workshop : Git On The Server
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Github basics
Github basicsGithub basics
Github basics
 
Getting started with git
Getting started with gitGetting started with git
Getting started with git
 
Git Primer
Git PrimerGit Primer
Git Primer
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 
Git basics
Git basicsGit basics
Git basics
 
Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 
Git github
Git githubGit github
Git github
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Integrate gitolite with mantis

  • 1. Integrate Gitolite with Mantis Jiahe Jou, 2012/08/31
  • 2. Revisions DATE Author DESCRIPTION 2012/08/31 Jiahe Jou Draft.
  • 3. Outlines ● Main Idea of Synchronizing to Mantis ● Git Hooks Procedure ● Gitolite Common Hooks ● Intermediate Programs ● Send SMTP Mail
  • 4. Main Idea of Synchronizing to Mantis User Git Push Gitolite Post Hooks Intermediate Programs Mantis
  • 5. Git Hooks Procedure ● The hooks procedure after git push: Receive Objects Post-commit Hook Post-receive Hook Pre-receive Hook Post-update Hook Update Repository
  • 6. Gitolite Common Hooks ● /usr/share/gitolite/hooks/common/* ● post-receive: ... # read input objects while read oldrev newrev ref do # get the commit information subj=`git show -s --format="%s" $newrev` diff=`git show $newrev...$oldrev` msgs="$subj $diff" # excute pre-write perl script to sync mantis /home/gitolite/git2mantis.pl "$msgs" ... done
  • 7. Gitolite Common Hooks ● Execute "gl-setup" to push common hooks to each repository ● Check whether hook scripts are pushed to each repositories ● Location: ~/repositories/*/hooks/*
  • 8. Intermediate Programs ● /home/gitolite/git2mantis.pl #!/usr/bin/perl # # admin's ssh key must setup in 192.168.0.1 # to log-in automatically. $host = "admin@192.168.0.1"; $sshcmd = "/usr/bin/ssh "; $phpcmd = "/usr/bin/php"; $checkincmd = "/var/www/mantis/scripts/git-checkin.php"; $msg = $ARGV[0]; # excute remote programs through ssh `$sshcmd $host $phpcmd $checkincmd <<< "$msg"`;
  • 9. Intermediate Programs ● Mantis Server: 192.168.0.1: /var/www/mantis/scripts/git-checkin.php ... # Parsing the input to get issue number $t_commit_regexp = "/issueD*(d*)/"; $t_line = readline(""); iif (preg_match( $t_commit_regexp, $t_line, $t_matches ) == 0) { echo "Comment does not reference any issues.n"; exit( 0 ); } $t_issues[0] = $t_matches[1]; ... # Call mantis helper function to insert issue note $t_issue_id = $t_issues[0]; helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, false );
  • 10. Send SMTP Mail ● Modify ~/.gitolite/conf/gitolite.conf to add mailing list with "hooks.mailinglist" ... repo testing config hooks.mailinglist = "alex.lin@innocomm.com, cc. chen@innocomm.com, cookie.liu@innocomm.com, ... jiahe.jou@innocomm.com, weili.luo@innocomm.com" RW+ = @all R = daemon R = gitweb ...
  • 11. Send SMTP Mail ● Add the following to post-receive ... # get mailing list by git config recipients=`git config hooks.mailinglist` # execute pre-write script to send mail /home/gitolite/git2mail.py "$subj" "$diff" "$recipients" ...
  • 12. Send SMTP Mail ● Send mail through SMTP with gmail #!/usr/bin/python import sys import smtplib subject = sys.argv[1] body = sys.argv[2] recipients = sys.argv[3] gmail_user = 'admin@gmail.com' gmail_pwd = 'password' smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(gmail_user, gmail_pwd) header = 'To:' + recipients + 'n' + 'From: ' + gmail_user + 'n' + 'Subject: [Gitolite] ' + subject + ' n' msg = header + 'n' + body + 'nn' smtpserver.sendmail(gmail_user, recipients.split(', '), msg) smtpserver.close()