Skip to content

Commit fa71f67

Browse files
committed
more minor optimizations
1 parent c6143e9 commit fa71f67

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

misc/Auto-DevOps.gitlab-ci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Create ARC JSON:
3131
quality_report_generator:
3232
stage: quality_report_generator
3333
rules:
34-
- if: $CI_COMMIT_REF_NAME != "cqc"
3534
- exists:
3635
- .arc/validation_packages.yml
3736
script:
@@ -64,8 +63,6 @@ quality_report_generator:
6463
- ret=$?
6564
- mkdir -p "${CI_COMMIT_BRANCH}"
6665
- mv ".arc-validate-results/${p}" "${CI_COMMIT_BRANCH}/${p}${v:+@$v}"
67-
- ls -la "$CI_COMMIT_BRANCH"/* || true
68-
- ls -la "$CI_COMMIT_BRANCH"/*/* || true
6966
- exit $ret
7067
artifacts:
7168
when: always

misc/datahub-hooks.bash

+15-15
Original file line numberDiff line numberDiff line change
@@ -74,37 +74,37 @@ if [ ! -e "$datahub_secrets" ]; then
7474
exit 1
7575
fi
7676

77-
. "$datahub_secrets"
78-
79-
# setup logging
80-
declare -rg log_file="/var/log/datahub/${0##*/}.$$.log"
81-
if [ "$HOOK_DEBUG" = "1" ]; then
82-
exec &> "$log_file"
83-
set -x
84-
fi
85-
8677
# Get the event from stdin
8778
json="$(cat -)"
88-
echo "EVENT: $(jq . <<< "$json")"
8979

9080
event_type="$(jq -r '.object_kind // empty' <<< "$json")"
9181
event_name="$(jq -r '.event_name // empty' <<< "$json")"
9282
event_ref="$(jq -r '.object_attributes.ref // empty' <<< "$json")"
9383
event_id="$(jq -r '.object_attributes.id // empty' <<< "$json")"
9484

95-
if { [ -n "$event_type" ] && [ "$event_type" != "pipeline" ] && [ "$event_type" != "push" ]; } \
96-
|| { [ -n "$event_name" ] && [ "$event_name" != "project_create" ] ; } \
97-
|| { [ -n "$event_name" ] && [ "$event_name" != "push" ] ; }; then
85+
if { [ -n "$event_type" ] && [ "$event_type" != "pipeline" ]; } \
86+
|| { [ -n "$event_name" ] && [ "$event_name" != "project_create" ] && [ "$event_name" != "push" ]; }; then
9887
echo "Ignoring $event_type | $event_name"
9988
exit 0
10089
fi
10190

102-
# for event_types the project id is in .project.id
91+
## Read the configuration file
92+
. "$datahub_secrets"
93+
94+
# setup logging
95+
declare -rg log_file="/var/log/datahub/${0##*/}.$$.log"
96+
if [ "$HOOK_DEBUG" = "1" ]; then
97+
exec &> "$log_file"
98+
set -x
99+
fi
100+
103101
project_id="$(jq -r '.project.id // empty' <<< "$json")"
104-
# for event_name the project id is in .project_id
102+
# for the event "project_create" the project id is in .project_id
105103
[ -z "$project_id" ] && project_id="$(jq -r '.project_id // empty' <<< "$json")"
106104

107105
project_name="$(jq -r '.project.path_with_namespace // empty' <<< "$json")"
106+
# for the event "project_create" the project name is in: .path_with_namespace
107+
[ -z "$project_name" ] && project_name="$(jq -r '.path_with_namespace // empty' <<< "$json")"
108108

109109
if [ -z "$project_id" ]; then
110110
echo "Could not get the project id."

0 commit comments

Comments
 (0)