forked from p34709852/monkey
Build: Refactor commit id
This commit is contained in:
parent
e406294b28
commit
6d827ad1af
|
@ -35,8 +35,6 @@ setup_build_dir() {
|
|||
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
build_commit=$(git -C "$monkey_repo" rev-parse --short HEAD)
|
||||
|
||||
copy_monkey_island_to_build_dir "$monkey_repo/monkey" "$BUILD_DIR"
|
||||
copy_server_config_to_build_dir
|
||||
modify_deployment "$deployment_type" "$BUILD_DIR"
|
||||
|
@ -107,7 +105,8 @@ remove_python_appdir_artifacts() {
|
|||
|
||||
build_package() {
|
||||
local version=$1
|
||||
local dist_dir=$2
|
||||
local commit_id=$2
|
||||
local dist_dir=$3
|
||||
|
||||
log_message "Building AppImage"
|
||||
set_version "$version"
|
||||
|
@ -125,7 +124,7 @@ build_package() {
|
|||
if $IS_RELEASE_BUILD; then
|
||||
dst_name="InfectionMonkey-v$version.AppImage"
|
||||
else
|
||||
dst_name="InfectionMonkey-$build_commit.AppImage"
|
||||
dst_name="InfectionMonkey-$commit_id.AppImage"
|
||||
fi
|
||||
move_package_to_dist_dir $dist_dir $dst_name
|
||||
|
||||
|
|
|
@ -198,7 +198,8 @@ install_package_specific_build_prereqs "$WORKSPACE"
|
|||
|
||||
|
||||
setup_build_dir "$agent_binary_dir" "$monkey_repo" "$deployment_type"
|
||||
build_package "$monkey_version" "$DIST_DIR"
|
||||
commit_id=$(get_commit_id "$monkey_repo")
|
||||
build_package "$monkey_version" "$commit_id" "$DIST_DIR"
|
||||
|
||||
log_message "Finished building package: $package"
|
||||
exit 0
|
||||
|
|
|
@ -93,3 +93,8 @@ remove_node_modules() {
|
|||
rm -rf "$1/node_modules"
|
||||
rm -rf "$1/.npm"
|
||||
}
|
||||
|
||||
get_commit_id() {
|
||||
local monkey_repo=$1
|
||||
echo $(git -C "$monkey_repo" rev-parse --short HEAD)
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ setup_build_dir() {
|
|||
|
||||
copy_entrypoint_to_build_dir "$build_dir"
|
||||
|
||||
build_commit=$(git -C "$monkey_repo" rev-parse --short HEAD)
|
||||
|
||||
copy_monkey_island_to_build_dir "$monkey_repo/monkey" "$build_dir"
|
||||
copy_server_config_to_build_dir "$build_dir"
|
||||
modify_deployment "$deployment_type" "$build_dir"
|
||||
|
@ -38,13 +36,14 @@ copy_server_config_to_build_dir() {
|
|||
|
||||
build_package() {
|
||||
local version=$1
|
||||
local dist_dir=$2
|
||||
local commit_id=$2
|
||||
local dist_dir=$3
|
||||
pushd ./docker
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
version="v$version"
|
||||
else
|
||||
version="$build_commit"
|
||||
version="$commit_id"
|
||||
fi
|
||||
|
||||
docker_image_name="guardicore/monkey-island:$version"
|
||||
|
|
Loading…
Reference in New Issue