Class: Moonshot::ArtifactRepository::S3BucketViaGithubReleases

Inherits:
S3Bucket
  • Object
show all
Includes:
BuildMechanism, Shell
Defined in:
lib/moonshot/artifact_repository/s3_bucket_via_github_releases.rb

Overview

S3 Bucket repository backed by GitHub releases. If a SemVer package isn’t found in S3, it is copied from GitHub releases.

Constant Summary

Constants included from Shell

Shell::CommandError, Shell::DEFAULT_RETRY_OPTIONS

Instance Attribute Summary

Attributes inherited from S3Bucket

#bucket_name

Attributes included from ResourcesHelper

#resources

Instance Method Summary collapse

Methods included from Shell

sh_out, #sh_retry, #sh_step, #shell

Methods inherited from S3Bucket

#initialize

Methods included from DoctorHelper

#doctor_hook

Methods included from CredsHelper

#as_client, #cd_client, #cf_client, #ec2_client, #iam_client, #s3_client

Constructor Details

This class inherits a constructor from Moonshot::ArtifactRepository::S3Bucket

Instance Method Details

#filename_for_version(version) ⇒ Object

TODO:

This is a super hacky place to handle the transfer, give

If release version, transfer from GitHub to S3. artifact repositories a hook before deploy.



39
40
41
42
43
# File 'lib/moonshot/artifact_repository/s3_bucket_via_github_releases.rb', line 39

def filename_for_version(version)
  s3_name = super
  github_to_s3(version, s3_name) if !@output_file && release?(version) && !in_s3?(s3_name)
  s3_name
end

#store_hook(build_mechanism, version) ⇒ Object

If release version, transfer from GitHub to S3.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/moonshot/artifact_repository/s3_bucket_via_github_releases.rb', line 20

def store_hook(build_mechanism, version)
  if release?(version)
    if (@output_file = build_mechanism.output_file)
      attach_release_asset(version, @output_file)
      # Upload to s3.
      super
    else
      # If there is no output file, assume it's on GitHub already.
      transfer_release_asset_to_s3(version)
    end
  else
    super
  end
end