diff --git a/.gitignore b/.gitignore index ad89d990..4a6c9e4f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /productization kickstarts/generated/*.ks scripts/Gemfile.dev.rb +config/creds/*.json diff --git a/bin/release-build.sh b/bin/release-build.sh index d86e9954..3781f58e 100755 --- a/bin/release-build.sh +++ b/bin/release-build.sh @@ -12,5 +12,10 @@ if [[ $# != 1 ]]; then fi log_file="/build/logs/${1}.log" -nohup time ruby ${BUILD_DIR}/scripts/vmbuild.rb --type release --upload --reference $1 --copy-dir ${1%%-*} > $log_file 2>&1 & +copy_dir="${1%%-*}" + +nohup sh -c \ + "echo time ruby ${BUILD_DIR}/scripts/vmbuild.rb --type release --upload --reference $1 --copy-dir $copy_dir \ + && time ruby ${BUILD_DIR}/scripts/vmpublish.rb --copy-dir $copy_dir" \ + > $log_file 2>&1 & echo "${1} release build kicked off, see log @ $log_file ..." diff --git a/config/creds/README.creds b/config/creds/README.creds new file mode 100644 index 00000000..752632ef --- /dev/null +++ b/config/creds/README.creds @@ -0,0 +1,21 @@ +This directory will hold credentials files on the build host. + +All JSON files in this directory are ignored via gitignore(5) to reduce the +risk that credentials accentally get commit. + +The following files are currently used: + +* gce.json + + A service account JSON file for the Google Cloud Platform. This file can be + generated as describe here: + https://cloud.google.com/storage/docs/authentication#generating-a-private-key + +* atlas.json + + A JSON file with an Atlas token, as follows: + + { + "username": "", + "token": " :string, :short => 'd', :default => "master" + opt :type, type_desc, :type => :string, :short => 't', :default => "stable" +end + +copy_dir = FILESHARE_DIR.join(options[:copy_dir], options[:type]) + +Dir.foreach(copy_dir) do |filename| + next if ['.', '..'].include? filename + + parts = filename.split('.').first.split('-') + next unless parts.length >= 6 # only release builds, which are build from a tag (name-version) + next unless parts[0] == 'manageiq' + target = parts[1] + next unless ['vagrant', 'gce'].include? target + reference = parts[2] + version = parts[3..parts.length-3].join('-') + + image = copy_dir.join(filename) + uuid = find_imgfac_image(image) + + $log.info "processing image: #{image}" + $log.info "target = #{target}, reference = #{reference}, version = #{version}" + $log.info "imagefactory image = #{uuid}" + + upload_imgfac_image(uuid, target, reference, version) +end