continuous_integration 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 208e94873ad13f770240f60aa39f94aa2eea0ead
|
4
|
+
data.tar.gz: ea5a6c56cb5d8c1a354b17fbd31fa0f46d886197
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3236c19aa7380c68aa1c7140b11289f8233a939020119aae0cdf23a0ec0826463d9c84f1786e056a3c00538bfef58dfd487b7cfaec12ad8a9d878e81f76cc21f
|
7
|
+
data.tar.gz: 06e32535d3c3890650b5ca8004d9f36349212fcbf51a8b9573263fef06741230da2def4d72ffba8a8c27cad75117a102c928c17461b8670a9128f135495af40b
|
data/README.md
CHANGED
@@ -31,9 +31,19 @@ gem install continuous_integration
|
|
31
31
|
|
32
32
|
### Usage
|
33
33
|
|
34
|
+
#### Pre-requisites
|
35
|
+
1. Make sure that `Docker` and `Aha tool` are installed
|
36
|
+
2. The `Paths` in the constants.rb file should be valid
|
37
|
+
3. The user may need sudo access as docker needs them
|
38
|
+
|
34
39
|
#### Constants
|
35
40
|
Default paths have been defined in the [constants.rb](lib/continuous_integration/constants.rb) file. Update it aqccordingls as per your needs. It can also be overriden by passing them when running the server env var.
|
36
41
|
|
42
|
+
`DOCKER_PATH` is the path to your repo containing the `docker-compose.yml` file having all the services defined in it
|
43
|
+
|
44
|
+
|
45
|
+
NOTE: Paths must be valid for the CI to work correctly
|
46
|
+
|
37
47
|
#### Running
|
38
48
|
In a console just run
|
39
49
|
|
@@ -48,8 +58,8 @@ Put the below contents in a ruby file say `ci_server.rb`
|
|
48
58
|
#ci_server.rb
|
49
59
|
|
50
60
|
require 'continuous_integration'
|
51
|
-
server = ContinuousIntegration.setup_server
|
52
|
-
ContinuousIntegration.start_server server
|
61
|
+
server = ContinuousIntegration::Server.setup_server
|
62
|
+
ContinuousIntegration::Server.start_server server
|
53
63
|
```
|
54
64
|
|
55
65
|
and then run it like below to start the CI server
|
@@ -57,10 +67,18 @@ and then run it like below to start the CI server
|
|
57
67
|
ruby ci_server.rb
|
58
68
|
```
|
59
69
|
|
60
|
-
You should be able to receive the POST requests on `http://localhost:8080
|
70
|
+
You should be able to receive the POST requests on `http://localhost:8080/` now
|
61
71
|
|
62
72
|
Also, if you access the above URL in a browser, it shows you the content of the `API_SPECS_PATH/logs` as a web server, which apparently happens to be the path of the api test tun logs generated by the aha tool
|
63
73
|
|
74
|
+
#### POSTing to the server
|
75
|
+
This curl should POST the sample Quay successful completion json to the CI
|
76
|
+
|
77
|
+
```
|
78
|
+
curl -d "@schemas/quay-success-completed.json" -H "Content-Type: application/json" -X POST http://localhost:8080/qa/docker
|
79
|
+
```
|
80
|
+
|
81
|
+
|
64
82
|
#### Stopping the server
|
65
83
|
```
|
66
84
|
Ctrl + C
|
data/bin/continuous_integration
CHANGED
@@ -2,9 +2,14 @@
|
|
2
2
|
|
3
3
|
# this file is like the global variable file
|
4
4
|
|
5
|
+
# path to your docker compose file ( many services here )
|
5
6
|
DOCKER_PATH = "#{ENV['HOME']}/repos/devops/services/soa/dev"
|
7
|
+
|
8
|
+
# path to your integration API tests
|
6
9
|
API_SPECS_PATH = "#{ENV['HOME']}/repos/api_tests"
|
7
|
-
|
10
|
+
|
11
|
+
# path to your UI or selenium tests
|
12
|
+
UI_SPECS_PATH = "#{ENV['HOME']}/repos/ui_tests"
|
8
13
|
|
9
14
|
HOST = 'dockervm'
|
10
15
|
# HOST="https://amzn-se001"
|
@@ -12,15 +12,18 @@ class DockerEndpoint < WEBrick::HTTPServlet::AbstractServlet
|
|
12
12
|
@result_api = ''
|
13
13
|
@result_ui = ''
|
14
14
|
@git_branch = ''
|
15
|
-
@lock =
|
15
|
+
@lock = true
|
16
16
|
end
|
17
17
|
|
18
18
|
# curl localhost:8080/docker
|
19
19
|
# POST call made by quay to CI server
|
20
20
|
def do_POST(request, _response)
|
21
|
+
|
22
|
+
#print "Request is #{request}"
|
21
23
|
# parse JSOn to hash key
|
22
24
|
request_hash = JSON.parse(request.body, symbolize_names: true)
|
23
25
|
|
26
|
+
begin
|
24
27
|
# fetch the github repo name
|
25
28
|
@repo_name = request_hash[:name]
|
26
29
|
|
@@ -29,6 +32,10 @@ class DockerEndpoint < WEBrick::HTTPServlet::AbstractServlet
|
|
29
32
|
@git_branch = @git_branch.split('/')
|
30
33
|
@git_branch = @git_branch.last
|
31
34
|
perform_operations
|
35
|
+
|
36
|
+
rescue StandardError => error
|
37
|
+
print "Not a valid Quay post " + error.to_s
|
38
|
+
end
|
32
39
|
end
|
33
40
|
|
34
41
|
# method to perform various CI operations
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"repository": "mynamespace/repository",
|
3
|
+
"namespace": "mynamespace",
|
4
|
+
"name": "repository",
|
5
|
+
"docker_url": "quay.io/mynamespace/repository",
|
6
|
+
"homepage": "https://quay.io/repository/mynamespace/repository/build?current=some-fake-build",
|
7
|
+
"visibility": "public",
|
8
|
+
|
9
|
+
"build_id": "build_uuid",
|
10
|
+
"docker_tags": ["latest", "foo", "bar"],
|
11
|
+
|
12
|
+
"trigger_kind": "github",
|
13
|
+
"trigger_id": "some-id-here",
|
14
|
+
"trigger_metadata": {
|
15
|
+
"default_branch": "master",
|
16
|
+
"ref": "refs/heads/somebranch",
|
17
|
+
"commit": "42d4a62c53350993ea41069e9f2cfdefb0df097d",
|
18
|
+
"commit_info": {
|
19
|
+
"url": "http://path/to/the/commit",
|
20
|
+
"message": "Some commit message",
|
21
|
+
"date": 2395748365,
|
22
|
+
"author": {
|
23
|
+
"username": "fakeauthor",
|
24
|
+
"url": "http://path/to/fake/author/in/scm",
|
25
|
+
"avatar_url": "http://www.gravatar.com/avatar/fakehash"
|
26
|
+
},
|
27
|
+
"committer": {
|
28
|
+
"username": "fakecommitter",
|
29
|
+
"url": "http://path/to/fake/comitter/in/scm",
|
30
|
+
"avatar_url": "http://www.gravatar.com/avatar/fakehash"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ragavendra Nagraj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/continuous_integration/server.rb
|
61
61
|
- lib/continuous_integration/tasks.rb
|
62
62
|
- lib/continuous_integration/version.rb
|
63
|
+
- schemas/quay-success-completed.json
|
63
64
|
homepage: https://rubygems.org/gems/continuous_integration
|
64
65
|
licenses:
|
65
66
|
- MIT
|