Skip to content

Commit

Permalink
Changes in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoodnasr committed Oct 6, 2020
1 parent 2fc8c4a commit 2379179
Show file tree
Hide file tree
Showing 345 changed files with 2,660 additions and 1,724 deletions.
Empty file modified Installation.md
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified Unixconfig/autodeploy
100644 → 100755
Empty file.
Empty file modified YAML.md
100644 → 100755
Empty file.
Empty file modified autodeploy-jira/__init__.py
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion autodeploy-jira/jira-client.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ def getProjectKeys(self):

if __name__=="__main__":
c=jiraClient("http://shgp.kfshrc.edu.sa/jira",'mkalioby','wanted85')
print c.getProjectKeys()
print(c.getProjectKeys())
Empty file modified client/__init__.py
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/all-wcprops
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/entries
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/text-base/Client.py.svn-base
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/text-base/ClientJob.py.svn-base
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/text-base/Common.py.svn-base
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/text-base/Config.py.svn-base
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/text-base/Connect.py.svn-base
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/text-base/README.svn-base
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/text-base/__init__.py.svn-base
100644 → 100755
Empty file.
Empty file modified client/autodeploy_client/.svn/text-base/config.cfg.svn-base
100644 → 100755
Empty file.
23 changes: 12 additions & 11 deletions client/autodeploy_client/Client.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config
import ClientJob as Job
import Connect
from . import Config
from . import ClientJob as Job
from . import Connect
import simplejson
import xml.dom.minidom
from operator import itemgetter
Expand Down Expand Up @@ -82,6 +82,14 @@ def Deploy(self, workdir, configFile, owner=''):
result = self._send(msg)
return result

def Integrate(self, workdir, configFile, owner=''):
global msg
if owner == '':
owner = Config.Owner
msg = Job.createIntegrateMessage(workdir=workdir, configFile=configFile, scm=self.scm, owner=owner)
result = self._send(msg)
return result

def CheckUp(self):
return Connect.connect(self.server, self.port, 5)

Expand All @@ -95,18 +103,11 @@ def ListCommits(self, workdir, page=0, rpp=10, owner='',options=None):
for line in res.split("\n"):
if line=="": continue
info = line.split(",,")
# print line
# if HEAD:
# info[0] = "HEAD"
# HEAD = False
try:

d = {"Hash": info[0], "Short": info[1], "Author": info[2], "Committed": info[3], "Message": info[4]}
result.append(d)

except:
print "Error while parsing line (%s)"%line
#print result
print("Error while parsing line (%s)"%line)
return result

def SwitchCommit(self, workdir, commit, owner=''):
Expand Down
67 changes: 45 additions & 22 deletions client/autodeploy_client/ClientJob.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ def importKey():
#print "KEY Opened" , key
return key

def sign(owner,scm,msg):
b = (owner + scm + msg).encode('utf-8')
key = (importKey().encrypt(b, "")[0])
return base64.encodebytes(key).decode("utf8")


def createGetBranchs(workdir, scm, owner,options=None):
sec = base64.encodestring(importKey().encrypt(owner + scm + "LIST-BRNACHS", "")[0])
sec= sign(owner,scm,"LIST-BRNACHS")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n' % (owner, "LIST-BRNACHS", sec, scm)
f += '<workdir>%s</workdir>' % workdir

if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
Expand All @@ -31,14 +36,14 @@ def createGetBranchs(workdir, scm, owner,options=None):
# Provide id, owner and command as string
# inputsFiles as List of file path
def createCloneMessage(owner, repo, workdir, key, scm, options=None):
sec=base64.encodestring(importKey().encrypt(owner+scm+"CLONE","")[0])
sec = sign(owner, scm, "CLONE")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"CLONE",sec,scm)
f += '<workdir>%s</workdir>'%workdir
f += '<repo>%s</repo>'%repo
f += '<sshkey>%s</sshkey>'%key
if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
Expand All @@ -49,77 +54,95 @@ def createCloneMessage(owner, repo, workdir, key, scm, options=None):


def createPullMessage(owner,workdir,key, scm, options=None):
sec=base64.encodestring(importKey().encrypt(owner+scm+"PULL","")[0])
sec = sign(owner, scm, "PULL")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"PULL",sec,scm)
f += '<workdir>%s</workdir>'%workdir
#f += '<repo>%s</repo>'%repo
f += '<sshkey>%s</sshkey>'%key
if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
f += '</job>'
return f

def createListTagsMessage(owner, workdir,key, scm, options=None):
sec=base64.encodestring(importKey().encrypt(owner+scm+"LIST-TAGS","")[0])
sec = sign(owner, scm, "LIST-TAGS")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"LIST-TAGS",sec,scm)
f += '<workdir>%s</workdir>'%workdir
f += '<sshkey>%s</sshkey>'%key

if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
f += '</job>'
return f

def createSwitchTagMessage(owner, workdir, scm, tag, options=None):
sec=base64.encodestring(importKey().encrypt(owner+scm+"SWITCH-TAG","")[0])
sec = sign(owner, scm, "SWITCH-TAG")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"SWITCH-TAG",sec,scm)
f += '<workdir>%s</workdir>'%workdir
f += '<tag>%s</tag>'%tag

if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
f += '</job>'
return f

def createDeployMessage(owner, workdir, scm, configFile, options=None):
sec=base64.encodestring(importKey().encrypt(owner+scm+"DEPLOY","")[0])
sec = sign(owner, scm, "DEPLOY")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"DEPLOY",sec,scm)
f += '<workdir>%s</workdir>'%workdir
f += '<configFile>%s</configFile>'%configFile
print configFile
print(configFile)
conf=open(str(configFile)).read()
f += '<file>%s</file>'%(base64.encodestring(conf))

