autodeploy 0.0.6 → 0.0.7
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 +4 -4
- data/lib/autodeploy/deployer.rb +12 -6
- data/lib/autodeploy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 611b9faadcff46bf572557b3c6a2a2514057228a
|
4
|
+
data.tar.gz: e25f3d8d5816513333b3c8a5f1a761437c196af5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f73f9ae6604389330fe2ae05a5207f24bbf0ca2e64b7ee5f685227230d261be6085238f7301ff65ae7d58c68492280389473b01eb92f2acb15fa75a91e3b02f3
|
7
|
+
data.tar.gz: d906b78523b9620eee33579735447ef5728a339ce957025b488c42496a54cea459e4d3a4e0a33d40d8edd12a021037579ed7beda51e7c0a083f9d91c368f13b2
|
data/lib/autodeploy/deployer.rb
CHANGED
@@ -7,7 +7,9 @@ module Autodeploy
|
|
7
7
|
@job = jenkins_job
|
8
8
|
end
|
9
9
|
|
10
|
-
def run
|
10
|
+
def run
|
11
|
+
return unless ready_to_deploy?(@config['job'])
|
12
|
+
|
11
13
|
deploy_build = get_build_to_deploy(@config['job'])
|
12
14
|
build_full_file_path(deploy_build)
|
13
15
|
|
@@ -48,24 +50,28 @@ module Autodeploy
|
|
48
50
|
|
49
51
|
filename = [deploy_build.build_number, deploy_build.git_sha, artifact_file_name].compact.join('-')
|
50
52
|
@filepath = File.join(@config['download_dir'], filename)
|
51
|
-
|
53
|
+
end
|
54
|
+
|
55
|
+
def ready_to_deploy?(job_name)
|
56
|
+
Models::DeployBuild.where(job_name: job_name).order("created_at DESC").exists?
|
57
|
+
end
|
52
58
|
|
53
59
|
def get_build_to_deploy(job_name)
|
54
|
-
|
60
|
+
Models::DeployBuild.where(job_name: job_name).order("created_at DESC").first
|
55
61
|
end
|
56
62
|
|
57
|
-
def has_file_been_downloaded
|
63
|
+
def has_file_been_downloaded
|
58
64
|
File.exists?(@filepath)
|
59
65
|
end
|
60
66
|
|
61
|
-
def record_successful_deployment
|
67
|
+
def record_successful_deployment
|
62
68
|
Models::DeployAudit.create(host: Socket.gethostname,
|
63
69
|
build_number: @job['number'],
|
64
70
|
jenkins_build_timestamp: @job['timestamp'],
|
65
71
|
created_at: Time.now.to_i * 1000)
|
66
72
|
end
|
67
73
|
|
68
|
-
def has_file_been_deployed
|
74
|
+
def has_file_been_deployed
|
69
75
|
Models::DeployAudit.where(host: Socket.gethostname,
|
70
76
|
build_number: @job['number'],
|
71
77
|
jenkins_build_timestamp: @job['timestamp']).exists?
|
data/lib/autodeploy/version.rb
CHANGED