forked from p34709852/monkey
Build: Move final build artifact to dist/ directory
This commit is contained in:
parent
5de6a562ba
commit
6aff4a16b2
|
@ -22,7 +22,7 @@ remove build artifacts by running `appimage/clean.sh`
|
||||||
### Running the AppImage
|
### Running the AppImage
|
||||||
|
|
||||||
The build script will produce an AppImage executable named
|
The build script will produce an AppImage executable named
|
||||||
`Infection_Monkey-x86_64.AppImage`. Simply execute this file and you're off to
|
`./dist/Infection_Monkey-x86_64.AppImage`. Simply execute this file and you're off to
|
||||||
the races.
|
the races.
|
||||||
|
|
||||||
A new directory, `$HOME/.monkey_island` will be created to store runtime
|
A new directory, `$HOME/.monkey_island` will be created to store runtime
|
||||||
|
@ -42,4 +42,5 @@ NOTE: This script is intended to be run from a clean VM. You can also manually
|
||||||
remove build artifacts by running `docker/clean.sh`
|
remove build artifacts by running `docker/clean.sh`
|
||||||
|
|
||||||
### Running the Docker Image
|
### Running the Docker Image
|
||||||
See `docker/DOCKER_README.md` for instructions on running the docker image.
|
The build script will produce a `.tgz` file in `./dist/`. See
|
||||||
|
`docker/DOCKER_README.md` for instructions on running the docker image.
|
||||||
|
|
|
@ -122,11 +122,15 @@ add_apprun() {
|
||||||
}
|
}
|
||||||
|
|
||||||
build_package() {
|
build_package() {
|
||||||
|
local version=$1
|
||||||
|
local dist_dir=$2
|
||||||
log_message "Building AppImage"
|
log_message "Building AppImage"
|
||||||
pushd "$APPIMAGE_DIR"
|
pushd "$APPIMAGE_DIR"
|
||||||
|
|
||||||
ARCH="x86_64" appimagetool "$APPIMAGE_DIR/squashfs-root"
|
ARCH="x86_64" appimagetool "$APPIMAGE_DIR/squashfs-root"
|
||||||
apply_version_to_appimage "$1"
|
apply_version_to_appimage "$version"
|
||||||
|
|
||||||
|
move_package_to_dist_dir $dist_dir
|
||||||
|
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
@ -135,3 +139,7 @@ apply_version_to_appimage() {
|
||||||
log_message "Renaming Infection_Monkey-x86_64.AppImage -> Infection_Monkey-$1-x86_64.AppImage"
|
log_message "Renaming Infection_Monkey-x86_64.AppImage -> Infection_Monkey-$1-x86_64.AppImage"
|
||||||
mv "Infection_Monkey-x86_64.AppImage" "Infection_Monkey-$1-x86_64.AppImage"
|
mv "Infection_Monkey-x86_64.AppImage" "Infection_Monkey-$1-x86_64.AppImage"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
move_package_to_dist_dir() {
|
||||||
|
mv Infection_Monkey*.AppImage "$1/"
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ WORKSPACE=${WORKSPACE:-$HOME}
|
||||||
DEFAULT_REPO_MONKEY_HOME=$WORKSPACE/git/monkey
|
DEFAULT_REPO_MONKEY_HOME=$WORKSPACE/git/monkey
|
||||||
MONKEY_ORIGIN_URL="https://github.com/guardicore/monkey.git"
|
MONKEY_ORIGIN_URL="https://github.com/guardicore/monkey.git"
|
||||||
NODE_SRC=https://deb.nodesource.com/setup_12.x
|
NODE_SRC=https://deb.nodesource.com/setup_12.x
|
||||||
|
BUILD_SCRIPTS_DIR="$(realpath $(dirname $BASH_SOURCE[0]))"
|
||||||
|
DIST_DIR="$BUILD_SCRIPTS_DIR/dist"
|
||||||
|
|
||||||
log_message() {
|
log_message() {
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
|
@ -187,12 +189,16 @@ if ! is_valid_git_repo "$monkey_repo"; then
|
||||||
clone_monkey_repo "$monkey_repo" "$branch"
|
clone_monkey_repo "$monkey_repo" "$branch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$DIST_DIR" ]; then
|
||||||
|
mkdir "$DIST_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
install_build_prereqs
|
install_build_prereqs
|
||||||
install_package_specific_build_prereqs "$WORKSPACE"
|
install_package_specific_build_prereqs "$WORKSPACE"
|
||||||
|
|
||||||
|
|
||||||
setup_build_dir "$agent_binary_dir" "$monkey_repo"
|
setup_build_dir "$agent_binary_dir" "$monkey_repo"
|
||||||
build_package "$monkey_version"
|
build_package "$monkey_version" "$DIST_DIR"
|
||||||
|
|
||||||
log_message "Finished building package: $package"
|
log_message "Finished building package: $package"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -36,6 +36,7 @@ copy_server_config_to_build_dir() {
|
||||||
|
|
||||||
build_package() {
|
build_package() {
|
||||||
local version=$1
|
local version=$1
|
||||||
|
local dist_dir=$2
|
||||||
pushd ./docker
|
pushd ./docker
|
||||||
|
|
||||||
docker_image_name="guardicore/monkey-island:$version"
|
docker_image_name="guardicore/monkey-island:$version"
|
||||||
|
@ -44,6 +45,8 @@ build_package() {
|
||||||
build_docker_image_tar "$docker_image_name" "$tar_name"
|
build_docker_image_tar "$docker_image_name" "$tar_name"
|
||||||
build_docker_image_tgz "$tar_name" "$version"
|
build_docker_image_tgz "$tar_name" "$version"
|
||||||
|
|
||||||
|
move_package_to_dist_dir $dist_dir
|
||||||
|
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,3 +61,7 @@ build_docker_image_tgz() {
|
||||||
cp ./DOCKER_README.md ./tgz/README.md
|
cp ./DOCKER_README.md ./tgz/README.md
|
||||||
tar -C ./tgz -cvf "$OUTPUT_NAME_TGZ" --gzip .
|
tar -C ./tgz -cvf "$OUTPUT_NAME_TGZ" --gzip .
|
||||||
}
|
}
|
||||||
|
|
||||||
|
move_package_to_dist_dir() {
|
||||||
|
mv $OUTPUT_NAME_TGZ "$1/"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue