Skip to content

Commit 8b2b8b7

Browse files
committed
Changes in CI
1 parent b22da8d commit 8b2b8b7

File tree

345 files changed

+2662
-1657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

345 files changed

+2662
-1657
lines changed

Diff for: Installation.md

100644100755
File mode changed.

Diff for: LICENSE

100644100755
File mode changed.

Diff for: README.md

100644100755
File mode changed.

Diff for: Unixconfig/autodeploy

100644100755
File mode changed.

Diff for: YAML.md

100644100755
File mode changed.

Diff for: autodeploy-jira/__init__.py

100644100755
File mode changed.

Diff for: autodeploy-jira/jira-client.py

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ def getProjectKeys(self):
2626

2727
if __name__=="__main__":
2828
c=jiraClient("http://shgp.kfshrc.edu.sa/jira",'mkalioby','wanted85')
29-
print c.getProjectKeys()
29+
print(c.getProjectKeys())

Diff for: client/__init__.py

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/all-wcprops

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/entries

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/text-base/Client.py.svn-base

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/text-base/ClientJob.py.svn-base

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/text-base/Common.py.svn-base

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/text-base/Config.py.svn-base

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/text-base/Connect.py.svn-base

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/text-base/README.svn-base

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/text-base/__init__.py.svn-base

100644100755
File mode changed.

Diff for: client/autodeploy_client/.svn/text-base/config.cfg.svn-base

100644100755
File mode changed.

Diff for: client/autodeploy_client/Client.py

100644100755
+12-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import Config
2-
import ClientJob as Job
3-
import Connect
1+
from . import Config
2+
from . import ClientJob as Job
3+
from . import Connect
44
import simplejson
55
import xml.dom.minidom
66
from operator import itemgetter
@@ -82,6 +82,14 @@ def Deploy(self, workdir, configFile, owner=''):
8282
result = self._send(msg)
8383
return result
8484

85+
def Integrate(self, workdir, configFile, owner=''):
86+
global msg
87+
if owner == '':
88+
owner = Config.Owner
89+
msg = Job.createIntegrateMessage(workdir=workdir, configFile=configFile, scm=self.scm, owner=owner)
90+
result = self._send(msg)
91+
return result
92+
8593
def CheckUp(self):
8694
return Connect.connect(self.server, self.port, 5)
8795

@@ -95,18 +103,11 @@ def ListCommits(self, workdir, page=0, rpp=10, owner='',options=None):
95103
for line in res.split("\n"):
96104
if line=="": continue
97105
info = line.split(",,")
98-
# print line
99-
# if HEAD:
100-
# info[0] = "HEAD"
101-
# HEAD = False
102106
try:
103-
104107
d = {"Hash": info[0], "Short": info[1], "Author": info[2], "Committed": info[3], "Message": info[4]}
105108
result.append(d)
106-
107109
except:
108-
print "Error while parsing line (%s)"%line
109-
#print result
110+
print("Error while parsing line (%s)"%line)
110111
return result
111112

112113
def SwitchCommit(self, workdir, commit, owner=''):

Diff for: client/autodeploy_client/ClientJob.py

100644100755
+45-22
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ def importKey():
1212
#print "KEY Opened" , key
1313
return key
1414

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

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

2126
if options:
2227
f += '<options>'
23-
for option in options.keys():
28+
for option in list(options.keys()):
2429
f += "<option name='%s'>%s</option>" % (option, options[option])
2530

2631
f += "</options>"
@@ -31,14 +36,14 @@ def createGetBranchs(workdir, scm, owner,options=None):
3136
# Provide id, owner and command as string
3237
# inputsFiles as List of file path
3338
def createCloneMessage(owner, repo, workdir, key, scm, options=None):
34-
sec=base64.encodestring(importKey().encrypt(owner+scm+"CLONE","")[0])
39+
sec = sign(owner, scm, "CLONE")
3540
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"CLONE",sec,scm)
3641
f += '<workdir>%s</workdir>'%workdir
3742
f += '<repo>%s</repo>'%repo
3843
f += '<sshkey>%s</sshkey>'%key
3944
if options:
4045
f += '<options>'
41-
for option in options.keys():
46+
for option in list(options.keys()):
4247
f += "<option name='%s'>%s</option>" % (option, options[option])
4348

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

5055

