Skip to content

Commit

Permalink
runtime cache build update
Browse files Browse the repository at this point in the history
  • Loading branch information
Zak Fein committed Jul 21, 2024
1 parent 0fa54d1 commit e8df89d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
9 changes: 5 additions & 4 deletions housekeeping/docker/kagome-dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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:
Expand All @@ -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 && \
Expand Down
26 changes: 18 additions & 8 deletions zombienet/docker/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 \
Expand All @@ -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

Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit e8df89d

Please sign in to comment.