continuous_integration 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/continuous_integration/tasks.rb +42 -24
- data/lib/continuous_integration/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6861ebf56ab9b7be83c9427a3da27c130011875b
|
4
|
+
data.tar.gz: 67d6efd2f9c89bf471360447e36bd8c8045b5cb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46cd6111bd9bd741e2c42dde0d60cab58be5cc63f0b25080e908d92edad72e29de4faadf9f26c0cd08897adfefd3ee8566555dbf4c4848fc2da025b692c9934b
|
7
|
+
data.tar.gz: 2af7be57a2894f0576525871ba3496d1bd9a2d37d40a514ba0720f89cf69a611bd3283e0cb529e921a184e24cdddf5296c5959e61f8409e17dbee07657d3c4e5
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
require_relative 'constants'
|
4
3
|
|
5
4
|
# Class to perform operations on receiving http calls
|
@@ -12,7 +11,7 @@ class DockerEndpoint < WEBrick::HTTPServlet::AbstractServlet
|
|
12
11
|
@result_api = ''
|
13
12
|
@result_ui = ''
|
14
13
|
@git_branch = ''
|
15
|
-
|
14
|
+
@response = ''
|
16
15
|
end
|
17
16
|
|
18
17
|
# curl localhost:8080/docker
|
@@ -31,36 +30,57 @@ class DockerEndpoint < WEBrick::HTTPServlet::AbstractServlet
|
|
31
30
|
@git_branch = request_hash[:trigger_metadata][:ref]
|
32
31
|
@git_branch = @git_branch.split('/')
|
33
32
|
@git_branch = @git_branch.last
|
34
|
-
perform_operations
|
35
33
|
|
34
|
+
#loop in case already processing a request
|
35
|
+
while true
|
36
|
+
if $LOCK
|
37
|
+
sleep 10
|
38
|
+
puts "Waiting"
|
39
|
+
else
|
40
|
+
puts "File not there"
|
41
|
+
break
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
perform_operations
|
46
|
+
|
47
|
+
_response.body = JSON.generate @response
|
48
|
+
_response['Content-Type'] = 'application/json'
|
49
|
+
|
36
50
|
rescue StandardError => error
|
37
|
-
|
51
|
+
|
52
|
+
#unset lock on exceptions
|
53
|
+
$LOCK = false
|
54
|
+
|
55
|
+
print "Not a valid Quay post " + error.to_s
|
38
56
|
end
|
39
57
|
end
|
40
58
|
|
41
59
|
# method to perform various CI operations
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
60
|
+
def perform_operations
|
61
|
+
|
62
|
+
#set lock
|
63
|
+
$LOCK = true
|
64
|
+
|
65
|
+
docker_update
|
66
|
+
sleep 10
|
67
|
+
|
68
|
+
run_api_tests
|
69
|
+
run_ui_tests
|
70
|
+
generate_log
|
71
|
+
slack_post
|
72
|
+
|
73
|
+
#unset lock
|
74
|
+
$LOCK = false
|
75
|
+
end
|
56
76
|
|
57
77
|
# update docker images locally
|
58
78
|
def docker_update
|
59
79
|
Dir.chdir(DOCKER_PATH) do
|
60
80
|
# perform docker images update
|
61
|
-
`sudo docker
|
62
|
-
`sudo docker
|
63
|
-
`sudo docker
|
81
|
+
`sudo docker-compose kill`
|
82
|
+
`sudo docker-compose rm`
|
83
|
+
`sudo docker-compose up -d`
|
64
84
|
end
|
65
85
|
end
|
66
86
|
|
@@ -88,13 +108,11 @@ class DockerEndpoint < WEBrick::HTTPServlet::AbstractServlet
|
|
88
108
|
end
|
89
109
|
|
90
110
|
def generate_log
|
91
|
-
|
111
|
+
@response = {
|
92
112
|
'Docker logs' => @process_status,
|
93
113
|
'API logs' => @result_api,
|
94
114
|
'SE logs' => @result_ui
|
95
115
|
}
|
96
|
-
response.body = JSON.generate obj
|
97
|
-
response['Content-Type'] = 'application/json'
|
98
116
|
end
|
99
117
|
|
100
118
|
def slack_post
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: continuous_integration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ragavendra Nagraj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|