Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitlab/build/force_build_core_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ build-core:
GIT_STRATEGY: clone
DOCKER_FILE_PATH: "core/docker/Dockerfile"
DATAFED_HARBOR_REGISTRY: "$REGISTRY" # needed by c_harbor_artifact_count
BUILD_INTERMEDIATE: "FALSE"
BUILD_INTERMEDIATE: "TRUE"
INTERMEDIATE_TARGET: "core-build" # Name of the layer in the dockerfile
INTERMEDIATE_LAYER_NAME: "build"
tags:
- ci-datafed-core
- docker
4 changes: 3 additions & 1 deletion .gitlab/build/retag_core_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ retag-image:
COMPONENT: "core"
GIT_STRATEGY: clone
DATAFED_HARBOR_REGISTRY: "$REGISTRY" # needed by c_harbor_artifact_count
BUILD_INTERMEDIATE: "FALSE"
BUILD_INTERMEDIATE: "TRUE"
INTERMEDIATE_TARGET: "core-build" # Name of the layer in the dockerfile
INTERMEDIATE_LAYER_NAME: "build"
tags:
- docker
28 changes: 28 additions & 0 deletions .gitlab/stage_unit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
include:
- local: .gitlab/stage_build.yml
- local: .gitlab/common.yml

run-ws-unit-job:
# Either the web container needs to be rebuilt or the container needs to be
Expand Down Expand Up @@ -126,3 +127,30 @@ run-authz-unit-job:
- echo "-c 'cd /datafed/source; /opt/datafed/dependencies/bin/cmake --build build --target test'" >> run_globus.sh
- chmod +x run_globus.sh
- ./run_globus.sh

run-core-unit-job:
needs: ["run-core-build-job"]
stage: unit
variables:
PROJECT: "datafed"
COMPONENT: "core"
GIT_STRATEGY: clone
INTERMEDIATE_LAYER_NAME: "build"
tags:
- ci-datafed-core
- docker
script:
- BRANCH_LOWER=$(echo "$CI_COMMIT_REF_NAME" | tr '[:upper:]' '[:lower:]')
- echo "${HARBOR_DATAFED_GITLAB_CI_REGISTRY_TOKEN}" | docker login "${REGISTRY}" -u "${HARBOR_USER}" --password-stdin
- ./scripts/container_stop.sh -n "core-unit-" -p
- random_string=$(bash -c "cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1")
- |
docker run --rm \
--name "core-unit-${BRANCH_LOWER}-${CI_COMMIT_SHORT_SHA}-${random_string}" \
--entrypoint bash \
-t "${REGISTRY}/${PROJECT}/${COMPONENT}-${INTERMEDIATE_LAYER_NAME}-${BRANCH_LOWER}:${CI_COMMIT_SHA}" \
-c 'cd /datafed/source && \
/opt/datafed/dependencies/bin/ctest \
--test-dir build \
-LE "integration|fixture" \
--output-on-failure'
11 changes: 10 additions & 1 deletion core/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ COPY ./cmake ${BUILD_DIR}/cmake
COPY ./core/docker/entrypoint.sh ${BUILD_DIR}/core/docker/
COPY ./core/server ${BUILD_DIR}/core/server

# ---------------------------------------------------------------------------
# CHANGED: Enable unit and integration tests so the intermediate image
# contains all test binaries. The production 'core' stage below still only
# copies the server binary, so tests never land in the production image.
# ---------------------------------------------------------------------------
RUN ${DATAFED_DEPENDENCIES_ROOT}/scripts/generate_dependencies_config.sh && \
${BUILD_DIR}/scripts/generate_datafed.sh && \
${DATAFED_DEPENDENCIES_INSTALL_PATH}/bin/cmake -S. -B build \
Expand All @@ -53,10 +58,14 @@ RUN ${DATAFED_DEPENDENCIES_ROOT}/scripts/generate_dependencies_config.sh && \
-DBUILD_DOCS=False \
-DBUILD_PYTHON_CLIENT=False \
-DBUILD_FOXX=False \
-DENABLE_INTEGRATION_TESTS=False
-DENABLE_UNIT_TESTS=True \
-DENABLE_INTEGRATION_TESTS=True
RUN ${DATAFED_DEPENDENCIES_INSTALL_PATH}/bin/cmake --build build -j 8
RUN ${DATAFED_DEPENDENCIES_INSTALL_PATH}/bin/cmake --build build --target install

# ===========================================================================
# Production image — unchanged. Only the server binary is copied in.
# ===========================================================================
FROM ${RUNTIME} AS core

SHELL ["/bin/bash", "-c"]
Expand Down
2 changes: 1 addition & 1 deletion tests/mock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ foreach(PROG
file(GLOB ${PROG}_SOURCES ${PROG}*.cpp)
add_executable(mock_liveness_${PROG} ${${PROG}_SOURCES})

target_link_libraries(mock_liveness_${PROG} PUBLIC ${DATAFED_BOOST_LIBRARIES} ${DATAFED_GSSAPI_LIBRARIES} ${DATAFED_GLOBUS_COMMON_LIBRARIES} common )
target_link_libraries(mock_liveness_${PROG} PUBLIC ${DATAFED_BOOST_LIBRARIES} common )
if(BUILD_SHARED_LIBS)
target_compile_definitions(mock_liveness_${PROG} PRIVATE BOOST_TEST_DYN_LINK)
endif()
Expand Down
Loading