Skip to content

Commit

Permalink
Merge branch 'main' into feature/rotator/add-all-option
Browse files Browse the repository at this point in the history
  • Loading branch information
ykadowak authored Jan 23, 2024
2 parents 7b7c72f + 07570a1 commit ebf3855
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 56 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ GOARCH := $(eval GOARCH := $(shell go env GOARCH))$(GOARCH)
GOBIN := $(eval GOBIN := $(or $(shell go env GOBIN),$(GOPATH)/bin))$(GOBIN)
GOCACHE := $(eval GOCACHE := $(shell go env GOCACHE))$(GOCACHE)
GOOS := $(eval GOOS := $(shell go env GOOS))$(GOOS)
GO_CLEAN_DEPS := true
GOTEST_TIMEOUT = 30m
TEST_NOT_IMPL_PLACEHOLDER = NOT IMPLEMENTED BELOW

Expand Down
29 changes: 16 additions & 13 deletions Makefile.d/dependencies.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,22 @@ go/download:
.PHONY: go/deps
## install Go package dependencies
go/deps:
rm -rf $(ROOTDIR)/vendor \
/go/pkg \
$(GOCACHE) \
$(ROOTDIR)/go.sum \
$(ROOTDIR)/go.mod
cp $(ROOTDIR)/hack/go.mod.default $(ROOTDIR)/go.mod
GOPRIVATE=$(GOPRIVATE) go mod tidy
go clean -cache -modcache -testcache -i -r
rm -rf $(ROOTDIR)/vendor \
/go/pkg \
$(GOCACHE) \
$(ROOTDIR)/go.sum \
$(ROOTDIR)/go.mod
if $(GO_CLEAN_DEPS); then \
rm -rf $(ROOTDIR)/vendor \
/go/pkg \
$(GOCACHE) \
$(ROOTDIR)/go.sum \
$(ROOTDIR)/go.mod ; \
cp $(ROOTDIR)/hack/go.mod.default $(ROOTDIR)/go.mod ; \
GOPRIVATE=$(GOPRIVATE) go mod tidy ; \
go clean -cache -modcache -testcache -i -r ; \
rm -rf $(ROOTDIR)/vendor \
/go/pkg \
$(GOCACHE) \
$(ROOTDIR)/go.sum \
$(ROOTDIR)/go.mod ; \
cp $(ROOTDIR)/hack/go.mod.default $(ROOTDIR)/go.mod ; \
fi
cp $(ROOTDIR)/hack/go.mod.default $(ROOTDIR)/go.mod
GOPRIVATE=$(GOPRIVATE) go mod tidy
go get -u all 2>/dev/null || true
Expand Down
10 changes: 8 additions & 2 deletions dockers/agent/core/ngt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No
Expand Down Expand Up @@ -65,7 +67,9 @@ COPY .git .
COPY go.mod .
COPY go.sum .

RUN make go/download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -87,7 +91,9 @@ COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
RUN make ngt/install
RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
Expand Down
10 changes: 8 additions & 2 deletions dockers/agent/sidecar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV GOPATH /go
ENV GOROOT /opt/go
Expand Down Expand Up @@ -58,7 +60,9 @@ COPY .git .
COPY go.mod .
COPY go.sum .

RUN make go/download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -79,7 +83,9 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

FROM --platform=${BUILDPLATFORM} ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG}
Expand Down
10 changes: 8 additions & 2 deletions dockers/ci/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang
FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder
LABEL maintainer="${MAINTAINER}"

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No
Expand Down Expand Up @@ -71,9 +73,13 @@ COPY apis/proto apis/proto
COPY versions versions
COPY hack/go.mod.default hack/go.mod.default

RUN make deps ROOTDIR=$ROOTDIR
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make deps ROOTDIR=$ROOTDIR GO_CLEAN_DEPS=false

RUN make ngt/install \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make ngt/install \
&& make helm/install \
&& make helm-docs/install \
&& make kind/install \
Expand Down
10 changes: 8 additions & 2 deletions dockers/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ ARG MAINTAINER="vdaas.org vald team <[email protected]>"
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/vscode/devcontainers/go:1 AS base
LABEL maintainer="${MAINTAINER}"

