diff --git a/.github/workflows/kyma-integration-k3d-app-gateway.yml b/.github/workflows/kyma-integration-k3d-app-gateway.yml new file mode 100644 index 000000000000..499e62943d5d --- /dev/null +++ b/.github/workflows/kyma-integration-k3d-app-gateway.yml @@ -0,0 +1,28 @@ +name: Run app-gateway integration tests on k3d +on: + push: + branches: [ main ] + paths: + - 'components/central-application-gateway/**' + pull_request: + branches: [ main ] + paths: + - 'components/central-application-gateway/**' +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + /home/runner/work/common/bin + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Run unit tests + run: make -C tests/components/application-connector/hack/ci k3d-gateway-tests diff --git a/components/central-application-gateway/pkg/httptools/http.go b/components/central-application-gateway/pkg/httptools/http.go index ec9407bd7c94..defbd6c44c5d 100644 --- a/components/central-application-gateway/pkg/httptools/http.go +++ b/components/central-application-gateway/pkg/httptools/http.go @@ -1,5 +1,7 @@ package httptools +// TODO:remove me + import ( "io" "net/http" diff --git a/tests/components/application-connector/hack/ci/Makefile b/tests/components/application-connector/hack/ci/Makefile index 585c655efdbc..7ad5e221777b 100644 --- a/tests/components/application-connector/hack/ci/Makefile +++ b/tests/components/application-connector/hack/ci/Makefile @@ -1,15 +1,24 @@ -PROJECT_ROOT ?= ../.. -KYMA_ROOT_CI ?= /home/prow/go/src/github.com/kyma-project/kyma +PROJECT_ROOT ?= ../.. +KYMA_ROOT_CI ?= /home/prow/go/src/github.com/kyma-project/kyma +CLUSTER_NAME ?= kyma +REGISTRY_PORT ?= 5001 +REGISTRY_NAME ?= ${CLUSTER_NAME}-registry + +# Operating system architecture +OS_ARCH ?= $(shell uname -m) + +# Operating system type +OS_TYPE ?= $(shell uname) + .PHONY: setup-environment run-gateway-tests run-validator-tests run-agent-test -.ONESHELL: -setup-environment: - set -e - k3d registry create k3d-registry --port 5000 - k3d cluster create k3d --registry-use k3d-k3d-registry:5000 - kubectl cluster-info - CLI_VERSION=$(shell curl -s https://api.github.com/repos/kyma-project/cli/releases/latest | grep tag_name | cut -d '"' -f 4); \ - curl -Lo kyma.tar.gz https://github.com/kyma-project/cli/releases/download/$$CLI_VERSION/kyma_Linux_x86_64.tar.gz && mkdir kyma-release && tar -C kyma-release -zxvf kyma.tar.gz && chmod +x kyma-release/kyma && mv kyma-release/kyma /usr/local/bin && rm -rf kyma-release kyma.tar.gz +setup-environment: kyma ## Setup environment for tests + ${KYMA} provision k3d \ + --registry-port ${REGISTRY_PORT} \ + --name ${CLUSTER_NAME} \ + -p 8080:80@loadbalancer \ + -p 8443:443@loadbalancer \ + --ci k3d-gateway-tests: setup-environment apk add openssl @@ -18,7 +27,6 @@ k3d-gateway-tests: setup-environment make -f Makefile.test-application-gateway test k3d cluster delete - k3d-validator-tests: setup-environment kyma deploy --ci --components-file ${PROJECT_ROOT}/resources/installation-config/mini-kyma-skr.yaml --value global.disableLegacyConnectivity=true --source=local --workspace ${KYMA_ROOT_CI} cd ${PROJECT_ROOT} @@ -31,4 +39,27 @@ k3d-agent-tests: setup-environment kubectl -n kube-system delete pods -l k8s-app=kube-dns cd ${PROJECT_ROOT} make -f Makefile.test-compass-runtime-agent test - k3d cluster delete \ No newline at end of file + k3d cluster delete + +##@ Tools + +## Location to install dependencies to +LOCALBIN ?= $(shell pwd)/bin +$(LOCALBIN): + mkdir -p $(LOCALBIN) + +########## Kyma CLI ########### +KYMA_STABILITY ?= unstable + +define os_error +$(error Error: unsuported platform OS_TYPE:$1, OS_ARCH:$2; to mitigate this problem set variable KYMA with absolute path to kyma-cli binary compatible with your operating system and architecture) +endef + +KYMA_FILE_NAME ?= kyma-linux + +KYMA ?= $(LOCALBIN)/kyma-$(KYMA_STABILITY) +kyma: $(LOCALBIN) $(KYMA) ## Download kyma locally if necessary. +$(KYMA): + $(if $(KYMA_FILE_NAME),,$(call os_error, ${OS_TYPE}, ${OS_ARCH})) + test -f $@ || curl -s -Lo $(KYMA) https://storage.googleapis.com/kyma-cli-$(KYMA_STABILITY)/$(KYMA_FILE_NAME) +