if options:
f += '<options>'
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
f += '</job>'
return f

def createIntegrateMessage(owner, workdir, scm, configFile, options=None):
sec = sign(owner, scm, "INTEGRATE")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%(owner,"INTEGRATE",sec,scm)
f += '<workdir>%s</workdir>'%workdir
f += '<configFile>%s</configFile>'%configFile
print(configFile)
conf=open(str(configFile)).read()
f += '<file>%s</file>'%(base64.encodestring(conf))

if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
f += '</job>'
return f

def createListCommitsMessage(owner, workdir, key, scm, options=None):
sec=base64.encodestring(importKey().encrypt(owner+scm+"LIST-COMMITS","")[0])
sec = sign(owner, scm, "LIST-COMMITS")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"LIST-COMMITS",sec,scm)
f += '<workdir>%s</workdir>'%workdir
f += '<sshkey>%s</sshkey>'%key

if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
Expand All @@ -128,44 +151,44 @@ def createListCommitsMessage(owner, workdir, key, scm, options=None):


def createSwitchCommitMessage(owner, workdir, commit,scm, options=None):
sec=base64.encodestring(importKey().encrypt(owner+scm+"SWITCH-COMMIT","")[0])
sec = sign(owner, scm, "SWITCH-COMMIT")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"SWITCH-COMMIT",sec,scm)
f += '<workdir>%s</workdir>'%workdir
f += '<commit>%s</commit>'%commit

if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
f += '</job>'
return f

def creategetCommitsDiffMessage(owner, workdir, commit, scm,options=None):
print owner,workdir,commit,scm
sec=base64.encodestring(importKey().encrypt(owner+str(scm)+"DIFF-COMMIT","")[0])
print(owner,workdir,commit,scm)
sec = sign(owner, scm, "DIFF-COMMIT")
#sec=base64.encodestring(importKey().encrypt(owner+scm+"DIFF-COMMIT","")[0])
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"DIFF-COMMIT",sec,scm)
f += '<workdir>%s</workdir>'%workdir
f += '<commit>%s</commit>'%commit

if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
f += '</job>'
return f

def createGetChangeLog(owner,workdir,scm,options=None):
sec = base64.encodestring(importKey().encrypt(owner + scm + "LIST-CHANGES", "")[0])
sec = sign(owner, scm, "LIST-CHANGES")
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n' % (owner, "LIST-CHANGES", sec, scm)
f += '<workdir>%s</workdir>' % workdir
if options:
f += '<options>'
for option in options.keys():
for option in list(options.keys()):
f += "<option name='%s'>%s</option>" % (option, options[option])

f += "</options>"
Expand Down
1 change: 0 additions & 1 deletion client/autodeploy_client/Common.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
EOM="\n\n###"

2 changes: 1 addition & 1 deletion client/autodeploy_client/Config.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ConfigParser
import configparser
import os


Expand Down
22 changes: 12 additions & 10 deletions client/autodeploy_client/Connect.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import socket, base64, time, sys, subprocess
import Config

import socket, time
EOM = "\n\n###"


def Send(message,server,port):
if waitTillAlive(server, port):
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((server, port))
client.send(message + EOM)
output = str(message) + str(EOM)
client.sendall(output.encode('utf-8'))
chunks = []
while True:
buf = client.recv(10000)
buf = (client.recv(10000)).decode("utf-8")
if len(buf) < 5:
chunks[-1] += buf
if len(chunks) == 0:
chunks.append(buf)
else:
chunks[-1] += buf
else:
chunks.append(str(buf))
if EOM in chunks[-1]:
Expand All @@ -27,7 +29,8 @@ def connect(domain,port,timeout=10):
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.settimeout(timeout)
client.connect((domain, port))
client.send("TEST: HELLO\n\n###")
output = 'TEST: HELLO\n\n###'
client.sendall(output.encode('utf-8'))
client.close()
return True
except IOError:
Expand All @@ -38,11 +41,10 @@ def waitTillAlive(domain, port):
secondTime = False
while (1):
if connect(domain,port):
if secondTime: print "Connected To:",domain
if secondTime: print("Connected To:",domain)
break
else:
time.sleep(5)
secondTime = True
print "Trying again...."
print("Trying again....")
return True

Empty file modified client/autodeploy_client/README
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions client/autodeploy_client/__init__.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /usr/bin/env python
#! /usr/bin/env python3.7

from Client import *
from .Client import *
Empty file modified client/autodeploy_client/my
100644 → 100755
Empty file.
Empty file modified client/config/.svn/all-wcprops
100644 → 100755
Empty file.
Empty file modified client/config/.svn/entries
100644 → 100755
Empty file.
Empty file modified client/config/.svn/text-base/config.cfg.svn-base
100644 → 100755
Empty file.
Empty file modified client/config/config.cfg
100644 → 100755
Empty file.
Empty file modified client/setup.py
100644 → 100755
Empty file.
69 changes: 0 additions & 69 deletions client/test.py

This file was deleted.

Empty file modified deploy-scripts/start-server.sh
100644 → 100755
Empty file.
Empty file modified exampleConfig/EventsHandler/delDir.sh
100644 → 100755
Empty file.
Empty file modified exampleConfig/EventsHandler/startApache.sh
100644 → 100755
Empty file.
Empty file modified exampleConfig/EventsHandler/stopApache.sh
100644 → 100755
Empty file.
Empty file modified exampleConfig/autodeploy.yaml
100644 → 100755
Empty file.
Empty file modified exampleConfig/registry.yaml
100644 → 100755
Empty file.
Empty file modified exampleConfig/sample.yaml
100644 → 100755
Empty file.
Loading

0 comments on commit 2379179

Please sign in to comment.