diff --git a/release/package/amzn-2/Dockerfile b/release/package/amzn-2/Dockerfile index 53ff99120..3260dd3d5 100644 --- a/release/package/amzn-2/Dockerfile +++ b/release/package/amzn-2/Dockerfile @@ -14,8 +14,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-amzn-2-x86_64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/amzn-2.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/amzn-2.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/centos-7/Dockerfile b/release/package/centos-7/Dockerfile index b1cadb846..58470be3c 100644 --- a/release/package/centos-7/Dockerfile +++ b/release/package/centos-7/Dockerfile @@ -13,8 +13,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-centos-7-x86_64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/centos-7.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/centos-7.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/centos-9/Dockerfile b/release/package/centos-9/Dockerfile index 27606aee7..f09b6e922 100644 --- a/release/package/centos-9/Dockerfile +++ b/release/package/centos-9/Dockerfile @@ -13,8 +13,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-centos-9-x86_64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/centos-9.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/centos-9.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/debian-10/Dockerfile b/release/package/debian-10/Dockerfile index 163e4e529..e3f6ca5ff 100644 --- a/release/package/debian-10/Dockerfile +++ b/release/package/debian-10/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/debian-10.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/debian-10.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/debian-11-arm/Dockerfile b/release/package/debian-11-arm/Dockerfile index f47517835..2252918e8 100644 --- a/release/package/debian-11-arm/Dockerfile +++ b/release/package/debian-11-arm/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-debian-11-arm64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/debian-11-arm.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/debian-11-arm.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/debian-11/Dockerfile b/release/package/debian-11/Dockerfile index fee4dbe51..50af4c489 100644 --- a/release/package/debian-11/Dockerfile +++ b/release/package/debian-11/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-debian-11-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/debian-11.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/debian-11.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/debian-12-arm/Dockerfile b/release/package/debian-12-arm/Dockerfile index 66edc056f..45be11c6e 100644 --- a/release/package/debian-12-arm/Dockerfile +++ b/release/package/debian-12-arm/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-debian-12-arm64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/debian-12-arm.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/debian-12-arm.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/debian-12/Dockerfile b/release/package/debian-12/Dockerfile index afd21102e..347c36eb4 100644 --- a/release/package/debian-12/Dockerfile +++ b/release/package/debian-12/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-debian-12-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/debian-12.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/debian-12.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/fedora-36/Dockerfile b/release/package/fedora-36/Dockerfile index 801d9d27f..a909f65e8 100644 --- a/release/package/fedora-36/Dockerfile +++ b/release/package/fedora-36/Dockerfile @@ -14,8 +14,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-fedora-36-x86_64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/fedora-36.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/fedora-36.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/fedora-38/Dockerfile b/release/package/fedora-38/Dockerfile index fd27b00b5..2597f8561 100644 --- a/release/package/fedora-38/Dockerfile +++ b/release/package/fedora-38/Dockerfile @@ -14,8 +14,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-fedora-38-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/fedora-38.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/fedora-38.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/fedora-39/Dockerfile b/release/package/fedora-39/Dockerfile index 97d412244..94fd1cd9b 100644 --- a/release/package/fedora-39/Dockerfile +++ b/release/package/fedora-39/Dockerfile @@ -14,8 +14,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-fedora-39-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/fedora-39.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/fedora-39.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/mgbuild.sh b/release/package/mgbuild.sh index 02ba0cd0d..c09ff5e18 100755 --- a/release/package/mgbuild.sh +++ b/release/package/mgbuild.sh @@ -63,7 +63,7 @@ print_help () { echo -e "\nInteract with mgbuild containers" echo -e "\nCommands:" - echo -e " build Build mgbuild image" + echo -e " build [OPTIONS] Build mgbuild image" echo -e " build-memgraph [OPTIONS] Build memgraph binary inside mgbuild container" echo -e " copy OPTIONS Copy an artifact from mgbuild container to host" echo -e " package-memgraph Create memgraph package from built binary inside mgbuild container" @@ -86,6 +86,9 @@ print_help () { echo -e " --threads int Specify the number of threads a command will use (default \"\$(nproc)\" for container)" echo -e " --toolchain string Specify toolchain version (\"${SUPPORTED_TOOLCHAINS[*]}\") (default \"$DEFAULT_TOOLCHAIN\")" + echo -e "\nbuild options:" + echo -e " --git-ref string Specify git ref from which the environment deps will be installed (default \"master\")" + echo -e "\nbuild-memgraph options:" echo -e " --asan Build with ASAN" echo -e " --community Build community version" @@ -103,8 +106,8 @@ print_help () { echo -e " --package Copy memgraph package from mgbuild container to host" echo -e "\npush options:" - echo -e " -p, --password string Specify password for docker login" - echo -e " -u, --username string Specify username for docker login" + echo -e " -p, --password string Specify password for docker login (default empty)" + echo -e " -u, --username string Specify username for docker login (default empty)" echo -e "\nrun options:" echo -e " --pull Pull the mgbuild image before running" @@ -119,6 +122,7 @@ print_help () { echo -e " \"${SUPPORTED_OS_V5[*]}\"" echo -e "\nExample usage:" + echo -e " $SCRIPT_NAME --os debian-12 --toolchain v5 --arch amd build --git-ref my-special-branch" echo -e " $SCRIPT_NAME --os debian-12 --toolchain v5 --arch amd run" echo -e " $SCRIPT_NAME --os debian-12 --toolchain v5 --arch amd --build-type RelWithDebInfo build-memgraph --community" echo -e " $SCRIPT_NAME --os debian-12 --toolchain v5 --arch amd --build-type RelWithDebInfo test-memgraph unit" @@ -275,6 +279,7 @@ build_memgraph () { ;; *) echo "Error: Unknown flag '$1'" + print_help exit 1 ;; esac @@ -413,6 +418,7 @@ copy_memgraph() { ;; *) echo "Error: Unknown flag '$1'" + print_help exit 1 ;; esac @@ -515,6 +521,7 @@ test_memgraph() { ;; *) echo "Error: Unknown test '$1'" + print_help exit 1 ;; esac @@ -573,6 +580,7 @@ while [[ $# -gt 0 ]]; do *) if [[ "$1" =~ ^--.* ]]; then echo -e "Error: Unknown option '$1'" + print_help exit 1 else command=$1 @@ -608,23 +616,42 @@ echo "Using $docker_compose_cmd" case $command in build) cd $SCRIPT_DIR + git_ref_flag="" + while [[ "$#" -gt 0 ]]; do + case "$1" in + --git-ref) + git_ref_flag="--build-arg GIT_REF=$2" + shift 2 + ;; + *) + echo "Error: Unknown flag '$1'" + print_help + exit 1 + ;; + esac + done if [[ "$os" == "all" ]]; then - $docker_compose_cmd -f ${arch}-builders-${toolchain_version}.yml build + $docker_compose_cmd -f ${arch}-builders-${toolchain_version}.yml build $git_ref_flag else - $docker_compose_cmd -f ${arch}-builders-${toolchain_version}.yml build mgbuild_${toolchain_version}_${os} + $docker_compose_cmd -f ${arch}-builders-${toolchain_version}.yml build $git_ref_flag mgbuild_${toolchain_version}_${os} fi ;; run) cd $SCRIPT_DIR pull=false - if [[ "$#" -gt 0 ]]; then - if [[ "$1" == "--pull" ]]; then - pull=true - else - echo "Error: Unknown flag '$1'" - exit 1 - fi - fi + while [[ "$#" -gt 0 ]]; do + case "$1" in + --pull) + pull=true + shift 1 + ;; + *) + echo "Error: Unknown flag '$1'" + print_help + exit 1 + ;; + esac + done if [[ "$os" == "all" ]]; then if [[ "$pull" == "true" ]]; then $docker_compose_cmd -f ${arch}-builders-${toolchain_version}.yml pull --ignore-pull-failures @@ -644,14 +671,19 @@ case $command in stop) cd $SCRIPT_DIR remove=false - if [[ "$#" -gt 0 ]]; then - if [[ "$1" == "--remove" ]]; then - remove=true - else - echo "Error: Unknown flag '$1'" - exit 1 - fi - fi + while [[ "$#" -gt 0 ]]; do + case "$1" in + --remove) + remove=true + shift 1 + ;; + *) + echo "Error: Unknown flag '$1'" + print_help + exit 1 + ;; + esac + done if [[ "$os" == "all" ]]; then $docker_compose_cmd -f ${arch}-builders-${toolchain_version}.yml down else @@ -695,6 +727,7 @@ case $command in ;; *) echo "Error: Unknown command '$command'" + print_help exit 1 ;; esac diff --git a/release/package/rocky-9.3/Dockerfile b/release/package/rocky-9.3/Dockerfile index f0832e1ef..39b2fbf49 100644 --- a/release/package/rocky-9.3/Dockerfile +++ b/release/package/rocky-9.3/Dockerfile @@ -14,8 +14,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-rocky-9.3-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/rocky-9.3.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/rocky-9.3.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/ubuntu-18.04/Dockerfile b/release/package/ubuntu-18.04/Dockerfile index 285d902d2..f8a31deb1 100644 --- a/release/package/ubuntu-18.04/Dockerfile +++ b/release/package/ubuntu-18.04/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-ubuntu-18.04-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/ubuntu-18.04.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/ubuntu-18.04.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/ubuntu-20.04/Dockerfile b/release/package/ubuntu-20.04/Dockerfile index 3e491b573..36d6862af 100644 --- a/release/package/ubuntu-20.04/Dockerfile +++ b/release/package/ubuntu-20.04/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-ubuntu-20.04-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/ubuntu-20.04.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/ubuntu-20.04.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/ubuntu-22.04-arm/Dockerfile b/release/package/ubuntu-22.04-arm/Dockerfile index 9d69826e7..75147f9d5 100644 --- a/release/package/ubuntu-22.04-arm/Dockerfile +++ b/release/package/ubuntu-22.04-arm/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-arm64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git --branch ${GIT_REF} clone https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/ubuntu-22.04-arm.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/ubuntu-22.04-arm.sh install MEMGRAPH_BUILD_DEPS \ diff --git a/release/package/ubuntu-22.04/Dockerfile b/release/package/ubuntu-22.04/Dockerfile index 06f263223..45355fb76 100644 --- a/release/package/ubuntu-22.04/Dockerfile +++ b/release/package/ubuntu-22.04/Dockerfile @@ -16,8 +16,9 @@ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-${TOOL && rm toolchain-${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-amd64.tar.gz # Install toolchain run deps and memgraph build deps +ARG GIT_REF=master SHELL ["/bin/bash", "-c"] -RUN git clone https://github.com/memgraph/memgraph.git \ +RUN git clone --branch ${GIT_REF} https://github.com/memgraph/memgraph.git \ && cd memgraph \ && ./environment/os/ubuntu-22.04.sh install TOOLCHAIN_RUN_DEPS \ && ./environment/os/ubuntu-22.04.sh install MEMGRAPH_BUILD_DEPS \