From 04308e319aa2eede84e418f56c15f201fcb58582 Mon Sep 17 00:00:00 2001 From: Philipp Ossler Date: Tue, 12 Jun 2018 07:42:04 +0200 Subject: [PATCH] rename to main.go --- .goreleaser.yml | 36 ++++++++++++++++++++++++++++++++++++ worker.go => main.go | 15 ++++++++------- 2 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 .goreleaser.yml rename worker.go => main.go (94%) diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..e372bb07 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,36 @@ +project_name: zeebe-http-extension +release: + github: + owner: zeebe-io + name: zeebe-http-extension + draft: false +builds: + - + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - 386 + ignore: + - goos: darwin + goarch: 386 + main: ./main.go + binary: zeebe-http +archive: + format: tar.gz + name_template: 'zeebe-http-{{ .Version }}-{{ .Os }}_{{ .Arch }}' + replacements: + darwin: Darwin + linux: Linux + windows: Windows + amd64: x86_64 + 386: i386 + format_overrides: + - goos: windows + format: zip +snapshot: + name_template: SNAPSHOT-{{ .Commit }} +checksum: + name_template: 'zeebe-http-{{ .Version }}_checksums.txt' diff --git a/worker.go b/main.go similarity index 94% rename from worker.go rename to main.go index a008668a..384a7209 100644 --- a/worker.go +++ b/main.go @@ -59,8 +59,9 @@ func handleJob(client zbsubscribe.ZeebeAPI, event *zbsubscriptions.SubscriptionE url := getParameter(job, "url") if url == nil { - // TODO handle error fmt.Println("Missing required parameter 'URL'") + job.Retries-- + client.FailJob(event) return } @@ -74,8 +75,9 @@ func handleJob(client zbsubscribe.ZeebeAPI, event *zbsubscriptions.SubscriptionE if body != nil { jsonDocument, err := json.Marshal(body) if err != nil { - // TODO handle error fmt.Println(err) + job.Retries-- + client.FailJob(event) return } reqBody = bytes.NewReader(jsonDocument) @@ -83,8 +85,9 @@ func handleJob(client zbsubscribe.ZeebeAPI, event *zbsubscriptions.SubscriptionE statusCode, resBody, err := request(url.(string), method.(string), reqBody) if err != nil { - // TODO handle error fmt.Println(err) + job.Retries-- + client.FailJob(event) return } @@ -102,10 +105,8 @@ func getParameter(job *zbmsgpack.Job, param string) interface{} { return value } - p, _ := job.GetPayload() - payload := *p - - value = payload[param] + payload, _ := job.GetPayload() + value = (*payload)[param] return value }