Commit c1999211 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Ben Gamari

Restore missing find-job.sh script

This was incorrectly dropped with the old CI infrastructure.
parent bea74e3f
Pipeline #12978 failed with stages
in 169 minutes and 28 seconds
......@@ -72,6 +72,9 @@ let
--set USE_NIX 1 \
--set CI_CONFIG ${./config.sh}
makeWrapper ${./find-job.sh} $out/bin/find-job \
--prefix PATH : ${stdenv.lib.makeBinPath deps}:$out/bin
makeWrapper ${xz}/bin/xz $out/bin/xz
'';
in
......
#!/usr/bin/env bash
set -e
project_id=$1
pipeline_id=$2
job_name=$3
# Access token is a protected environment variable in the head.hackage project and
# is necessary for this query to succeed. Sadly job tokens only seem to
# give us access to the project being built.
curl \
--silent --show-error \
-H "Private-Token: $ACCESS_TOKEN" \
"https://gitlab.haskell.org/api/v4/projects/$project_id/pipelines/$pipeline_id/jobs?scope[]=success" \
> resp.json
job_id=$(jq ". | map(select(.name == \"$job_name\")) | .[0].id" < resp.json)
if [ "$job_id" = "null" ]; then
echo "Error finding job $job_name for $pipeline_id in project $project_id:" >&2
cat resp.json >&2
rm resp.json
exit 1
else
rm resp.json
echo -n "$job_id"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment