Add new Dockerfile label org.opencontainers.image.revision
This commit is contained in:
parent
d34f0219b1
commit
43ca5f5ef1
5 changed files with 14 additions and 11 deletions
10
Makefile
10
Makefile
|
@ -38,7 +38,7 @@ E2E_NODES ?= 8
|
|||
E2E_CHECK_LEAKS ?=
|
||||
|
||||
REPO_INFO ?= $(shell git config --get remote.origin.url)
|
||||
GIT_COMMIT ?= git-$(shell git rev-parse --short HEAD)
|
||||
COMMIT_SHA ?= git-$(shell git rev-parse --short HEAD)
|
||||
|
||||
PKG = k8s.io/ingress-nginx
|
||||
|
||||
|
@ -65,6 +65,7 @@ image: clean-image ## Build image for a particular arch.
|
|||
--build-arg BASE_IMAGE="$(BASE_IMAGE)" \
|
||||
--build-arg VERSION="$(TAG)" \
|
||||
--build-arg TARGETARCH="$(ARCH)" \
|
||||
--build-arg COMMIT_SHA="$(COMMIT_SHA)" \
|
||||
-t $(REGISTRY)/controller:$(TAG) rootfs
|
||||
|
||||
.PHONY: clean-image
|
||||
|
@ -77,7 +78,7 @@ build: ## Build ingress controller, debug tool and pre-stop hook.
|
|||
@build/run-in-docker.sh \
|
||||
PKG=$(PKG) \
|
||||
ARCH=$(ARCH) \
|
||||
GIT_COMMIT=$(GIT_COMMIT) \
|
||||
COMMIT_SHA=$(COMMIT_SHA) \
|
||||
REPO_INFO=$(REPO_INFO) \
|
||||
TAG=$(TAG) \
|
||||
GOBUILD_FLAGS=$(GOBUILD_FLAGS) \
|
||||
|
@ -88,7 +89,7 @@ build-plugin: ## Build ingress-nginx krew plugin.
|
|||
@build/run-in-docker.sh \
|
||||
PKG=$(PKG) \
|
||||
ARCH=$(ARCH) \
|
||||
GIT_COMMIT=$(GIT_COMMIT) \
|
||||
COMMIT_SHA=$(COMMIT_SHA) \
|
||||
REPO_INFO=$(REPO_INFO) \
|
||||
TAG=$(TAG) \
|
||||
GOBUILD_FLAGS=$(GOBUILD_FLAGS) \
|
||||
|
@ -108,7 +109,7 @@ test: ## Run go unit tests.
|
|||
@build/run-in-docker.sh \
|
||||
PKG=$(PKG) \
|
||||
ARCH=$(ARCH) \
|
||||
GIT_COMMIT=$(GIT_COMMIT) \
|
||||
COMMIT_SHA=$(COMMIT_SHA) \
|
||||
REPO_INFO=$(REPO_INFO) \
|
||||
TAG=$(TAG) \
|
||||
GOBUILD_FLAGS=$(GOBUILD_FLAGS) \
|
||||
|
@ -213,4 +214,5 @@ release: ensure-buildx clean
|
|||
--platform $(subst $(SPACE),$(COMMA),$(PLATFORMS)) \
|
||||
--build-arg BASE_IMAGE="$(BASE_IMAGE)" \
|
||||
--build-arg VERSION="$(TAG)" \
|
||||
--build-arg COMMIT_SHA="$(COMMIT_SHA)" \
|
||||
-t $(REGISTRY)/controller:$(TAG) rootfs
|
||||
|
|
|
@ -26,7 +26,7 @@ declare -a mandatory
|
|||
mandatory=(
|
||||
PKG
|
||||
ARCH
|
||||
GIT_COMMIT
|
||||
COMMIT_SHA
|
||||
REPO_INFO
|
||||
TAG
|
||||
)
|
||||
|
@ -56,7 +56,7 @@ function build_for_arch(){
|
|||
"${GOBUILD_FLAGS}" \
|
||||
-ldflags "-s -w \
|
||||
-X ${PKG}/version.RELEASE=${TAG} \
|
||||
-X ${PKG}/version.COMMIT=${GIT_COMMIT} \
|
||||
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
|
||||
-X ${PKG}/version.REPO=${REPO_INFO}" \
|
||||
-o "${release}/kubectl-ingress_nginx${extension}" "${PKG}/cmd/plugin"
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ declare -a mandatory
|
|||
mandatory=(
|
||||
PKG
|
||||
ARCH
|
||||
GIT_COMMIT
|
||||
COMMIT_SHA
|
||||
REPO_INFO
|
||||
TAG
|
||||
)
|
||||
|
@ -49,20 +49,20 @@ export GOARCH=${ARCH}
|
|||
go build \
|
||||
-ldflags "-s -w \
|
||||
-X ${PKG}/version.RELEASE=${TAG} \
|
||||
-X ${PKG}/version.COMMIT=${GIT_COMMIT} \
|
||||
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
|
||||
-X ${PKG}/version.REPO=${REPO_INFO}" \
|
||||
-o "rootfs/bin/${ARCH}/nginx-ingress-controller" "${PKG}/cmd/nginx"
|
||||
|
||||
go build \
|
||||
-ldflags "-s -w \
|
||||
-X ${PKG}/version.RELEASE=${TAG} \
|
||||
-X ${PKG}/version.COMMIT=${GIT_COMMIT} \
|
||||
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
|
||||
-X ${PKG}/version.REPO=${REPO_INFO}" \
|
||||
-o "rootfs/bin/${ARCH}/dbg" "${PKG}/cmd/dbg"
|
||||
|
||||
go build \
|
||||
-ldflags "-s -w \
|
||||
-X ${PKG}/version.RELEASE=${TAG} \
|
||||
-X ${PKG}/version.COMMIT=${GIT_COMMIT} \
|
||||
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
|
||||
-X ${PKG}/version.REPO=${REPO_INFO}" \
|
||||
-o "rootfs/bin/${ARCH}/wait-shutdown" "${PKG}/cmd/waitshutdown"
|
||||
|
|
|
@ -8,7 +8,6 @@ steps:
|
|||
entrypoint: bash
|
||||
env:
|
||||
- DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
- GIT_COMMIT=$_GIT_TAG
|
||||
- REGISTRY=gcr.io/k8s-staging-ingress-nginx
|
||||
- REPO_INFO=https://github.com/kubernetes/ingress-nginx
|
||||
- HOME=/root
|
||||
|
|
|
@ -18,6 +18,7 @@ FROM ${BASE_IMAGE}
|
|||
|
||||
ARG TARGETARCH
|
||||
ARG VERSION
|
||||
ARG COMMIT_SHA
|
||||
|
||||
LABEL org.opencontainers.image.title="NGINX Ingress Controller for Kubernetes"
|
||||
LABEL org.opencontainers.image.documentation="https://kubernetes.github.io/ingress-nginx/"
|
||||
|
@ -25,6 +26,7 @@ LABEL org.opencontainers.image.source="https://github.com/kubernetes/ingress-ngi
|
|||
LABEL org.opencontainers.image.vendor="The Kubernetes Authors"
|
||||
LABEL org.opencontainers.image.licenses="Apache-2.0"
|
||||
LABEL org.opencontainers.image.version="${VERSION}"
|
||||
LABEL org.opencontainers.image.revision="${COMMIT_SHA}"
|
||||
|
||||
WORKDIR /etc/nginx
|
||||
|
||||
|
|
Loading…
Reference in a new issue