Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ builds:
- >-
-s -w -X main.version={{.Version}}
-X main.commit={{.Commit}}
-X main.date={{.CommitDate}}
release:
draft: true
github:
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ FROM docker.io/golang:latest as builder

ARG BRIDGE_VERSION=development
ARG BRIDGE_COMMIT=HEAD
ARG BRIDGE_DATE=latest

ENV CGO_ENABLED=0

WORKDIR /go/src/app
COPY . .

RUN set -ex; \
go build -ldflags="-s -w -X main.version=${BRIDGE_VERSION} -X main.commit=${BRIDGE_COMMIT} -X main.date=${BRIDGE_DATE}" -o /go/bin/alertmanager-icinga-bridge
go build -ldflags="-s -w -X main.version=${BRIDGE_VERSION} -X main.commit=${BRIDGE_COMMIT}" -o /go/bin/alertmanager-icinga-bridge

# Final Image
FROM gcr.io/distroless/static:nonroot
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
CONTAINER_RUNTIME?=podman

COMMIT := $(shell git rev-parse HEAD)
DATE := $(shell date --iso-8601)
VERSION?=latest

build-image:
$(CONTAINER_RUNTIME) build --pull \
--build-arg BRIDGE_VERSION=$(VERSION) \
--build-arg BRIDGE_COMMIT=$(COMMIT) \
--build-arg BRIDGE_DATE=$(DATE) \
-t ghcr.io/netways/alertmanager-icinga-bridge:latest .
build:
mkdir -p dist; \
Expand All @@ -19,7 +17,7 @@ release-snapshot:
goreleaser release --snapshot --clean
release:
mkdir -p dist;\
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)" -o dist/alertmanager-icinga-bridge
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)" -o dist/alertmanager-icinga-bridge
lint:
go fmt $(go list ./... | grep -v /vendor/)
vet:
Expand Down
7 changes: 1 addition & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var (
// These get filled at build time with the proper values.
version = "development"
commit = "HEAD"
date = "latest"
)

// buildVersion creates a string that contains the executable's version
Expand All @@ -34,10 +33,6 @@ func buildVersion() string {
result = fmt.Sprintf("%s\ncommit: %s", result, commit)
}

if date != "" {
result = fmt.Sprintf("%s\ndate: %s", result, date)
}

return result
}

Expand Down Expand Up @@ -68,7 +63,7 @@ func main() {
// Create Icinga Client
icingaClient := icinga2.NewClient(cfg, logger)

logger.Info("Starting alertmanager-icinga-bridge", "version", version, "commit", commit, "date", date, "component", "main")
logger.Info("Starting alertmanager-icinga-bridge", "version", version, "commit", commit, "component", "main")

// Create and start the Service Garbage Collector
garbagecol := gc.NewGarbageCollector(cfg, logger, icingaClient)
Expand Down