11
11
REPLACE_STRING=" s|BUILKDITE_AGENT_PLACEHOLDER|windows|g"
12
12
fi
13
13
14
- # Download the unreal-engine.version file from the GDK repo so we can run the example project builds on the same versions the GDK was run against
14
+ # Download the unreal-engine.version file from the GDK repo so we can run the example project builds on the same versions the GDK was run against.
15
15
# This is not the pinnacle of engineering, as we rely on GitHub's web interface to download the file, but it seems like GitHub disallows git archive
16
- # which would be our other option for downloading a single file
17
- GDK_BRANCH_LOCAL=" ${GDK_BRANCH:- master} "
16
+ # which would be our other option for downloading a single file.
17
+ # Also resolve the GDK branch to run against. The order of priority is:
18
+ # GDK_BRANCH envvar > same-name branch as the branch we are currently on > UnrealGDKVersion.txt > "master".
19
+ GDK_BRANCH_LOCAL=" ${GDK_BRANCH:- } "
20
+ if [ -z " ${GDK_BRANCH_LOCAL} " ]; then
21
+ GDK_REPO_HEADS=$( git ls-remote --heads " git@github.com:spatialos/UnrealGDK.git" " ${BUILDKITE_BRANCH} " )
22
+ EXAMPLEPROJECT_REPO_HEAD=" refs/heads/${BUILDKITE_BRANCH} "
23
+ if echo " ${GDK_REPO_HEADS} " | grep -qF " ${EXAMPLEPROJECT_REPO_HEAD} " ; then
24
+ GDK_BRANCH_LOCAL=" ${BUILDKITE_BRANCH} "
25
+ else
26
+ GDK_VERSION=$( cat UnrealGDKVersion.txt)
27
+ if [ -z " ${GDK_VERSION} " ]; then
28
+ GDK_BRANCH_LOCAL=" master"
29
+ else
30
+ GDK_BRANCH_LOCAL=" ${GDK_VERSION} "
31
+ fi
32
+ fi
33
+ fi
34
+
18
35
NUMBER_OF_TRIES=0
19
36
while [ $NUMBER_OF_TRIES -lt 5 ]; do
20
37
CURL_TIMEOUT=$(( 10 << NUMBER_OF_TRIES))
@@ -43,6 +60,7 @@ if [ -z "${ENGINE_VERSION}" ]; then
43
60
44
61
export ENGINE_COMMIT_HASH=" ${COMMIT_HASH} "
45
62
export STEP_NUMBER
63
+ export GDK_BRANCH=" ${GDK_BRANCH_LOCAL} "
46
64
sed $REPLACE_STRING " ${BUILDKITE_TEMPLATE_FILE} " | buildkite-agent pipeline upload
47
65
STEP_NUMBER=$(( STEP_NUMBER+ 1 ))
48
66
done
@@ -51,7 +69,8 @@ if [ -z "${ENGINE_VERSION}" ]; then
51
69
STEP_NUMBER=$(( STEP_NUMBER- 1 ))
52
70
buildkite-agent meta-data set " engine-version-count" " ${STEP_NUMBER} "
53
71
else
54
- echo " Generating steps for the specified engine version: $ENGINE_VERSION "
55
- export ENGINE_COMMIT_HASH=${ENGINE_VERSION}
72
+ echo " Generating steps for the specified engine version: ${ENGINE_VERSION} "
73
+ export ENGINE_COMMIT_HASH=" ${ENGINE_VERSION} "
74
+ export GDK_BRANCH=" ${GDK_BRANCH_LOCAL} "
56
75
sed $REPLACE_STRING " ${BUILDKITE_TEMPLATE_FILE} " | buildkite-agent pipeline upload
57
76
fi
0 commit comments