Skip to content
Open
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
4 changes: 2 additions & 2 deletions Dockerfile.job
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ COPY go.sum go.sum

RUN go mod download

#RUN CGO_ENABLED=0 go build -o /bin/main ./cmd/subscriptioncleanup/main.go
# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o /bin/main ./cmd/subscriptioncleanup/main.go
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GOFIPS140=v1.0.0 go build -a -o /bin/main ./cmd/subscriptioncleanup/main.go

# Get latest CA certs
FROM alpine:latest AS certs
Expand All @@ -29,3 +28,4 @@ LABEL [email protected]:kyma-project/control-plane.git

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /bin/main /bin/main
ENV GODEBUG=fips140=only,tlsmlkem=0
71 changes: 2 additions & 69 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,6 @@
APP_NAME = kyma-environment-broker
APP_PATH = components/kyma-environment-broker
APP_CLEANUP_NAME = kyma-environments-cleanup-job
APP_SUBACCOUNT_CLEANUP_NAME = kyma-environment-subaccount-cleanup-job
APP_SUBSCRIPTION_CLEANUP_NAME = kyma-environment-subscription-cleanup-job
APP_TRIAL_CLEANUP_NAME = kyma-environment-trial-cleanup-job

ENTRYPOINT = cmd/broker/
BUILDPACK = eu.gcr.io/kyma-project/test-infra/buildpack-golang:v20230323-a1ac96db
SCRIPTS_DIR = $(realpath $(shell pwd))/scripts
DOCKER_SOCKET = /var/run/docker.sock
TESTING_DB_NETWORK = test_network

include $(SCRIPTS_DIR)/generic_make_go.mk

.DEFAULT_GOAL := custom-verify

custom-verify: testing-with-database-network mod-verify go-mod-check check-fmt

verify:: custom-verify

resolve-local:
GO111MODULE=on go mod vendor -v

ensure-local:
@echo "Go modules present in component - omitting."

dep-status:
@echo "Go modules present in component - omitting."

dep-status-local:
@echo "Go modules present in component - omitting."
custom-verify: mod-verify go-mod-check

mod-verify: mod-verify-local
mod-verify-local:
Expand All @@ -45,44 +16,6 @@ go-mod-check-local:
exit 1; \
fi;

# We have to override test-local and errcheck, because we need to run provisioner with database
#as docker container connected with custom network and the buildpack container itsefl has to be connected to the network

test-local: ;
errcheck-local: ;

# TODO: there is no errcheck in go1.13 buildpack, consider creating buildpack-toolbox with go1.13 version
# errcheck-local:
# @docker run $(DOCKER_INTERACTIVE) \
# -v $(COMPONENT_DIR):$(WORKSPACE_COMPONENT_DIR):delegated \
# $(DOCKER_CREATE_OPTS) errcheck -blank -asserts -ignorepkg '$$($(DIRS_TO_CHECK) | tr '\n' ',')' -ignoregenerated ./...

test-integration-local:
go test ./... -tags=integration

test-integration:
@echo make test-integration-local
@docker run $(DOCKER_INTERACTIVE) \
-v $(COMPONENT_DIR):$(WORKSPACE_COMPONENT_DIR):delegated \
$(DOCKER_CREATE_OPTS) make test-integration-local

testing-with-database-network:
@docker version
@echo testing-with-database-network
@docker network inspect $(TESTING_DB_NETWORK) >/dev/null 2>&1 || \
docker network create --driver bridge $(TESTING_DB_NETWORK)
@docker run $(DOCKER_INTERACTIVE) \
-v $(DOCKER_SOCKET):$(DOCKER_SOCKET) \
-v $(COMPONENT_DIR)/../../:$(WORKSPACE_COMPONENT_DIR)/../../ \
--network=$(TESTING_DB_NETWORK) \
-v $(COMPONENT_DIR):$(WORKSPACE_COMPONENT_DIR):delegated \
--env PIPELINE_BUILD=1 --env GO111MODULE=on \
$(DOCKER_CREATE_OPTS) go test -tags=database_integration ./...
@docker network rm $(TESTING_DB_NETWORK) || true

clean-up:
@docker network rm $(TESTING_DB_NETWORK) || true

.PHONY: test
test:
go test ./...
GOFIPS140=v1.0.0 go test ./...
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For more information on KCP and its components, read the [KCP documentation](htt
## Run SCJ Locally

1. Download your Gardener kubeconfig. It can be a personal kubeconfig; a service account isn't required.
2. To build an SCJ, run: `go build ./cmd/subscriptioncleanup/main.go`.
2. To build an SCJ, run: `make build`.
3. Set the environmental variables:
- `APP_GARDENER_PROJECT=frog-dev`
- `APP_GARDENER_KUBECONFIG_PATH=$PWD/kubeconfig-garden-frog-dev.yaml`
Expand Down
181 changes: 0 additions & 181 deletions scripts/generic_make_go.mk

This file was deleted.

Loading