Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #35 from cjellick/main
Browse files Browse the repository at this point in the history
Fix superfluous WriteHeader
  • Loading branch information
cjellick authored Aug 1, 2022
2 parents 21602ab + 0040d69 commit c46df43
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ jobs:
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and push acorn
run: |
acorn build --platform linux/amd64 --platform linux/arm64 -t ghcr.io/acorn-io/acorn-dns:$TAG .
acorn build --platform linux/amd64 --platform linux/arm64 -t ghcr.io/acorn-io/acorn-dns:$TAG . --tag=$TAG
acorn push ghcr.io/acorn-io/acorn-dns:$TAG
6 changes: 6 additions & 0 deletions Acornfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ args: {

// The AWS Route53 zone where FQDNs will be created
route53ZoneId: ""

// The tag that should be displayed in version information
tag: "v0.0.0-dev"
}

containers: {
default: {
dependsOn: "db"
build: {
buildArgs: {
TAG: args.tag
}
context: "."
}
scale: args.scale
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM golang:1.18 AS build
COPY / /src
WORKDIR /src
RUN --mount=type=cache,target=/go/pkg --mount=type=cache,target=/root/.cache/go-build make build
ARG TAG="v0.0.0-dev"
ENV CGO_ENABLED=0
RUN --mount=type=cache,target=/go/pkg --mount=type=cache,target=/root/.cache/go-build \
go build -o bin/acorn-dns -ldflags "-s -w -X 'github.com/acorn-io/acorn-dns/pkg/version.Tag=${TAG}'" .

FROM alpine:3.16.1 AS base
RUN apk add --no-cache ca-certificates
Expand Down
6 changes: 1 addition & 5 deletions pkg/apiserver/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ func newHandler(b backend.Backend) *handler {

func (h *handler) root(w http.ResponseWriter, r *http.Request) {
v := version.Get()
if err := json.NewEncoder(w).Encode(v); err != nil {
w.WriteHeader(500)
_, _ = w.Write([]byte(`{"success": false}`))
}
w.WriteHeader(200)
writeSuccess(w, http.StatusOK, v)
}

func (h *handler) getDomain(w http.ResponseWriter, r *http.Request) {
Expand Down
2 changes: 0 additions & 2 deletions pkg/apiserver/logging_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ func loggingMiddleware(logger *logrus.Entry) func(http.Handler) http.Handler {
wrapped := wrapResponseWriter(w)
next.ServeHTTP(wrapped, r)

// Per Shannon Huff 2021-11-20, only log requests if it's not
// a health check request
if !strings.Contains(r.URL.EscapedPath(), "healthz") {
logger.WithFields(logrus.Fields{
"status": wrapped.status,
Expand Down

0 comments on commit c46df43

Please sign in to comment.