Skip to content

Commit

Permalink
Remove license-puller usage from components (#14481)
Browse files Browse the repository at this point in the history
* Remove license-puller usage from components

* cleanup dockerfiles

* empty
  • Loading branch information
Ressetkk authored Jun 7, 2022
1 parent e1491c4 commit b60c305
Show file tree
Hide file tree
Showing 27 changed files with 8 additions and 67 deletions.
2 changes: 1 addition & 1 deletion common/makefiles/docs/generic-make-go.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Although these rules do not appear in the Makefile, they are generated.

The generic Makefile contains such a line of code:
```makefile
MOUNT_TARGETS = build resolve ensure dep-status check-imports imports check-fmt fmt errcheck vet generate pull-licenses gqlgen
MOUNT_TARGETS = build resolve ensure dep-status check-imports imports check-fmt fmt errcheck vet generate gqlgen
$(foreach t,$(MOUNT_TARGETS),$(eval $(call buildpack-mount,$(t))))
```
For all the rules defined in **MOUNT_TARGETS**, the `buildpack-mount` Function is called. It dynamically defines a new rule:
Expand Down
11 changes: 1 addition & 10 deletions common/makefiles/generic-make-go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ release-dep: resolve dep-status verify build-image push-image ## Release dep bas

##@ Common Docker
.PHONY: build-image push-image
build-image: pull-licenses-local ## Build the docker image
build-image: ## Build the docker image
docker build -t $(IMG_NAME) .
push-image: post-pr-tag-image ## Build and push the docker image. Needs DOCKER_PUSH_REPOSITORY DOCKER_PUSH_DIRECTORY
docker tag $(IMG_NAME) $(IMG_NAME):$(TAG)
Expand Down Expand Up @@ -210,15 +210,6 @@ check-gqlgen:
exit 1; \
fi;

pull-licenses: pull-licenses-local

pull-licenses-local: ## Download licenses to store them in the docker image
ifdef LICENSE_PULLER_PATH
bash $(LICENSE_PULLER_PATH)
else
mkdir -p licenses
endif

# Targets copying sources to buildpack
COPY_TARGETS = test
$(foreach t,$(COPY_TARGETS),$(eval $(call buildpack-cp-ro,$(t))))
Expand Down
2 changes: 1 addition & 1 deletion components/application-broker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ VERIFY_IGNORE := /vendor\|/automock\|/testdata\|/pkg
release:
$(MAKE) gomod-release-local

build-image: pull-licenses
build-image:
docker build -t $(IMG_NAME) -f cmd/broker/Dockerfile .
1 change: 0 additions & 1 deletion components/application-broker/cmd/broker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ COPY --from=builder --chown=appuser /tmp /tmp

COPY --from=builder ./application-broker /root/application-broker
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY ./licenses/ /root/licenses

LABEL [email protected]:kyma-project/kyma.git

Expand Down
2 changes: 0 additions & 2 deletions components/application-connectivity-validator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM eu.gcr.io/kyma-project/external/golang:1.18.2-alpine3.15 as builder
ARG DOCK_PKG_DIR=/go/src/github.com/kyma-project/kyma/components/application-connectivity-validator
WORKDIR $DOCK_PKG_DIR

COPY ./licenses/ /app/licenses
COPY . $DOCK_PKG_DIR

RUN echo "nobody:x:65534:65534:nobody:/:" > /etc_passwd
Expand All @@ -17,7 +16,6 @@ LABEL [email protected]:kyma-project/kyma.git
WORKDIR /app

COPY --from=builder /go/src/github.com/kyma-project/kyma/components/application-connectivity-validator/applicationconnectivityvalidator .
COPY --from=builder /app/licenses /app/licenses

COPY --from=builder /etc_passwd /etc/passwd
USER nobody
Expand Down
2 changes: 0 additions & 2 deletions components/application-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM eu.gcr.io/kyma-project/external/golang:1.18.2-alpine3.15 as builder
ARG DOCK_PKG_DIR=/go/src/github.com/kyma-project/kyma/components/application-gateway
WORKDIR $DOCK_PKG_DIR

COPY ./licenses/ /app/licenses
COPY . $DOCK_PKG_DIR

RUN echo "nobody:x:65534:5534:nobody:/:" > /etc_passwd
Expand All @@ -21,7 +20,6 @@ WORKDIR /app

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/kyma-project/kyma/components/application-gateway/applicationgateway .
COPY --from=builder /app/licenses /app/licenses

COPY --from=builder /etc_passwd /etc/passwd
USER nobody
Expand Down
2 changes: 0 additions & 2 deletions components/application-operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM eu.gcr.io/kyma-project/external/golang:1.18.2-alpine3.15 as builder
ARG DOCK_PKG_DIR=/go/src/github.com/kyma-project/kyma/components/application-operator
WORKDIR $DOCK_PKG_DIR

COPY ./licenses/ /app/licenses
COPY . $DOCK_PKG_DIR

RUN echo "nobody:x:65534:5534:nobody:/:" > /etc_passwd
Expand All @@ -19,7 +18,6 @@ WORKDIR /app
COPY charts/application application/
COPY charts/gateway gateway/
COPY --from=builder /go/src/github.com/kyma-project/kyma/components/application-operator/manager .
COPY --from=builder /app/licenses /app/licenses

COPY --from=builder /etc_passwd /etc/passwd
USER nobody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM eu.gcr.io/kyma-project/external/golang:1.18.2-alpine3.15 as builder
ARG DOCK_PKG_DIR=/go/src/github.com/kyma-project/kyma/components/central-application-connectivity-validator
WORKDIR $DOCK_PKG_DIR

COPY ./licenses/ /app/licenses
COPY . $DOCK_PKG_DIR

RUN echo "nobody:x:65534:65534:nobody:/:" > /etc_passwd
Expand All @@ -17,7 +16,6 @@ LABEL [email protected]:kyma-project/kyma.git
WORKDIR /app

COPY --from=builder /go/src/github.com/kyma-project/kyma/components/central-application-connectivity-validator/centralapplicationconnectivityvalidator .
COPY --from=builder /app/licenses /app/licenses

COPY --from=builder /etc_passwd /etc/passwd
USER nobody
Expand Down
2 changes: 0 additions & 2 deletions components/central-application-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ COPY go.mod .
COPY go.sum .
RUN go mod download

COPY ./licenses/ /app/licenses
COPY . $DOCK_PKG_DIR

RUN echo "nobody:x:65534:5534:nobody:/:" > /etc_passwd
Expand All @@ -25,7 +24,6 @@ WORKDIR /app

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/kyma-project/kyma/components/central-application-gateway/applicationgateway .
COPY --from=builder /app/licenses /app/licenses

COPY --from=builder /etc_passwd /etc/passwd
USER nobody
Expand Down
2 changes: 0 additions & 2 deletions components/compass-runtime-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM eu.gcr.io/kyma-project/external/golang:1.18.2-alpine3.15 as builder
ARG DOCK_PKG_DIR=/compass-runtime-agent
WORKDIR $DOCK_PKG_DIR

COPY ./licenses/ /app/licenses
COPY . $DOCK_PKG_DIR

RUN echo "nobody:x:65534:5534:nobody:/:" > /etc_passwd
Expand All @@ -21,7 +20,6 @@ WORKDIR /app

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder $DOCK_PKG_DIR/compass-runtime-agent .
COPY --from=builder /app/licenses /app/licenses

COPY --from=builder /etc_passwd /etc/passwd
USER nobody
Expand Down
7 changes: 2 additions & 5 deletions components/event-publisher-proxy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ cmds_clean = $(foreach cmd,$(cmds),$(cmd).clean)
cmds_images_push = $(foreach img,$(cmds_images),$(img).push)

.PHONY: clean
clean: $(cmds_clean) resolve_clean licenses_clean
clean: $(cmds_clean) resolve_clean

$(cmds_clean): %.clean:
rm -f $*

resolve_clean:
rm -rf vendor

licenses_clean:
rm -rf licenses

build-local: $(cmds) test-local ;

.PHONY: $(cmds_images) $(cmds_images_push)
Expand All @@ -57,7 +54,7 @@ $(cmds): %:

# Example:
# make event-publisher-proxy.image
$(cmds_images): %.image: build-local pull-licenses
$(cmds_images): %.image: build-local
$(eval $@_img_name := $*)
@echo "+ Building container image $($@_img_name)"
docker image build -f cmd/$*/Dockerfile -t $($@_img_name) .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ USER nonroot:nonroot
WORKDIR /
COPY --from=builder /go/src/github.com/kyma-project/kyma/components/event-publisher-proxy/event-publisher-proxy .

COPY licenses/ /licenses/

ENTRYPOINT ["/event-publisher-proxy"]
1 change: 0 additions & 1 deletion components/eventing-controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ LABEL source = [email protected]:kyma-project/kyma.git

WORKDIR /
COPY --from=builder /go/src/github.com/kyma-project/kyma/components/eventing-controller/eventing-controller .
COPY licenses/ /licenses/
USER nonroot:nonroot

ENTRYPOINT ["/eventing-controller"]
5 changes: 0 additions & 5 deletions components/eventing-controller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,3 @@ $(eval $(call buildpack-mount,manifests))

resolve_clean:
rm -rf vendor

licenses_clean:
rm -rf licenses


3 changes: 0 additions & 3 deletions components/function-controller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ else
GOBIN=$(shell go env GOBIN)
endif

pull-licenses-local:
@echo "Omitting licenses will not be pulled."

release:
$(MAKE) gomod-release-local

Expand Down
2 changes: 1 addition & 1 deletion tests/application-gateway-legacy-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ release:
test-local:
@echo "Tests are not to be run at this stage."

build-image: pull-licenses
build-image:
docker build -t $(APP_NAME):latest . -f ./test/helmtest/Dockerfile --build-arg TEST_EXECUTOR_IMAGE=$(TEST_EXECUTOR_IMG_NAME):$(TAG)
docker build -t $(TEST_EXECUTOR_APP_NAME):latest . -f ./test/executor/Dockerfile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ WORKDIR /app
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-legacy-tests/spec.json .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-legacy-tests/scripts/executor-entrypoint.sh .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-legacy-tests/proxytestsexecutor.test .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-legacy-tests/licenses ./licenses

ENTRYPOINT ["./executor-entrypoint.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ WORKDIR /app

COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-legacy-tests/scripts/helm-test-entrypoint.sh .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-legacy-tests/proxyhelmtests.test .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-legacy-tests/licenses ./licenses

ARG TEST_EXECUTOR_IMAGE
ENV TEST_EXECUTOR_IMAGE=$TEST_EXECUTOR_IMAGE
Expand Down
2 changes: 0 additions & 2 deletions tests/application-gateway-tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ COPY go.sum .
RUN go mod download

COPY . $SRC_DIR
COPY ./licenses/ /app/licenses

RUN CGO_ENABLED=0 GOOS=linux go test -c ./test/gateway/tests

Expand All @@ -25,6 +24,5 @@ RUN apk add --no-cache curl
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-tests/scripts/entrypoint.sh .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-tests/tests.test .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-gateway-tests/licenses ./licenses

ENTRYPOINT ["./entrypoint.sh"]
1 change: 0 additions & 1 deletion tests/application-operator-tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-opera
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-operator-tests/applicationcontroller.test .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-operator-tests/serviceinstancecontroller.test .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-operator-tests/applicationtests.test .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/application-operator-tests/licenses ./licenses

ENTRYPOINT ["./entrypoint.sh"]
1 change: 0 additions & 1 deletion tests/compass-runtime-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ WORKDIR /app
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/compass-runtime-agent/scripts/entrypoint.sh .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/compass-runtime-agent/test.test .
COPY --from=builder /go/src/github.com/kyma-project/kyma/tests/compass-runtime-agent/licenses ./licenses

ENTRYPOINT ["./entrypoint.sh"]
5 changes: 1 addition & 4 deletions tests/components/api-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ENV BASE_DIR /workspace/go/src/github.com/kyma-project/kyma/tests/components/api
WORKDIR ${BASE_DIR}

COPY . ${BASE_DIR}/
COPY ./licenses/ ${BASE_DIR}/licenses/

##
# BUILD APP
Expand All @@ -18,9 +17,7 @@ RUN cd ${BASE_DIR}/gateway-tests &&\
# EXTRACT SCRIPT AND BINARY
##
RUN mkdir /test &&\
mv ${BASE_DIR}/app.test /test/app.test &&\
mv ${BASE_DIR}/licenses /test/licenses

mv ${BASE_DIR}/app.test /test/app.test
FROM eu.gcr.io/kyma-project/tpi/k8s-tools:20220525-4bd6d72e
LABEL [email protected]:kyma-project/kyma.git
WORKDIR /test
Expand Down
9 changes: 1 addition & 8 deletions tests/components/api-gateway/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,9 @@ path-to-referenced-charts:

release: build-image push-image

build-image: pull-licenses
build-image:
docker build -t $(IMG_NAME) .

push-image:
docker tag $(IMG_NAME) $(IMG_NAME):$(TAG)
docker push $(IMG_NAME):$(TAG)

pull-licenses:
ifdef LICENSE_PULLER_PATH
bash $(LICENSE_PULLER_PATH)
else
mkdir -p licenses
endif
2 changes: 0 additions & 2 deletions tests/function-controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ RUN GO111MODULE=on go mod download
COPY ./testsuite/ ${BASE_APP_DIR}/testsuite/
COPY ./pkg/ ${BASE_APP_DIR}/pkg/
COPY ./cmd/ ${BASE_APP_DIR}/cmd/
COPY ./licenses/ ${BASE_APP_DIR}/licenses/

#
# Build tests
Expand All @@ -42,7 +41,6 @@ RUN apk add --no-cache ca-certificates && \
#

COPY --from=builder ${TEST_DIR}/main.test /app/
COPY --from=builder ${TEST_DIR}/licenses/ /app/licenses/

#
# Run tests
Expand Down
2 changes: 0 additions & 2 deletions tests/rafter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ COPY ./pkg/ ${BASE_APP_DIR}/pkg/
COPY ./main_test.go ${BASE_APP_DIR}
COPY ./go.mod ${BASE_APP_DIR}
COPY ./go.sum ${BASE_APP_DIR}
COPY ./licenses/ ${BASE_APP_DIR}/licenses/

#
# Build tests
Expand Down Expand Up @@ -40,7 +39,6 @@ RUN apk upgrade --no-cache && \

RUN mkdir -p /app/tests
COPY --from=builder ${TEST_DIR}/main.test /app/
COPY --from=builder ${TEST_DIR}/licenses/ /app/licenses/

#
# Run tests
Expand Down
2 changes: 0 additions & 2 deletions tests/service-catalog/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM golang:1.12.10-alpine3.10 as builder

ENV SRC_DIR=/go/src/github.com/kyma-project/kyma/tests/service-catalog
COPY . $SRC_DIR
COPY ./licenses/ $SRC_DIR/licenses/
COPY entrypoint.sh /

WORKDIR $SRC_DIR
Expand All @@ -19,7 +18,6 @@ WORKDIR /app

COPY --from=builder env-tester.bin /go/bin/env-tester.bin
COPY --from=builder ./servicecatalog.test .
COPY ./licenses/ /app/licenses
COPY --from=builder /entrypoint.sh .

LABEL [email protected]:kyma-project/kyma.git
Expand Down
2 changes: 0 additions & 2 deletions tools/event-subscriber/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ ARG DOCK_PKG_DIR=/event-subscriber

WORKDIR $DOCK_PKG_DIR
COPY . $DOCK_PKG_DIR
COPY ./licenses/ /app/licenses

RUN go mod download

Expand All @@ -22,6 +21,5 @@ WORKDIR /app
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

COPY --from=builder $DOCK_PKG_DIR/event-subscriber .
COPY --from=builder /app/licenses /app/licenses

CMD ["/app/event-subscriber"]

0 comments on commit b60c305

Please sign in to comment.