Retrieve git commit SHA before script (#4254)

This commit is contained in:
Matthias Krack 2025-06-19 07:53:44 +02:00 committed by GitHub
parent 0bcb433f02
commit 3ec2d5fa32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 26 additions and 13 deletions

View file

@ -87,7 +87,9 @@ regression test cp2k eiger:
needs: ["build cp2k eiger","test cp2k eiger"]
timeout: 1h
script:
- podman run --mount type=bind,src=${SCRATCH},target=${SCRATCH} --workdir=${SCRATCH} ${DOCKERHUB_IMAGE_NAME} /opt/cp2k/tests/do_regtest.py --maxtasks 128 /opt/cp2k/bin ${VERSION}
- git --no-pager log -1 --pretty="%nCommitSHA:%x20%H%nCommitTime:%x20%ci%nCommitAuthor:%x20%an%nCommitSubject:%x20%s%n" | tee ${REPOSITORY}_${TAG}.log
- podman run --mount type=bind,src=${SCRATCH},target=${SCRATCH} --workdir=${SCRATCH} ${DOCKERHUB_IMAGE_NAME} /opt/cp2k/tests/do_regtest.py --maxtasks 128 /opt/cp2k/bin ${VERSION} 2>&1 | tee -a ${REPOSITORY}_${TAG}.log
- rsync -v --chmod=644 --perms ${REPOSITORY}_${TAG}.log ${CP2KORG} || cp ${REPOSITORY}_${TAG}.log ${SCRATCH}/ci/${REPOSITORY}_${TAG}_$(git rev-parse HEAD).log
variables:
SLURM_CONSTRAINT: mc
SLURM_DEBUG: 1

View file

@ -52,13 +52,11 @@ build cp2k eiger:
variables:
DOCKER_BUILD_ARGS: '[
"BASE_IMAGE",
"DEPS_IMAGE",
"GIT_COMMIT_SHA"
"DEPS_IMAGE"
]'
DOCKERFILE: ci/docker/build_${CI_JOB_STAGE}_${BUILDER}.Dockerfile
BASE_IMAGE: ${UBUNTU_IMAGE_NAME}
DEPS_IMAGE: ${DEPS_IMAGE_NAME}
GIT_COMMIT_SHA: `git rev-parse HEAD`
PERSIST_IMAGE_NAME: ${CSCS_IMAGE_NAME}
test cp2k eiger:
@ -85,9 +83,9 @@ regression test cp2k eiger:
needs: ["build cp2k eiger","test cp2k eiger"]
timeout: 1h
script:
- podman run --mount type=bind,src=${SCRATCH},target=${SCRATCH} --workdir=${SCRATCH} ${DOCKERHUB_IMAGE_NAME} cat /GIT_COMMIT_SHA >${REPOSITORY}_${TAG}.log
- git --no-pager log -1 --pretty="%nCommitSHA:%x20%H%nCommitTime:%x20%ci%nCommitAuthor:%x20%an%nCommitSubject:%x20%s%n" | tee ${REPOSITORY}_${TAG}.log
- podman run --mount type=bind,src=${SCRATCH},target=${SCRATCH} --workdir=${SCRATCH} ${DOCKERHUB_IMAGE_NAME} /opt/cp2k/tests/do_regtest.py --maxtasks 128 /opt/cp2k/bin ${VERSION} 2>&1 | tee -a ${REPOSITORY}_${TAG}.log
- rsync --chmod=644 --perms ${REPOSITORY}_${TAG}.log ${CP2KORG}/cscs/
- rsync -v --chmod=644 --perms ${REPOSITORY}_${TAG}.log ${CP2KORG} || cp ${REPOSITORY}_${TAG}.log ${SCRATCH}/ci/${REPOSITORY}_${TAG}_$(git rev-parse HEAD).log
variables:
SLURM_CONSTRAINT: mc
SLURM_DEBUG: 1

View file

