diff --git a/utils/Dockerfile b/utils/Dockerfile index ad520aab72551f789b2868cab0998d62699e88b3..27ca8dc97e457f73bead5cdf901b87591b07296e 100644 --- a/utils/Dockerfile +++ b/utils/Dockerfile @@ -11,17 +11,42 @@ # SPDX-License-Identifier: EPL-2.0 ################################################################################ -FROM ubuntu:20.04 +FROM eclipseopenpass/opsim-ci:v1.2.7 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get -qq update && apt-get -qq dist-upgrade && apt-get install -qq -y --no-install-recommends \ - python3 \ - python3-distutils \ - python3-pip \ - python3-venv \ - wget \ - sudo \ + curl \ + git \ + unzip \ && apt-get -qq clean ENV PYTHON_EXECUTABLE=python3 + +ARG BAZELISK_VERSION=1.19.0 +ARG BAZELISK_SHA=d28b588ac0916abd6bf02defb5433f6eddf7cba35ffa808eabb65a44aab226f7 +RUN curl -fSsL -L -o /usr/local/bin/bazel \ + "https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VERSION}/bazelisk-linux-amd64" \ + && echo "${BAZELISK_SHA} */usr/local/bin/bazel" | sha256sum --check - \ + && chmod 0755 /usr/local/bin/bazel + +ARG BUILDIFIER_VERSION=6.0.0 +ARG BUILDIFIER_SHA=7ff82176879c0c13bc682b6b0e482d670fbe13bbb20e07915edb0ad11be50502 +RUN curl -fSsL -L -o /usr/local/bin/buildifier \ + "https://github.com/bazelbuild/buildtools/releases/download/${BUILDIFIER_VERSION}/buildifier-linux-amd64" \ + && echo "${BUILDIFIER_SHA} */usr/local/bin/buildifier" | sha256sum --check - \ + && chmod 0755 /usr/local/bin/buildifier + +ARG SHFMT_VERSION=v3.6.0 +ARG SHFMT_SHA=5741a02a641de7e56b8da170e71a97e58050d66a3cf485fb268d6a5a8bb74afb +RUN curl -fSsL -L -o /usr/local/bin/shfmt \ + "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/shfmt_${SHFMT_VERSION}_linux_amd64" \ + && echo "${SHFMT_SHA} */usr/local/bin/shfmt" | sha256sum --check - \ + && chmod 0755 /usr/local/bin/shfmt + +# Verify installation +RUN bazel --version + +RUN chmod -R 777 /opsimulation/conan +RUN mkdir -p /.cache \ + && chmod -R 777 /.cache \ No newline at end of file diff --git a/utils/ci/Jenkinsfile b/utils/ci/Jenkinsfile index d4e05e4af0aeddf59a6b156cb20bdc0d36be0930..f50971bc705dd257664f0fa153768b8b861c1df7 100644 --- a/utils/ci/Jenkinsfile +++ b/utils/ci/Jenkinsfile @@ -23,7 +23,7 @@ pipeline { } environment { IMAGE_NAME = "eclipseopenpass/opsim-ci" - IMAGE_TAG = "v1.2.5" + IMAGE_TAG = "v1.2.8" REPO_URL = "https://gitlab.eclipse.org/eclipse/openpass/opSimulation.git" DOCKERFILE_PATH = "utils/Dockerfile" } @@ -106,7 +106,7 @@ spec: container('openpass-build') { sh 'bash repo/utils/ci/scripts/pull_gecco.sh' sh 'bash repo/utils/ci/scripts/pull_optestrunner.sh' - sh 'bash repo/utils/ci/scripts/pull_gtgen.sh' + sh 'bash repo/utils/ci/scripts/build_gtgen.sh' } } } diff --git a/utils/ci/openpassAgentPod.yaml b/utils/ci/openpassAgentPod.yaml index 7f4b9c2e6900d7fb8f8d4caafe1f84368d889003..60deee1aaae1133d445503fc3c71a00a1bdc540b 100644 --- a/utils/ci/openpassAgentPod.yaml +++ b/utils/ci/openpassAgentPod.yaml @@ -12,7 +12,7 @@ kind: Pod spec: containers: - name: openpass-build - image: "eclipseopenpass/opsim-ci:v1.2.5" + image: "eclipseopenpass/opsim-ci:v1.2.8" tty: true resources: limits: diff --git a/utils/ci/scripts/build_gtgen.sh b/utils/ci/scripts/build_gtgen.sh new file mode 100755 index 0000000000000000000000000000000000000000..71c054222bd59baa1ddd143bd149a9941945b42e --- /dev/null +++ b/utils/ci/scripts/build_gtgen.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +################################################################################ +# Copyright (c) 2025 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# SPDX-License-Identifier: EPL-2.0 +################################################################################ + +################################################################################ +# This Script pull the optestrunner binaries and installs them +################################################################################ + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +if [[ -z "${GTGEN_DIR}" ]]; then + # If not defined, set a default value + GTGEN_DIR="$SCRIPT_DIR/../../../../gtgen_repo" + echo "WARN: GTGEN_DIR variable is not set. Setting it to: + GTGEN_DIR is ${GTGEN_DIR}" +fi + +mkdir -p "$GTGEN_DIR" && cd "$GTGEN_DIR" || exit 1 +rm -rf -- * || { echo "Failed to clean $GTGEN_DIR directory"; exit 1; } +bazel --version || { echo "Unable to run bazel"; exit 1; } + +# ToDo: Make it generic +GTGEN_URL="https://gitlab.eclipse.org/eclipse/openpass/gt-gen-simulator/-/archive/v11.1.0/gt-gen-simulator-v11.1.0.tar.gz" +GTGEN_VERSION="v11.1.0" +GTGEN_CLI_PATH="$GTGEN_DIR/gt-gen-simulator-v11.1.0/bazel-out/k8-opt/bin/Cli" +CACHEDIR=$GTGEN_DIR + +# This override the cache folder of bazel +export TEST_TMPDIR="${CACHEDIR}" +export BAZELISK_HOME="${CACHEDIR}" + +#download gtgen +download_gtgen() { + echo "============================== Downloading gt-gen-simulator ==============================" + wget $GTGEN_URL || { echo "Unable to download gt-gen-simulator"; exit 1; } + tar -xzvf gt-gen-simulator-v11.1.0.tar.gz || { echo "Unable to checkout $GTGEN_VERSION"; exit 1; } + echo "============================== Cloning Successful ==============================" +} + +#build gtgen +build_gtgen() { + echo "============================== Building gt-gen-simulator ==============================" + cd "$GTGEN_DIR"/gt-gen-simulator-v11.1.0 || { echo "Unable to change directory into gt-gen-simulator"; exit 1; } + bazel build --config=gt_gen_release //Cli/... //Simulator/... || { echo "Unable to build gt-gen-simulator"; exit 1; } + echo "============================== Extraction Successful ==============================" +} + +show_version() { + echo "============================== Version info of gt-gen-simulator ==============================" + cd "$GTGEN_CLI_PATH" || { echo "Unable to change directory into gt-gen-simulator executable"; exit 1; } + ./gtgen_cli --version || { echo "Unable to execute gt-gen-simulator"; exit 1; } +} + +download_and_build_gtgen() { + download_gtgen + build_gtgen + show_version +} + +download_and_build_gtgen \ No newline at end of file