5156
def createPullMessage(owner,workdir,key, scm, options=None):
52-
sec=base64.encodestring(importKey().encrypt(owner+scm+"PULL","")[0])
57+
sec = sign(owner, scm, "PULL")
5358
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"PULL",sec,scm)
5459
f += '<workdir>%s</workdir>'%workdir
5560
#f += '<repo>%s</repo>'%repo
5661
f += '<sshkey>%s</sshkey>'%key
5762
if options:
5863
f += '<options>'
59-
for option in options.keys():
64+
for option in list(options.keys()):
6065
f += "<option name='%s'>%s</option>" % (option, options[option])
6166

6267
f += "</options>"
6368
f += '</job>'
6469
return f
6570

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

7277
if options:
7378
f += '<options>'
74-
for option in options.keys():
79+
for option in list(options.keys()):
7580
f += "<option name='%s'>%s</option>" % (option, options[option])
7681

7782
f += "</options>"
7883
f += '</job>'
7984
return f
8085

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

8792
if options:
8893
f += '<options>'
89-
for option in options.keys():
94+
for option in list(options.keys()):
9095
f += "<option name='%s'>%s</option>" % (option, options[option])
9196

9297
f += "</options>"
9398
f += '</job>'
9499
return f
95100

96101
def createDeployMessage(owner, workdir, scm, configFile, options=None):
97-
sec=base64.encodestring(importKey().encrypt(owner+scm+"DEPLOY","")[0])
102+
sec = sign(owner, scm, "DEPLOY")
98103
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%( owner,"DEPLOY",sec,scm)
99104
f += '<workdir>%s</workdir>'%workdir
100105
f += '<configFile>%s</configFile>'%configFile
101-
print configFile
106+
print(configFile)
107+
conf=open(str(configFile)).read()
108+
f += '<file>%s</file>'%(base64.encodestring(conf))
109+
110+
if options:
111+
f += '<options>'
112+
for option in list(options.keys()):
113+
f += "<option name='%s'>%s</option>" % (option, options[option])
114+
115+
f += "</options>"
116+
f += '</job>'
117+
return f
118+
119+
def createIntegrateMessage(owner, workdir, scm, configFile, options=None):
120+
sec = sign(owner, scm, "INTEGRATE")
121+
f = '<job owner="%s" type="%s" sec="%s" scm="%s">\n'%(owner,"INTEGRATE",sec,scm)
122+
f += '<workdir>%s</workdir>'%workdir
123+
f += '<configFile>%s</configFile>'%configFile
124+
print(configFile)
102125
conf=open(str(configFile)).read()
103126
f += '<file>%s</file>'%(base64.encodestring(conf))
104127

105128
if options:
106129
f += '<options>'
107-
for option in options.keys():
130+
for option in list(options.keys()):
108131
f += "<option name='%s'>%s</option>" % (option, options[option])
109132

110133
f += "</options>"
111134
f += '</job>'
112135
return f
113136

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

120143
if options:
121144
f += '<options>'
122-
for option in options.keys():
145+
for option in list(options.keys()):
123146
f += "<option name='%s'>%s</option>" % (option, options[option])
124147

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

129152

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

136159
if options:
137160
f += '<options>'
138-
for option in options.keys():
161+
for option in list(options.keys()):
139162
f += "<option name='%s'>%s</option>" % (option, options[option])
140163

141164
f += "</options>"
142165
f += '</job>'
143166
return f
144167

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

153176
if options:
154177
f += '<options>'
155-
for option in options.keys():
178+
for option in list(options.keys()):
156179
f += "<option name='%s'>%s</option>" % (option, options[option])
157180

158181
f += "</options>"
159182
f += '</job>'
160183
return f
161184

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

171194
f += "</options>"

Diff for: client/autodeploy_client/Common.py

100644100755
-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
EOM="\n\n###"
2-

Diff for: client/autodeploy_client/Config.py

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ConfigParser
1+
import configparser
22
import os
33

44

Diff for: client/autodeploy_client/Connect.py

100644100755
+12-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import socket, base64, time, sys, subprocess
2-
import Config
3-
1+
import socket, time
42
EOM = "\n\n###"
53

64

