Skip to content

Commit ec6387b

Browse files
committed
conditional triggers on ARC registry push
1 parent c87c78d commit ec6387b

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

misc/datahub-hooks.bash

+18-15
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,21 @@ create_badge() {
1010
}
1111

1212
arc_registry_push() {
13-
:
13+
if [ -z "$arc_registry_endpoint" ] || [ -z "$arc_registry_token" ]; then
14+
echo "ARC Registry endpoint or token not configured. Skipping..."
15+
return
16+
fi
17+
user_email="$(jq -r '.commit.author.email // empty' <<< "$json")"
18+
if [ -z "$user_email" ]; then
19+
echo "Failed to find email of commit for the pipeline... continuing."
20+
fi
21+
ret="$(curl -k -L -X POST \
22+
-H "Content-Type: application/json" \
23+
-H "X-Gitlab-Token: $arc_registry_token" \
24+
-d "$json" \
25+
"$arc_registry_endpoint"
26+
)"
27+
echo "ARC registry push returned: $ret"
1428
}
1529

1630
get_publication_link() {
@@ -124,21 +138,10 @@ if [ "$event_type" = "pipeline" ]; then
124138
exit 1
125139
fi
126140

127-
## BLOCK GAJENDRA
128-
user_email="$(jq -r '.commit.author.email // empty' <<< "$json")"
129-
if [ -z "$user_email" ]; then
130-
echo "Failed to find email of commit for the pipeline... continuing."
131-
fi
132-
if [ "$event_ref" = "$arc_badges_branch_name" ]; then
133-
ret="$(curl -k -L -X POST \
134-
-H "Content-Type: application/json" \
135-
-H "X-Gitlab-Token: $arc_registry_token" \
136-
-d "$json" \
137-
"$arc_registry_endpoint"
138-
)"
139-
echo "GAJ: $ret"
141+
if [ "$event_ref" = "main" ] || [ "$event_ref" = "master" ]; then
142+
echo "Pushing event to the ARC registry...."
143+
arc_registry_push
140144
fi
141-
## END BLOCK GAJENDRA
142145

143146
## BLOCK CHECK CQC BRANCH
144147
ret="$(curl -k -L -o /dev/null -s -w "%{http_code}" \

0 commit comments

Comments
 (0)