Sha256: 9fa34edfb1b8887e05f146c48a783f76318144f08298e0cb5813aab4e776249a

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

#!/usr/bin/env ruby

# frozen_string_literal: true

$LOAD_PATH << File.join(File.dirname(__FILE__), "../lib")

require "faraday"
require "compose-hook"

abort "Usage: payload *service* *image* *url*" unless ARGV.length == 3

secret = ENV["WEBHOOK_JWT_SECRET"]
abort "WEBHOOK_JWT_SECRET not set" if secret.to_s.empty?
coder = ComposeHook::Payload.new(secret: secret)

jwt = coder.generate!(service: ARGV[0], image: ARGV[1])
url = "#{ARGV[2]}/deploy/#{jwt}"

response = Faraday::Connection.new.get(url) do |request|
  request.options.timeout = 300
end

pp response.body

raise unless response.status == 200

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
compose-hook-0.1.4 bin/compose-payload
compose-hook-0.1.3 bin/compose-payload
compose-hook-0.1.2 bin/compose-payload