Skip to content

Commit

Permalink
Updated extended block log creation job to be able to build from spec…
Browse files Browse the repository at this point in the history
…ific commit
  • Loading branch information
Forinil committed Jan 24, 2025
1 parent 6193f05 commit b2f0703
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .gitlab-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ extended_block_log_creation:
artifacts: true
variables:
REGISTRY: "${CI_REGISTRY_IMAGE}"
IMAGE_TAG: ${CI_COMMIT_SHORT_SHA}
HIVE_SRC: ${CI_PROJECT_DIR}
IMAGE_TAG: "${CI_COMMIT_SHORT_SHA}"
HIVE_SRC: "${CI_PROJECT_DIR}"
HIVE_COMMIT: "${CI_COMMIT_SHORT_SHA}"
BLOCK_LOG_SOURCE_DIR: "/blockchain/block_log_5m"
BINARY_PATH: "${CI_PROJECT_DIR}/hived-mirrornet-binaries"
rules:
Expand All @@ -285,7 +286,8 @@ extended_block_log_creation:
changes:
paths:
- scripts/ci-helpers/extended_block_log_creation.gitlab-ci.yml
- scripts/ci-helpers/prepare_extendend_mirrornet_block_log.sh
- scripts/ci-helpers/prepare_extended_mirrornet_block_log.sh
- scripts/ci-helpers/prepare_extended_mirrornet_block_log_for_commit.sh
- tests/python/functional/util/block_logs_for_denser/generate_block_log_for_denser.py
when: always
- when: never
Expand Down
3 changes: 2 additions & 1 deletion scripts/ci-helpers/extended_block_log_creation.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ variables:
REGISTRY_PASS: "${CI_REGISTRY_PASSWORD}"
IMAGE_TAG: ""
HIVE_SRC: ""
HIVE_COMMIT: ""
BLOCK_LOG_SOURCE_DIR: ""
MIRRORNET_WORKING_DIR: "${CI_PROJECT_DIR}/mirrornet"
MIRRORNET_SOURCE_5M_DATA_DIR: "${MIRRORNET_WORKING_DIR}/mirrornet_blockchain_data"
Expand All @@ -36,7 +37,7 @@ variables:
cp "${BLOCK_LOG_SOURCE_DIR}/block_log" "${MIRRORNET_SOURCE_5M_DATA_DIR}"
echo -e "\e[0Ksection_end:$(date +%s):prepare\r\e[0K"
script:
- "${HIVE_SRC}/scripts/ci-helpers/prepare_extendend_mirrornet_block_log.sh"
- "${HIVE_SRC}/scripts/ci-helpers/prepare_extended_mirrornet_block_log_for_commit.sh"
artifacts:
reports:
dotenv:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -e

echo "Preparing environment..."

SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1; pwd -P )"
SCRIPTSDIR="$SCRIPTPATH/.."
SRC_DIR="$(realpath "${SCRIPTSDIR}/..")"

export LOG_FILE=build_instance4commit.log
# shellcheck source=../common.sh
source "$SCRIPTSDIR/common.sh"

HIVE_SRC="${HIVE_SRC:-${SRC_DIR}}"
HIVE_COMMIT="${HIVE_COMMIT:-${CI_COMMIT_SHORT_SHA:-$1}}"

echo "Hive source located at ${HIVE_SRC}. Requested commit: ${HIVE_COMMIT}"

pushd "${HIVE_SRC}"
git fetch
CURRENT_COMMIT=$(git rev-parse --verify HEAD)
TARGET_COMMIT=$(git rev-parse --verify "${HIVE_COMMIT}")

echo -e "Current commit: ${CURRENT_COMMIT}.\nDesired commit: ${TARGET_COMMIT}"

if [ "${TARGET_COMMIT}" != "${CURRENT_COMMIT}" ]; then
git config --global init.defaultBranch "develop" # Suppress default branch name warning
do_clone "develop" "${HIVE_SRC}/hive-${TARGET_COMMIT}" https://gitlab.syncad.com/hive/hive.git "${TARGET_COMMIT}"
HIVE_SRC="${HIVE_SRC}/hive-${TARGET_COMMIT}"
pushd "${HIVE_SRC}"
echo "Hive source changed to ${HIVE_SRC}"
fi

"${HIVE_SRC}/scripts/ci-helpers/prepare_extended_mirrornet_block_log.sh"

if [ "${TARGET_COMMIT}" != "${CURRENT_COMMIT}" ]; then
popd
rm -rf "${HIVE_SRC}"
fi

popd

0 comments on commit b2f0703

Please sign in to comment.