75
def Send(message,server,port):
86
if waitTillAlive(server, port):
97
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
108
client.connect((server, port))
11-
client.send(message + EOM)
9+
output = str(message) + str(EOM)
10+
client.sendall(output.encode('utf-8'))
1211
chunks = []
1312
while True:
14-
buf = client.recv(10000)
13+
buf = (client.recv(10000)).decode("utf-8")
1514
if len(buf) < 5:
16-
chunks[-1] += buf
15+
if len(chunks) == 0:
16+
chunks.append(buf)
17+
else:
18+
chunks[-1] += buf
1719
else:
1820
chunks.append(str(buf))
1921
if EOM in chunks[-1]:
@@ -27,7 +29,8 @@ def connect(domain,port,timeout=10):
2729
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
2830
client.settimeout(timeout)
2931
client.connect((domain, port))
30-
client.send("TEST: HELLO\n\n###")
32+
output = 'TEST: HELLO\n\n###'
33+
client.sendall(output.encode('utf-8'))
3134
client.close()
3235
return True
3336
except IOError:
@@ -38,11 +41,10 @@ def waitTillAlive(domain, port):
3841
secondTime = False
3942
while (1):
4043
if connect(domain,port):
41-
if secondTime: print "Connected To:",domain
44+
if secondTime: print("Connected To:",domain)
4245
break
4346
else:
4447
time.sleep(5)
4548
secondTime = True
46-
print "Trying again...."
49+
print("Trying again....")
4750
return True
48-

Diff for: client/autodeploy_client/README

100644100755
File mode changed.

Diff for: client/autodeploy_client/__init__.py

100644100755
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#! /usr/bin/env python
1+
#! /usr/bin/env python3.7
22

3-
from Client import *
3+
from .Client import *

Diff for: client/autodeploy_client/my

100644100755
File mode changed.

Diff for: client/config/.svn/all-wcprops

100644100755
File mode changed.

Diff for: client/config/.svn/entries

100644100755
File mode changed.

Diff for: client/config/.svn/text-base/config.cfg.svn-base

100644100755
File mode changed.

Diff for: client/config/config.cfg

100644100755
File mode changed.

Diff for: client/setup.py

100644100755
File mode changed.

Diff for: client/test.py

100644100755
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'mohamed'
2-
import Client.Client as Client
2+
from client.autodeploy_client.Client import Client as Client
33
def test_clone():
44
c=Client("git")
55
return c.Clone("[email protected]:mkalioby/CD_Project.git","/tmp/CD_Project/","""-----BEGIN RSA PRIVATE KEY-----
@@ -66,4 +66,4 @@ def testTagsList():
6666
if __name__=="__main__":
6767
#print test_clone()
6868
#print test_pull()
69-
print testTagsList()
69+
print(testTagsList())

Diff for: deploy-scripts/start-server.sh

100644100755
File mode changed.

Diff for: exampleConfig/EventsHandler/delDir.sh

100644100755
File mode changed.

Diff for: exampleConfig/EventsHandler/startApache.sh

100644100755
File mode changed.

Diff for: exampleConfig/EventsHandler/stopApache.sh

100644100755
File mode changed.

Diff for: exampleConfig/autodeploy.yaml

100644100755
File mode changed.

Diff for: exampleConfig/registry.yaml

100644100755
File mode changed.

Diff for: exampleConfig/sample.yaml

100644100755
File mode changed.

Diff for: requirments.txt

100644100755
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
pycrypto
2-
django==1.8
3-
jsonfield==2.0.2
4-
django-tables2==1.0.4
5-
django-tables2-reports==0.1.3
1+
pycryptodome
2+
django==2.2
3+
jsonfield
4+
django-tables2
5+
django-tables2-reports
66
jira
77
django-mfa2
88
pyyaml

Diff for: server/Common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def run(executer, id=None):
1818
f.flush()
1919
f.close()
2020

21-
if len(stderr) > 0 and "fatal" in stderr:
22-
return "ERR:"+stderr
21+
if len(stderr) > 0 and b"fatal" in stderr:
22+
return b"ERR:"+stderr
2323
if stdout=="": return "Done"
2424
return stdout

Diff for: server/Config.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Server]
22
port: 4567
3-
publicKey: /home/shgpuser/dev/AutoDeploy/server/client.pub
3+
publicKey: /home/mahmood/Work/autodeploy/home/AutoDeploy/server/client.pub
44

55
[MISC]
66
log_limit: 30

0 commit comments

Comments
 (0)