blob: b9d66f942febd02e421a6079e7b3825767f057c4 [file] [log] [blame]
Arthur She0cfe3642025-01-10 21:49:38 -08001#!/bin/bash
2#
3set -ex
4
5last_build=$((${BUILD_NUMBER}-1))
6API_URL="${JOB_URL}/${last_build}/api/json"
7
8TO_BUILD_FILE="${WORKSPACE}/TO_BUILD"
9repos_to_check="trusted-firmware-a tf-a-tests tf-a-ci-scripts"
10last_build=$(curl -s ${API_URL})
11last_build_ts=$(echo ${last_build} | jq '.timestamp')
12last_build_ts=$((${last_build_ts}/1000))
13last_build_result=$(echo ${last_build} | jq -r '.result')
14
15if [ "${FORCE_TO_BUILD}" = "true" -o "${last_build_result}" = "FAILURE" ]; then
16 touch ${TO_BUILD_FILE}
17else
18 for r in ${repos_to_check}
19 do
20 pushd ${SHARE_FOLDER}/${r}
21 last_commit_ts=$(git show --no-patch --format=%ct)
22 # if the last commit was not covered by the last build
23 # the new build will be proceeded
24 if [ ${last_commit_ts} -ge ${last_build_ts} ]; then
25 touch ${TO_BUILD_FILE}
26 break
27 fi
28 popd
29 done
30fi
31