mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-30 23:33:34 +00:00 
			
		
		
		
	Major update to cypress
- Updated cypress - Ground work for testing DNS certs in CI
This commit is contained in:
		| @@ -16,7 +16,7 @@ if hash docker 2>/dev/null; then | ||||
| 		-e NODE_OPTIONS=--openssl-legacy-provider \ | ||||
| 		-v "$(pwd)/frontend:/app/frontend" \ | ||||
| 		-v "$(pwd)/global:/app/global" \ | ||||
| 		-w /app/frontend "$DOCKER_IMAGE" \ | ||||
| 		-w /app/frontend "${DOCKER_IMAGE}" \ | ||||
| 		sh -c "yarn install && yarn build && yarn build && chown -R $(id -u):$(id -g) /app/frontend" | ||||
|  | ||||
| 	echo -e "${BLUE}❯ ${GREEN}Building Frontend Complete${RESET}" | ||||
|   | ||||
							
								
								
									
										94
									
								
								scripts/ci/fulltest-cypress
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										94
									
								
								scripts/ci/fulltest-cypress
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,94 @@ | ||||
| #!/bin/bash | ||||
| set -e | ||||
|  | ||||
| STACK="${1:-sqlite}" | ||||
|  | ||||
| DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||
| # remember this is running in "ci" folder.. | ||||
|  | ||||
| # Some defaults for running this script outside of CI | ||||
| export COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-npm_local_fulltest}" | ||||
| export IMAGE="${IMAGE:-nginx-proxy-manager}" | ||||
| export BRANCH_LOWER="${BRANCH_LOWER:-unknown}" | ||||
| export BUILD_NUMBER="${BUILD_NUMBER:-0000}" | ||||
|  | ||||
| if [ "${COMPOSE_FILE:-}" = "" ]; then | ||||
| 	export COMPOSE_FILE="docker/docker-compose.ci.yml:docker/docker-compose.ci.${STACK}.yml" | ||||
| fi | ||||
|  | ||||
| # Colors | ||||
| BLUE='\E[1;34m' | ||||
| CYAN='\E[1;36m' | ||||
| GREEN='\E[1;32m' | ||||
| RESET='\E[0m' | ||||
| YELLOW='\E[1;33m' | ||||
|  | ||||
| export BLUE CYAN GREEN RESET YELLOW | ||||
|  | ||||
| echo -e "${BLUE}❯ ${CYAN}Starting fullstack cypress testing ...${RESET}" | ||||
|  | ||||
| NETWORK_NAME="${COMPOSE_PROJECT_NAME}_default" | ||||
|  | ||||
| # $1: container_name | ||||
| get_container_ip () { | ||||
| 	local container_name=$1 | ||||
| 	local container | ||||
| 	local ip | ||||
| 	container=$(docker-compose ps --all -q "${container_name}" | tail -n1) | ||||
| 	ip=$(docker inspect -f "{{.NetworkSettings.Networks.${NETWORK_NAME}.IPAddress}}" "$container") | ||||
| 	echo "$ip" | ||||
| } | ||||
|  | ||||
| # $1: container_name | ||||
| get_container_aliases () { | ||||
| 	local container_name=$1 | ||||
| 	local container | ||||
| 	local ip | ||||
| 	container=$(docker-compose ps --all -q "${container_name}" | tail -n1) | ||||
| 	ip=$(docker inspect -f "{{.NetworkSettings.Networks.${NETWORK_NAME}.Aliases}}" "$container") | ||||
| 	echo "$ip" | ||||
| } | ||||
|  | ||||
| # Bring up a stack, in steps so we can inject IPs everywhere | ||||
| docker-compose up -d pdns pdns-db | ||||
| PDNS_IP=$(get_container_ip "pdns") | ||||
| echo -e "${BLUE}❯ ${YELLOW}PDNS IP is ${PDNS_IP}${RESET}" | ||||
|  | ||||
| # adjust the dnsrouter config | ||||
| LOCAL_DNSROUTER_CONFIG="$DIR/../../docker/dev/dnsrouter-config.json" | ||||
| rm -rf "$LOCAL_DNSROUTER_CONFIG.tmp" | ||||
| # IMPORTANT: changes to dnsrouter-config.json will affect this line: | ||||
| jq --arg a "$PDNS_IP" '.servers[0].upstreams[1].upstream = $a' "$LOCAL_DNSROUTER_CONFIG" > "$LOCAL_DNSROUTER_CONFIG.tmp" | ||||
|  | ||||
| docker-compose up -d dnsrouter | ||||
| DNSROUTER_IP=$(get_container_ip "dnsrouter") | ||||
| echo -e "${BLUE}❯ ${YELLOW}DNS Router IP is ${DNSROUTER_IP}" | ||||
|  | ||||
| # mount the resolver | ||||
| LOCAL_RESOLVE="$DIR/../../docker/dev/resolv.conf" | ||||
| rm -rf "${LOCAL_RESOLVE}" | ||||
| printf "nameserver %s\noptions ndots:0" "${DNSROUTER_IP}" > "${LOCAL_RESOLVE}" | ||||
|  | ||||
| # bring up all remaining containers, except cypress! | ||||
| docker-compose up -d --remove-orphans stepca | ||||
| docker-compose pull db-mysql || true # ok to fail | ||||
| docker-compose up -d --remove-orphans --pull=never fullstack | ||||
|  | ||||
| # wait for main container to be healthy | ||||
| bash "$DIR/../wait-healthy" "$(docker-compose ps --all -q fullstack)" 120 | ||||
|  | ||||
| # Run tests | ||||
| rm -rf "$DIR/../../test/results" | ||||
| docker-compose up --build cypress | ||||
|  | ||||
| # Get results | ||||
| docker cp -L "$(docker-compose ps --all -q cypress):/test/results" "$DIR/../../test/" | ||||
| docker cp -L "$(docker-compose ps --all -q fullstack):/data/logs" "$DIR/../../test/results/" | ||||
|  | ||||
| if [ "$2" = "cleanup" ]; then | ||||
| 	echo -e "${BLUE}❯ ${CYAN}Cleaning up containers ...${RESET}" | ||||
| 	docker-compose down --remove-orphans --volumes -t 30 | ||||
| fi | ||||
|  | ||||
| echo -e "${BLUE}❯ ${GREEN}Fullstack cypress testing complete${RESET}" | ||||
|  | ||||
| @@ -3,8 +3,8 @@ | ||||
| DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||
| . "$DIR/../.common.sh" | ||||
|  | ||||
| DOCKER_IMAGE=nginxproxymanager/nginx-full:certbot-node | ||||
| docker pull "${DOCKER_IMAGE}" | ||||
| TESTING_IMAGE=nginxproxymanager/nginx-full:certbot-node | ||||
| docker pull "${TESTING_IMAGE}" | ||||
|  | ||||
| # Test | ||||
| echo -e "${BLUE}❯ ${CYAN}Testing backend ...${RESET}" | ||||
| @@ -12,20 +12,20 @@ docker run --rm \ | ||||
| 	-v "$(pwd)/backend:/app" \ | ||||
| 	-v "$(pwd)/global:/app/global" \ | ||||
| 	-w /app \ | ||||
| 	"${DOCKER_IMAGE}" \ | ||||
| 	"${TESTING_IMAGE}" \ | ||||
| 	sh -c 'yarn install && yarn eslint . && rm -rf node_modules' | ||||
| echo -e "${BLUE}❯ ${GREEN}Testing Complete${RESET}" | ||||
|  | ||||
| # Build | ||||
| echo -e "${BLUE}❯ ${CYAN}Building ...${RESET}" | ||||
| docker build --pull --no-cache --compress \ | ||||
| 	-t "${IMAGE}:ci-${BUILD_NUMBER}" \ | ||||
| 	-t "${IMAGE:-nginx-proxy-manager}:${BRANCH_LOWER:-unknown}-ci-${BUILD_NUMBER:-0000}" \ | ||||
| 	-f docker/Dockerfile \ | ||||
| 	--progress=plain \ | ||||
| 	--build-arg TARGETPLATFORM=linux/amd64 \ | ||||
| 	--build-arg BUILDPLATFORM=linux/amd64 \ | ||||
| 	--build-arg BUILD_VERSION="${BUILD_VERSION}" \ | ||||
| 	--build-arg BUILD_COMMIT="${BUILD_COMMIT}" \ | ||||
| 	--build-arg BUILD_VERSION="${BUILD_VERSION:-unknown}" \ | ||||
| 	--build-arg BUILD_COMMIT="${BUILD_COMMIT:-unknown}" \ | ||||
| 	--build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \ | ||||
| 	. | ||||
| echo -e "${BLUE}❯ ${GREEN}Building Complete${RESET}" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user