socotra-build 0.3.22 → 0.3.23
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/s3_uploader.rb +25 -0
- data/lib/socotra-build.rb +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ff371fbd0cce6094dd41d75aa93b08441817c241
|
|
4
|
+
data.tar.gz: aea9ada6a6b9abd515c590b3bb8789e58fe1a2d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf449a0e65e799b2ffc07bd932ba8b4e61a9e38f047729c27d90476195c23812bcc8ac9924a96910b66a8b352545fab296b2b792ae4c011504be9b4fbe18f275
|
|
7
|
+
data.tar.gz: 678c50e680c4070cc7acc7bff3539466824774fe25375d86e455f5e8518ce40d00372c58fa55360cd3778a73566fc6930b6ed2dfe2bada1ac2bc7a341811e861
|
data/lib/s3_uploader.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
def get_path_inject
|
|
2
|
+
return path_inject = "AWS_DEFAULT_REGION=\"eu-west-1\" " +
|
|
3
|
+
"AWS_ACCESS_KEY_ID=\"#{$master_access_key}\" " +
|
|
4
|
+
"AWS_SECRET_ACCESS_KEY=\"#{$master_secret_key}\" "
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def sanitize_for_filename(path)
|
|
8
|
+
return path.tr("/", "_")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def upload_to_s3 (source_dir, s3_destination)
|
|
12
|
+
cmd_sync = "#{get_path_inject} aws s3 sync #{source_dir} s3://#{s3_destination} --acl public-read"
|
|
13
|
+
source_sanitized = sanitize_for_filename(source_dir)
|
|
14
|
+
destination_sanitized = sanitize_for_filename(s3_destination)
|
|
15
|
+
system_safe(cmd_sync, "s3_upload_#{source_sanitized}_to_#{destination_sanitized}", "distribution failed on aws sync")
|
|
16
|
+
puts "distribution success to s3: #{s3_destination}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def copy_directory(s3_source, s3_destination)
|
|
20
|
+
cmd = "#{get_path_inject} aws s3 sync s3://#{s3_source} s3://#{s3_destination} --delete --acl public-read"
|
|
21
|
+
source_sanitized = sanitize_for_filename(s3_source)
|
|
22
|
+
destination_sanitized = sanitize_for_filename(s3_destination)
|
|
23
|
+
system_safe(cmd, "s3_copy_#{source_sanitized}_to_#{destination_sanitized}", "distribution failed on aws copy")
|
|
24
|
+
puts "distribution success to s3: #{s3_destination}"
|
|
25
|
+
end
|
data/lib/socotra-build.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'open3'
|
|
2
2
|
require 'set'
|
|
3
|
+
require_relative 's3_uploader'
|
|
3
4
|
|
|
4
5
|
def self.safe_retry(cmd, description, error_message="command failed", raise_on_fail=true, log_level="ERROR", log=true, tries=3)
|
|
5
6
|
begin
|
|
@@ -134,3 +135,10 @@ def self.install_socotra_py_modules(pymodule, environment)
|
|
|
134
135
|
cmd = "/usr/bin/yes|sudo pip install --trusted-host socotra-pypi-euw1.s3-website-eu-west-1.amazonaws.com --extra-index-url=http://socotra-pypi-euw1.s3-website-eu-west-1.amazonaws.com/#{pymodule}/#{environment} #{pymodule}"
|
|
135
136
|
system_safe(cmd, "install_#{pymodule}_py_module", "Failed to install #{pymodule}")
|
|
136
137
|
end
|
|
138
|
+
|
|
139
|
+
def self.sync_logs(repo, build_id)
|
|
140
|
+
cmd = "cp -f console.log logs/"
|
|
141
|
+
system_safe(cmd, "copy_console_log", "Failed to copy console log")
|
|
142
|
+
|
|
143
|
+
upload_to_s3("logs", "socotra-builds/#{repo}/#{build_id}")
|
|
144
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: socotra-build
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.23
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Antenesse
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-12-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Common functions for build
|
|
14
14
|
email: chris.antenesse@socotra.com
|
|
@@ -16,6 +16,7 @@ executables: []
|
|
|
16
16
|
extensions: []
|
|
17
17
|
extra_rdoc_files: []
|
|
18
18
|
files:
|
|
19
|
+
- lib/s3_uploader.rb
|
|
19
20
|
- lib/socotra-build-update.rb
|
|
20
21
|
- lib/socotra-build.rb
|
|
21
22
|
homepage: http://rubygems.org/gems/socotra
|