ARG TARGETARCH

# skipcq: DOK-DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
Expand Down Expand Up @@ -51,7 +53,9 @@ COPY versions versions
COPY hack/go.mod.default hack/go.mod.default

# basic deps
RUN make deps \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make deps GO_CLEAN_DEPS=false \
&& make ngt/install \
&& make helm/install \
&& make helm-docs/install \
Expand All @@ -62,7 +66,9 @@ RUN make deps \
&& make kubectl/install

# additional deps
RUN make k3d/install \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make k3d/install \
&& make buf/install \
&& make k9s/install \
&& make minikube/install
10 changes: 8 additions & 2 deletions dockers/discoverer/k8s/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No
Expand Down Expand Up @@ -58,7 +60,9 @@ COPY .git .
COPY go.mod .
COPY go.sum .

RUN make go/download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -76,7 +80,9 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
Expand Down
10 changes: 8 additions & 2 deletions dockers/gateway/filter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No
Expand Down Expand Up @@ -57,7 +59,9 @@ COPY .git .
COPY go.mod .
COPY go.sum .

RUN make go/download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -75,7 +79,9 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
Expand Down
10 changes: 8 additions & 2 deletions dockers/gateway/lb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No
Expand Down Expand Up @@ -57,7 +59,9 @@ COPY .git .
COPY go.mod .
COPY go.sum .

RUN make go/download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -75,7 +79,9 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
Expand Down
16 changes: 11 additions & 5 deletions dockers/gateway/mirror/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ ARG DISTROLESS_IMAGE=gcr.io/distroless/static
ARG DISTROLESS_IMAGE_TAG=nonroot
ARG MAINTAINER="vdaas.org vald team <[email protected]>"

FROM golang:${GO_VERSION} AS golang
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM ubuntu:devel AS builder
FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
Expand Down Expand Up @@ -53,7 +55,9 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
COPY go.mod .
COPY go.sum .

RUN go mod download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
go mod download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -77,10 +81,12 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
COPY Makefile .
COPY .git .

RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

FROM ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG}
FROM --platform=${BUILDPLATFORM} ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG}
LABEL maintainer "${MAINTAINER}"

ENV APP_NAME mirror
Expand Down
10 changes: 8 additions & 2 deletions dockers/index/job/correction/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No
Expand Down Expand Up @@ -57,7 +59,9 @@ COPY .git .
COPY go.mod .
COPY go.sum .

RUN make go/download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -75,7 +79,9 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
Expand Down
10 changes: 8 additions & 2 deletions dockers/index/job/creation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No
Expand Down Expand Up @@ -57,7 +59,9 @@ COPY .git .
COPY go.mod .
COPY go.sum .

RUN make go/download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -75,7 +79,9 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
Expand Down
16 changes: 11 additions & 5 deletions dockers/index/job/readreplica/rotate/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ ARG DISTROLESS_IMAGE=gcr.io/distroless/static
ARG DISTROLESS_IMAGE_TAG=nonroot
ARG MAINTAINER="vdaas.org vald team <[email protected]>"

FROM golang:${GO_VERSION} AS golang
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS golang

FROM ubuntu:devel AS builder
FROM --platform=${BUILDPLATFORM} ubuntu:devel AS builder

ARG TARGETARCH

ENV GO111MODULE on
ENV DEBIAN_FRONTEND noninteractive
Expand Down Expand Up @@ -57,7 +59,9 @@ COPY .git .
COPY go.mod .
COPY go.sum .

RUN make go/download
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -75,13 +79,15 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \
--mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \
make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
RUN cp sample.yaml /tmp/config.yaml

FROM ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG}
FROM --platform=${BUILDPLATFORM} ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG}
LABEL maintainer="${MAINTAINER}"

ENV APP_NAME readreplica-rotate
Expand Down
Loading

0 comments on commit ebf3855

Please sign in to comment.