def artifact_sign
      @signature = 'unsigned'

      # Clean up the existing signature file
      signature_cleanup

      Dir.chdir("#{$config['general']['app_cache']}/artifacts/") do
        # Generate the signature file and pick up the signature data
        unless system "gpg --use-agent --detach-sign artifact.#{@checksum}.tar.gz"
          $logger.error 'Unable to sign the artifact, an unexpected failure occured. No file uploaded.'
          return false
        end

        if File.exist?("artifact.#{@checksum}.tar.gz.sig")
          $logger.info 'A signature file was successfully generated.'
        else
          $logger.error 'A signature file was NOT generated.'
          return false
        end

        # Convert the signature into base64. It's easier to bundle all the
        # metadata into a single file and extracting it out when needed, than
        # having to keep track of yet-another-file. Because we encode into
        # ASCII here, no need to call GPG with --armor either.

        @signature = Base64.encode64(File.read("artifact.#{@checksum}.tar.gz.sig"))

        unless @signature
          $logger.error 'An unexpected issue occured and no signature was generated'
          return false
        end
      end

      # Make sure the public key has been uploaded if it hasn't already
      pubkey_upload

      @signature
    end
def artifact_sign
      @signature = 'unsigned'

      # Clean up the existing signature file
      signature_cleanup

      Dir.chdir("#{$config['general']['app_cache']}/artifacts/") do
        # Generate the signature file and pick up the signature data
        unless system "gpg --use-agent --detach-sign artifact.#{@checksum}.tar.gz"
          $logger.error 'Unable to sign the artifact, an unexpected failure occured. No file uploaded.'
          return false
        end

        if File.exist?("artifact.#{@checksum}.tar.gz.sig")
          $logger.info 'A signature file was successfully generated.'
        else
          $logger.error 'A signature file was NOT generated.'
          return false
        end

        # Convert the signature into base64. It's easier to bundle all the
        # metadata into a single file and extracting it out when needed, than
        # having to keep track of yet-another-file. Because we encode into
        # ASCII here, no need to call GPG with --armor either.

        @signature = Base64.encode64(File.read("artifact.#{@checksum}.tar.gz.sig"))

        unless @signature
          $logger.error 'An unexpected issue occured and no signature was generated'
          return false
        end
      end

      # Make sure the public key has been uploaded if it hasn't already
      pubkey_upload

      @signature
    end
Sign the artifact and return the signature. Does not validation of the signature.

 false   Failure
 base64  Encoded signature