Skip to content

Commit

Permalink
ci runtime build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qdrvm-ci committed Jun 24, 2024
1 parent 4f68bc2 commit 46d7138
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 2 deletions.
5 changes: 3 additions & 2 deletions housekeeping/docker/kagome-dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ 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 @@ -132,7 +133,7 @@ runtime_cache:
mkdir -p /tmp/kagome_runtime && \
cp -r /tmp/kagome/runtimes-cache/* /tmp/kagome_runtime && \
cd /opt/kagome/housekeeping/docker/kagome-dev && \
./build_apt_package.sh \
./build_apt_package_runtime.sh \
\"$${RUNTIME_VERSION}\" \
$(PACKAGE_ARCHITECTURE) \
kagome-dev-runtime \
Expand All @@ -152,4 +153,4 @@ upload_apt_package_runtime:
RUNTIME_VERSION=$$(python3 get_wasmedge_version.py); \
gcloud config set artifacts/repository $(ARTIFACTS_REPO); \
gcloud config set artifacts/location $(REGION); \
gcloud artifacts apt upload $(ARTIFACTS_REPO) --source=./pkg/kagome-dev-runtime_${RUNTIME_VERSION}_$(PACKAGE_ARCHITECTURE).deb
gcloud artifacts apt upload $(ARTIFACTS_REPO) --source=./kagome_runtime/kagome-dev-runtime_${RUNTIME_VERSION}_$(PACKAGE_ARCHITECTURE).deb
103 changes: 103 additions & 0 deletions housekeeping/docker/kagome-dev/build_apt_package_runtime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/bin/bash

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'"
exit 1
}

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

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

# Assign variables from arguments
VERSION=$1
ARCHITECTURE=$2
PACKAGE_NAME=$3
ARTIFACTS_DIR=$4
DESCRIPTION=$5
DEPENDENCIES=$6

# 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
echo "Error: Version is required." >&2
exit 1
fi

if [ -z "$ARCHITECTURE" ]; then
echo "Error: Architecture is required." >&2
exit 1
fi

if [ -z "$PACKAGE_NAME" ]; then
echo "Error: Package name is required." >&2
exit 1
fi

if [ -z "$ARTIFACTS_DIR" ] || [ ! -d "$ARTIFACTS_DIR" ]; then
echo "Error: A valid artifacts directory is required." >&2
exit 1
fi

if [ -z "$DESCRIPTION" ]; then
echo "Error: Description is required." >&2
exit 1
fi

if [ -z "$DEPENDENCIES" ]; then
echo "Error: Dependencies are required." >&2
exit 1
fi

log "Creating package directory structure..."
mkdir -p ./kagome_runtime/${DIR_NAME}
mkdir -p ./kagome_runtime/${DIR_NAME}/tmp/kagome/runtimes-cache/

log "Copying artifacts..."
mv -f ${ARTIFACTS_DIR}/* ./kagome_runtime/${DIR_NAME}/tmp/kagome/runtimes-cache/

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: ./kagome_runtime/${DIR_NAME}/tmp/kagome/runtimes-cache/
log "Creating control file..."
cat <<EOF > ./kagome_runtime/${DIR_NAME}/DEBIAN/control
Package: ${PACKAGE_NAME}
Version: ${VERSION}
Maintainer: ${MAINTAINER}
Depends: ${DEPENDENCIES}
Architecture: ${ARCHITECTURE}
Homepage: ${HOMEPAGE}
Description: ${DESCRIPTION}
EOF
log "Building the package..."
dpkg --build ./pkg/${DIR_NAME}
log "Displaying package info..."
dpkg-deb --info ./pkg/${DIR_NAME}.deb
log "Package created successfully."

0 comments on commit 46d7138

Please sign in to comment.