@@ -14,18 +14,39 @@ mkdir -p $BASEDIR/output/tarballs
14
14
# the first part of the script is not really critical
15
15
set +e
16
16
17
- # Get information about PRs among the used revisions.
18
- # These PRs will have to be notified of build progress.
17
+ # Get information about PRs among the used revisions. These PRs will have to be
18
+ # notified of build progress.
19
+ #
20
+ # Variables such as MISSION_PORTAL_REV may be set by the CI (Jenkins) to build
21
+ # and test multiple PR's together. The variables typically hold a branch name
22
+ # or a pull request ID. PR IDs are preceded by 'pull' or 'origin/pull'. E.g.:
23
+ # - MISSION_PORTAL_REV=pull/1755
24
+ # - MISSION_PORTAL_REV=origin/pull/1755
25
+ # where the trailing number is the pull request ID.
26
+ #
27
+ # This loop fetches information about the PRs if the respective variable is set.
28
+ #
19
29
for repo_spec in cfengine/buildscripts cfengine/core cfengine/masterfiles cfengine/enterprise cfengine/nova cfengine/mission-portal NorthernTechHQ/libntech; do
20
30
# remove organization/ from start of repo_spec
31
+ # E.g. 'cfengine/mission-portal' -> 'mission-portal'
21
32
repo=" ${repo_spec#*/ } "
33
+
34
+ # Convert to uppercase, swap hyphens with underscore and append '_REV'
35
+ # E.g. 'mission-portal' -> 'MISSION_PORTAL_REV'
22
36
rev_param_name=" $( echo $repo | tr ' [:lower:]-' ' [:upper:]_' ) _REV"
37
+
38
+ # Try to dereference the result from above and skip the rest of the loop
39
+ # unless the variable is defined.
23
40
revision=" $( echo ${! rev_param_name} ) " || continue # dereference
24
41
25
42
# remove "origin/" (if any)
26
43
revision=" ${revision## origin/ } "
44
+
45
+ # Check to see if the resolved variable starts with 'pull/'
27
46
if expr " $revision " : " pull/" > /dev/null; then
47
+ # Extract the revision number. E.g. 'pull/1755' -> '1755'
28
48
pr_nr=" $( echo $revision | cut -d/ -f2) "
49
+
29
50
get-github-pull-request-info " $repo_spec " " $pr_nr " >> $BASEDIR /output/PRs
30
51
fi
31
52
done
@@ -103,4 +124,3 @@ if test -f "$BASEDIR/mission-portal/ldap/composer.json"; then
103
124
php /usr/bin/composer.phar install --no-dev
104
125
fi
105
126
)
106
-
0 commit comments