Skip to content

Commit

Permalink
Kagome runtime ci update
Browse files Browse the repository at this point in the history
  • Loading branch information
qdrvm-ci committed Jun 24, 2024
1 parent 46d7138 commit 8090838
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 130 deletions.
3 changes: 2 additions & 1 deletion housekeeping/docker/kagome-dev/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ polkadot

cargo/
pkg/
polkadot_binary/
polkadot_binary/
kagome_runtime/
11 changes: 6 additions & 5 deletions housekeeping/docker/kagome-dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ runtime_cache:
-e PACKAGE_ARCHITECTURE=$(PACKAGE_ARCHITECTURE) \
-e GOOGLE_APPLICATION_CREDENTIALS=/root/.gcp/google_creds.json \
-v $$(pwd)/../../../../kagome:/opt/kagome \
-v ./kagome_runtime:/tmp/kagome_runtime \
-v $(GOOGLE_APPLICATION_CREDENTIALS):/root/.gcp/google_creds.json \
$(DOCKER_REGISTRY_PATH)zombie_tester:latest \
-c "tail -f /dev/null"; \
Expand All @@ -130,16 +129,17 @@ runtime_cache:
sed -i '1s/^#//' /etc/apt/sources.list.d/kagome.list && \
install_packages kagome-dev && \
./precompile.sh && \
cd /opt/kagome/housekeeping/docker/kagome-dev && \
mkdir -p /tmp/kagome_runtime && \
cp -r /tmp/kagome/runtimes-cache/* /tmp/kagome_runtime && \
cd /opt/kagome/housekeeping/docker/kagome-dev && \
./build_apt_package_runtime.sh \
./build_apt_package.sh \
\"$${RUNTIME_VERSION}\" \
$(PACKAGE_ARCHITECTURE) \
kagome-dev-runtime \
/tmp/kagome_runtime \
'Kagome Runtime Dev Debian Package' \
'kagome' ; \
'kagome-dev' \
/tmp/kagome/runtimes-cache/ ; \
" || DOCKER_EXEC_RESULT=$$? ; \
if [ $$DOCKER_EXEC_RESULT -ne 0 ]; then \
echo "Error: Docker exec failed with return code $$DOCKER_EXEC_RESULT"; \
Expand All @@ -151,6 +151,7 @@ runtime_cache:

upload_apt_package_runtime:
RUNTIME_VERSION=$$(python3 get_wasmedge_version.py); \
echo "Runtime version: $$RUNTIME_VERSION"; \
gcloud config set artifacts/repository $(ARTIFACTS_REPO); \
gcloud config set artifacts/location $(REGION); \
gcloud artifacts apt upload $(ARTIFACTS_REPO) --source=./kagome_runtime/kagome-dev-runtime_${RUNTIME_VERSION}_$(PACKAGE_ARCHITECTURE).deb
gcloud artifacts apt upload $(ARTIFACTS_REPO) --source=./pkg/kagome-dev-runtime_$${RUNTIME_VERSION}_$(PACKAGE_ARCHITECTURE).deb
40 changes: 19 additions & 21 deletions housekeeping/docker/kagome-dev/build_apt_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,33 @@

set -euo pipefail

# Function to display usage
usage() {
echo "Usage: $0 <version> <architecture> <package_name> <artifacts_dir> <description> <dependencies>"
echo "Example: $0 1.0 amd64 mypackage /path/to/artifacts 'libc6, libssl1.1'"
echo "Usage: $0 <version> <architecture> <package_name> <artifacts_dir> <description> <dependencies> [<binary_install_dir>]"
echo "Example: $0 1.0 amd64 mypackage /path/to/artifacts 'libc6, libssl1.1' /usr/local/bin"
exit 1
}

# Function to log messages
log() {
local MESSAGE=$1
echo "[INFO] $MESSAGE"
}

# Check for the correct number of arguments
if [ "$#" -ne 6 ]; then
if [ "$#" -lt 6 ] || [ "$#" -gt 7 ]; then
usage
fi

# Assign variables from arguments
VERSION=$1
ARCHITECTURE=$2
PACKAGE_NAME=$3
ARTIFACTS_DIR=$4
DESCRIPTION=$5
DEPENDENCIES=$6
BINARY_INSTALL_DIR=${7:-/usr/local/bin}

# Define maintainer and homepage variables
MAINTAINER="Zak Fein <[email protected]>"
HOMEPAGE="https://qdrvm.io"
DIR_NAME=${PACKAGE_NAME}_${VERSION}_${ARCHITECTURE}

# Validate parameters
log "Validating parameters..."

if [ -z "$VERSION" ]; then
Expand Down Expand Up @@ -68,20 +63,23 @@ fi

log "Creating package directory structure..."
mkdir -p ./pkg/${DIR_NAME}/DEBIAN
mkdir -p ./pkg/${DIR_NAME}/usr/local/bin
mkdir -p ./pkg/${DIR_NAME}${BINARY_INSTALL_DIR}

log "Working directory: $(pwd)/pkg/"

log "Copying artifacts..."
mv -f ${ARTIFACTS_DIR}/* ./pkg/${DIR_NAME}/usr/local/bin/

echo "Package: ${PACKAGE_NAME}"
echo "Version: ${VERSION}"
echo "Maintainer: ${MAINTAINER}"
echo "Depends: ${DEPENDENCIES}"
echo "Architecture: ${ARCHITECTURE}"
echo "Homepage: ${HOMEPAGE}"
echo "Description: ${DESCRIPTION}"
echo "Artifacts: ${ARTIFACTS_DIR}"
echo "Directory: ./pkg/${DIR_NAME}/usr/local/bin/"
mv -f ${ARTIFACTS_DIR}/* ./pkg/${DIR_NAME}${BINARY_INSTALL_DIR}/

log "Package: ${PACKAGE_NAME}"
log "Version: ${VERSION}"
log "Maintainer: ${MAINTAINER}"
log "Depends: ${DEPENDENCIES}"
log "Architecture: ${ARCHITECTURE}"
log "Homepage: ${HOMEPAGE}"
log "Description: ${DESCRIPTION}"
log "Artifacts: ${ARTIFACTS_DIR}"
log "Binary Install Directory: ${BINARY_INSTALL_DIR}"
log "Directory: ./pkg/${DIR_NAME}${BINARY_INSTALL_DIR}/"

log "Creating control file..."
cat <<EOF > ./pkg/${DIR_NAME}/DEBIAN/control
Expand Down
103 changes: 0 additions & 103 deletions housekeeping/docker/kagome-dev/build_apt_package_runtime.sh

This file was deleted.

0 comments on commit 8090838

Please sign in to comment.