CI: Generate a tmp commit for Ascent build

- Print out the ECP Pipeline url.
This commit is contained in:
Vicente Adolfo Bolea Sanchez 2022-11-01 18:03:03 -04:00
parent 81f1982afa
commit 6255225863
5 changed files with 60 additions and 7 deletions

@ -46,7 +46,7 @@ build:ascent_gcc_cuda:
- git-lfs install
- git-lfs pull lfs
script:
- CTEST_MAX_PARALLELISM=32 cmake -V -P .gitlab/ci/config/gitlab_ci_setup.cmake
- cmake -V -P .gitlab/ci/config/gitlab_ci_setup.cmake
- ctest -VV -S .gitlab/ci/ctest_configure.cmake
artifacts:
expire_in: 24 hours

@ -0,0 +1,14 @@
#!/bin/bash -e
# shellcheck disable=SC2155
git rev-parse @ > ./ORIGINAL_COMMIT_SHA
git add ./ORIGINAL_COMMIT_SHA
readonly name="$(git show --quiet --format='%cn')"
readonly email="$(git show --quiet --format='%ce')"
git config --global user.name "$name"
git config --global user.email "$email"
git commit --amend --no-edit -a
git rev-parse @ > "$1"

@ -1,28 +1,59 @@
#!/bin/bash -e
# shellcheck disable=SC2155
declare -r POLL_INTERVAL_SECONDS="10"
function fetch_commit_status()
{
local -r url="$1"
local output
local -r commit="$2"
output=$(curl --insecure --silent "$url" | tr ',{}[]' '\n' | grep -Po -m1 '(?<=^"status":")\w+(?=")')
local output=$(curl --insecure --silent "${url}/repository/commits/${commit}" \
| tr ',{}[]' '\n' \
| grep -Po -m1 '(?<=^"status":")\w+(?=")' \
)
# No status means that the pipeline has not being created yet
[ -z "$output" ] && output="empty"
echo "$output"
}
function print_pipeline_url()
{
local -r url="$1"
local -r commit="$2"
local web_url=$(curl --insecure --silent "${url}" \
| tr ',{}[]' '\n' \
| grep -Po -m1 '(?<=^"web_url":").+(?=")' \
)
local pipeline_id=$(curl --insecure --silent "${url}/repository/commits/${commit}" \
| tr ',{}[]' '\n' \
| grep -Po '(?<=^"id":)\d+$' \
)
echo "######################################################################"
echo "ECP Pipeline: ${web_url}/-/pipelines/$pipeline_id"
echo "######################################################################"
}
function wait_commit_pipeline_status()
{
local -r base_url="$1"
local -r commit="$2"
local -r url="${base_url}/repository/commits/${commit}"
local is_url_printed="no"
while true
do
local ret="$(fetch_commit_status "$url")"
local ret="$(fetch_commit_status "$base_url" "$commit")"
if [ "$ret" != "empty" ] && [ "$is_url_printed" == "no" ]
then
print_pipeline_url "$base_url" "$commit"
is_url_printed="yes"
fi
case "$ret" in
success)
return 0 ;;

@ -94,6 +94,12 @@ if(DEFINED ENV{CTEST_MEMORYCHECK_SANITIZER_OPTIONS})
list(APPEND optional_variables "set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS ${env_value})")
endif()
# Override revision (Git Commit) if ORIGINAL_COMMIT_SHA is found in source code
if (EXISTS "ORIGINAL_COMMIT_SHA")
file(READ "ORIGINAL_COMMIT_SHA" commit_sha)
list(APPEND optional_variables "set(CTEST_UPDATE_VERSION_OVERRIDE ${commit_sha})")
endif()
#We need to do write this information out to a file in the build directory
file(TO_CMAKE_PATH "${CTEST_SOURCE_DIRECTORY}" src_path) #converted so we can run on windows
file(TO_CMAKE_PATH "${CTEST_BINARY_DIRECTORY}" bin_path) #converted so we can run on windows

@ -121,10 +121,12 @@ build:ascent:
- .ubuntu2004
- .run_only_merge_requests
script:
# A new commit is needed to symbolize a restart of a build from the same original commit
- .gitlab/ci/config/ecpci-amend-commit.sh "NEW_COMMIT_SHA"
- .gitlab/ci/config/ecpci-push-branch.sh "$ASCENT_GIT_URL" "$BRANCH_NAME"
- timeout 130m .gitlab/ci/config/ecpci-wait-commit-status.sh "$ASCENT_REST_URL" "$CI_COMMIT_SHA"
- timeout 130m .gitlab/ci/config/ecpci-wait-commit-status.sh "$ASCENT_REST_URL" "$(cat NEW_COMMIT_SHA)"
after_script:
- .gitlab/ci/config/ecpci-remove-branch.sh "$ASCENT_GIT_URL" "$BRANCH_NAME" || true
- .gitlab/ci/config/ecpci-fetch-commit-trace.py "$ASCENT_REST_URL" "$CI_COMMIT_SHA" "$ECPTEST_TOKEN"
- .gitlab/ci/config/ecpci-fetch-commit-trace.py "$ASCENT_REST_URL" "$(cat NEW_COMMIT_SHA)" "$ECPTEST_TOKEN"
timeout: 150 minutes
interruptible: true