@ -87,7 +87,9 @@ regression test cp2k eiger:
needs: ["build cp2k eiger","test cp2k eiger"]
timeout: 1h
script:
- podman run --mount type=bind,src=${SCRATCH},target=${SCRATCH} --workdir=${SCRATCH} ${DOCKERHUB_IMAGE_NAME} /opt/cp2k/tests/do_regtest.py --maxtasks 128 /opt/cp2k/bin ${VERSION}
- git --no-pager log -1 --pretty="%nCommitSHA:%x20%H%nCommitTime:%x20%ci%nCommitAuthor:%x20%an%nCommitSubject:%x20%s%n" | tee ${REPOSITORY}_${TAG}.log
- podman run --mount type=bind,src=${SCRATCH},target=${SCRATCH} --workdir=${SCRATCH} ${DOCKERHUB_IMAGE_NAME} /opt/cp2k/tests/do_regtest.py --maxtasks 128 /opt/cp2k/bin ${VERSION} 2>&1 | tee -a ${REPOSITORY}_${TAG}.log
- rsync -v --chmod=644 --perms ${REPOSITORY}_${TAG}.log ${CP2KORG} || cp ${REPOSITORY}_${TAG}.log ${SCRATCH}/ci/${REPOSITORY}_${TAG}_$(git rev-parse HEAD).log
variables:
SLURM_CONSTRAINT: mc
SLURM_DEBUG: 1

View file

@ -1,7 +1,7 @@
# Dockerfile for CP2K continuous integration (CI) runs
#
# A stand-alone build in this folder can be performed with:
# podman build --build-arg DEPS_IMAGE=<image id> --build-arg GIT_COMMIT_SHA="$(git rev-parse HEAD)" --shm-size=1g -f build_cp2k_spack.Dockerfile ../../
# podman build --build-arg DEPS_IMAGE=<image id> --shm-size=1g -f build_cp2k_spack.Dockerfile ../../
#
# Author: Matthias Krack
#
@ -14,9 +14,6 @@ FROM ${DEPS_IMAGE} AS build_cp2k
# Store build arguments from base image needed in next stage
RUN echo "${CP2K_VERSION}" >/CP2K_VERSION
ARG GIT_COMMIT_SHA
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA:-"Unknown"}
RUN echo "${GIT_COMMIT_SHA}" >/GIT_COMMIT_SHA
# Build CP2K with CMake
WORKDIR /opt/cp2k
@ -66,7 +63,7 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
python3 && rm -rf /var/lib/apt/lists/*
# Import build arguments from base image
COPY --from=build_cp2k /CP2K_VERSION /GIT_COMMIT_SHA /
COPY --from=build_cp2k /CP2K_VERSION /
# Install CP2K dependencies built with Spack
WORKDIR /opt

View file

@ -5,6 +5,20 @@ host: Alps Eiger (CSCS)
report_url: https://www.cp2k.org/static/regtest/trunk/cscs/cp2k_eiger_spack_ssmp.log
info_url: https://gitlab.com/cscs-ci/ci-testing/webhook-ci/mirrors/3546923033037693/3295760759903023/-/pipelines
[cscs_eiger_spack_psmp]
sortkey: 211
name: Spack (psmp)
host: Alps Eiger (CSCS)
report_url: https://www.cp2k.org/static/regtest/trunk/cscs/cp2k_eiger_spack_psmp.log
info_url: https://gitlab.com/cscs-ci/ci-testing/webhook-ci/mirrors/3546923033037693/3295760759903023/-/pipelines
[cscs_eiger_toolchain_psmp]
sortkey: 221
name: Toolchain (psmp)
host: Alps Eiger (CSCS)
report_url: https://www.cp2k.org/static/regtest/trunk/cscs/cp2k_eiger_toolchain_psmp.log
info_url: https://gitlab.com/cscs-ci/ci-testing/webhook-ci/mirrors/3546923033037693/3295760759903023/-/pipelines
# ==============================================================================
[precommit]

View file

@ -7,7 +7,7 @@ if [[ -n "${SPACK_CACHE}" ]]; then
if ! wget -q --tries=1 "http://localhost:9000/spack-cache"; then
echo ""
echo "ERROR: Could not connect to local Spack cache."
echo " Start the cache by running ./start_spack_cache.sh and then pass --network=host to podman."
echo " Start the cache by running ./spack_cache_start.sh and then pass --network=host to podman."
echo " Alternatively, disable the cache by passing --build-arg SPACK_CACHE=\"\" to podman."
echo " See also: https://manual.cp2k.org/trunk/getting-started/build-with-spack.html"
echo ""