continuous_integration 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7f887e62539b001ed8a91792715575bf11eb611
4
- data.tar.gz: de448300183180273b068b45c0ac5fe759d2c3f8
3
+ metadata.gz: 6861ebf56ab9b7be83c9427a3da27c130011875b
4
+ data.tar.gz: 67d6efd2f9c89bf471360447e36bd8c8045b5cb5
5
5
  SHA512:
6
- metadata.gz: 02c49139bfa3d11fffdaec5780a900f39c214ff9591e8347f308aea3da730f0545359b9a84005d2e1f5b1b2f419c9c70fabeb3b2f8b322de92400706602a6439
7
- data.tar.gz: 1dccc2de883ba08661d5fa997f9e470bc5067229338a7723949044e7ee94e27124c68ce25b3129a35990f274a395cf99280b1004ac887fed12dd55475a74a9d1
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
- @lock = true
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
- print "Not a valid Quay post " + error.to_s
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
- def perform_operations
43
- # handle requests one at a time (to avoid concurrency) - Needs testing
44
- while @lock
45
- @lock = true
46
- docker_update
47
- sleep 10
48
-
49
- run_api_tests
50
- run_ui_tests
51
- generate_log
52
- slack_post
53
- @lock = false
54
- end
55
- end
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 compose kill`
62
- `sudo docker compose rm`
63
- `sudo docker compose up -d`
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
- obj = {
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContinuousIntegration
4
- VERSION = '0.0.14'
4
+ VERSION = '0.0.15'
5
5
  end
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.14
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-02 00:00:00.000000000 Z
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest