From e8df89d583f8a94281e413166ec6874bd2e47047 Mon Sep 17 00:00:00 2001 From: Zak Fein Date: Sat, 20 Jul 2024 21:20:31 +0300 Subject: [PATCH] runtime cache build update --- housekeeping/docker/kagome-dev/Makefile | 9 +++++---- zombienet/docker/Makefile | 26 +++++++++++++++++-------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/housekeeping/docker/kagome-dev/Makefile b/housekeeping/docker/kagome-dev/Makefile index 24747ef30d..d9caf4723b 100644 --- a/housekeeping/docker/kagome-dev/Makefile +++ b/housekeeping/docker/kagome-dev/Makefile @@ -3,6 +3,7 @@ RUST_VERSION ?= 1.79.0 # bookworm (Debian 12) MINIDEB_IMAGE ?= bitnami/minideb@sha256:6cc3baf349947d587a9cd4971e81ff3ffc0d17382f2b5b6de63d6542bff10c16 +KAGOME_PACKAGE_VERSION ?= 20.07.24-0fa54d1-Release PLATFORM ?= linux/amd64 ARCHITECTURE ?= x86_64 @@ -83,13 +84,13 @@ kagome_dev_docker_build: source /venv/bin/activate && \ git submodule update --init && \ echo \"Building in $(pwd)\" && \ - cmake . -B\"$(BUILD_DIR)\" -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=\"${BUILD_TYPE}\" -DBACKWARD=OFF && \ + cmake . -B\"$(BUILD_DIR)\" -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=\"$(BUILD_TYPE)\" -DBACKWARD=OFF && \ cmake --build \"$(BUILD_DIR)\" --target kagome -- -j${BUILD_THREADS} && \ mkdir -p /tmp/kagome && \ cp /opt/kagome/$(BUILD_DIR)/node/kagome /tmp/kagome/kagome && \ cd /opt/kagome/housekeeping/docker/kagome-dev && \ ./build_apt_package.sh \ - \"$$(date +'%d.%m.%y')-$${SHORT_COMMIT_HASH}-$${BUILD_TYPE}\" \ + \"$$(date +'%d.%m.%y')-$${SHORT_COMMIT_HASH}-$(BUILD_TYPE)\" \ $(PACKAGE_ARCHITECTURE) \ kagome-dev \ /tmp/kagome \ @@ -107,7 +108,7 @@ upload_apt_package: SHORT_COMMIT_HASH=$$(grep 'short_commit_hash:' commit_hash.txt | cut -d ' ' -f 2); \ gcloud config set artifacts/repository $(ARTIFACTS_REPO); \ gcloud config set artifacts/location $(REGION); \ - gcloud artifacts apt upload $(ARTIFACTS_REPO) --source=./pkg/kagome-dev_$$(date +'%d.%m.%y')-$${SHORT_COMMIT_HASH}-$${BUILD_TYPE}_$(PACKAGE_ARCHITECTURE).deb + gcloud artifacts apt upload $(ARTIFACTS_REPO) --source=./pkg/kagome-dev_$$(date +'%d.%m.%y')-$${SHORT_COMMIT_HASH}-$(BUILD_TYPE)_$(PACKAGE_ARCHITECTURE).deb runtime_cache: @@ -128,7 +129,7 @@ runtime_cache: docker exec -t $$CONTAINER_NAME /bin/bash -c \ "cd /opt/kagome/zombienet && \ sed -i '1s/^#//' /etc/apt/sources.list.d/kagome.list && \ - install_packages kagome-dev && \ + install_packages kagome-dev=$(KAGOME_PACKAGE_VERSION) && \ ./precompile.sh && \ cd /opt/kagome/housekeeping/docker/kagome-dev && \ mkdir -p /tmp/kagome_runtime && \ diff --git a/zombienet/docker/Makefile b/zombienet/docker/Makefile index 68596d30ea..d29f6baf1f 100644 --- a/zombienet/docker/Makefile +++ b/zombienet/docker/Makefile @@ -1,24 +1,27 @@ RUST_IMAGE=rust:1.79-slim-bookworm # bookworm (Debian 12) MINIDEB_IMAGE=bitnami/minideb@sha256:6cc3baf349947d587a9cd4971e81ff3ffc0d17382f2b5b6de63d6542bff10c16 +SCCACHE_VERSION ?= 0.7.4 +# empty for local usage DOCKER_REGISTRY_PATH ?= + PLATFORM ?= linux/amd64 ARCHITECTURE ?= amd64 -SCCACHE_VERSION ?= 0.7.4 + ARTIFACTS_REPO ?= kagome-apt REGION ?= europe-north1 #USE_GCP_SCCACHE ?= true -SCCACHE_GCS_BUCKET ?= +SCCACHE_GCS_BUCKET ?= GOOGLE_APPLICATION_CREDENTIALS ?= -PROJECT_ID ?= +PROJECT_ID ?= CARGO_PACKETS=-p test-parachain-adder-collator -p polkadot-test-malus -p test-parachain-undying-collator -RESULT_BINARIES=./target/testnet/malus ./target/testnet/undying-collator ./target/testnet/adder-collator +RESULT_BINARIES=./target/release/malus ./target/release/undying-collator ./target/release/adder-collator RESULT_BIN_NAMES=malus undying-collator adder-collator -POLKADOT_BINARY_PACKAGE_VERSION ?= +POLKADOT_BINARY_PACKAGE_VERSION ?= KAGOME_PACKAGE_VERSION ?= export DOCKER_BUILDKIT=1 @@ -41,13 +44,14 @@ CUMULUS_RELEASE ?= v0.9.420 POLKADOT_RELEASE ?= v0.9.42 POLKADOT_RELEASE_GLOBAL ?= v0.9.42 -# run_test takes two arguments: +# run_test takes two arguments: # (1) docker image name # (2) test file path # COPY_LOGS_TO_HOST: boolean flag to determine whether to copy logs to host define run_test @CONTAINER_NAME=$$(openssl rand -hex 6); \ + START_TIME=$$(date +%s); \ echo "Running test in container $$CONTAINER_NAME with params \n image:$(1), test:$(2) and \n Kagome package version: $(KAGOME_PACKAGE_VERSION)"; \ TEST_PATH=$$(echo $(2) | xargs); \ docker run --name $$CONTAINER_NAME \ @@ -66,7 +70,13 @@ define run_test if [ "$(COPY_LOGS_TO_HOST)" = "true" ]; then \ $(MAKE) copy_logs_to_host CONTAINER_NAME=$$CONTAINER_NAME; \ fi; \ + END_TIME=$$(date +%s); \ + DURATION=$$((END_TIME - START_TIME)); \ + MINUTES=$$((DURATION / 60)); \ + SECONDS=$$((DURATION % 60)); \ + echo "Test duration: $$MINUTES min $$SECONDS sec"; \ echo "Test finished with exit code $$TEST_EXIT_CODE"; \ + echo "Runtime cache directory content:"; \ exit $$TEST_EXIT_CODE endef @@ -97,7 +107,7 @@ polkadot_builder_push: docker push $(DOCKER_REGISTRY_PATH)polkadot_builder:latest ; \ else \ echo "One or more files are missing."; \ - fi + fi zombie_tester_push: if [ -f polkadot-sdk-versions.txt ]; then \ @@ -159,7 +169,7 @@ polkadot_binary: -c "tail -f /dev/null"; \ docker exec -t $$CONTAINER_NAME /bin/bash -c \ "cargo update $(CARGO_PACKETS) && \ - cargo build --profile testnet $(CARGO_PACKETS) && \ + cargo build --release $(CARGO_PACKETS) && \ cp $(RESULT_BINARIES) /tmp/polkadot_binary/ && \ ./build_apt_package.sh \ $$POLKADOT_RELEASE_GLOBAL_NUMERIC-$$SHORT_COMMIT_HASH \