-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathJavaStepTemplate.yml
133 lines (118 loc) · 3.77 KB
/
JavaStepTemplate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# STEPS LEVEL TEMPLATE:
# Used to build Java
# Reusable
# Used to "hide" the additional variables specific to this SDK which shouldn't be set from a higher level, or
# shared from a multi-build pipeline like a publish
parameters:
- name: ApiSpecSource
displayName: ApiSpecSource
type: string
default: -apiSpecGitUrl https://raw.githubusercontent.com/PlayFab/API_Specs/master/
- name: CommitMessage
displayName: CommitMessage
type: string
default: Automated build from ADO Pipeline
- name: GitDestBranch
displayName: GitDestBranch
type: string
default: doNotCommit
- name: SdkName
displayName: SdkName
type: string
default: JavaSDK
- name: GitJSetupBranch
displayName: GitJSetupBranch
type: string
default: master
- name: GitSdkGenBranch
displayName: GitSdkGenBranch
type: string
default: master
- name: isVersioned
displayName: isVersioned
type: boolean
default: false
- name: TestServer
displayName: TestServer
default: false
- name: SelfTemplateResource
displayName: SelfTemplateResource
type: string
default: self
steps:
- checkout: JenkinsSdkSetupScripts
clean: true
path: s
- checkout: API_Specs
clean: true
path: s/API_Specs
- checkout: SdkGenerator
clean: true
path: s/SdkGenerator
- checkout: ${{ parameters.SelfTemplateResource }}
clean: true
submodules: true
path: s/sdks/JavaSDK
persistCredentials: true
- bash: |
set -e
echo alias the ADO variables into local variables
ApiSpecSource="${{ parameters.ApiSpecSource }}"
CommitMessage="${{ parameters.CommitMessage }}"
GitDestBranch="${{ parameters.GitDestBranch }}"
SdkName="${{ parameters.SdkName }}"
TestServer="${{ parameters.TestServer }}"
WORKSPACE=$(pwd -W)
# Hack attempt to get WORKSPACE into a sub-environment
export WORKSPACE="$WORKSPACE"
cd "$WORKSPACE/sdks/$SdkName"
. "$WORKSPACE/JenkinsSdkSetupScripts/JenkinsScripts/Pipeline/testInit.sh"
echo === Delete previous builds ===
if [-d "$WORKSPACE/sdks/$SdkName/builds" ]; then
cd "$WORKSPACE/sdks/$SdkName/builds"
rm *.jar /F /Q || true
fi
cd "$WORKSPACE/SDKGenerator/SDKBuildScripts"
. ./shared_build.sh
echo === Build the Java Project ===
cd "$WORKSPACE/sdks/"$SdkName"/PlayFabSDK"
export PF_TEST_TITLE_DATA_JSON="$WORKSPACE\JenkinsSdkSetupScripts\Creds\testTitleData.json"
./packageMe.sh
cd "$WORKSPACE/sdks/$SdkName/PlayFabClientSDK"
./packageMe.sh
if [ "$TestServer" = "true" ]; then
echo === testing server ===
cd "$WORKSPACE/sdks/$SdkName/PlayFabServerSDK"
./deploy.sh
fi
if [ "$isVersioned" = "true" ]; then
echo === publish to maven ===
cd "$WORKSPACE/sdks/$SdkName/"
# =========== MANUAL BUILD NOTES ==========
# This step ALWAYS ALWAYS ALWAYS requires a human on RDP
# gpg-agent
# Two options:
# gpg-agent[<Process ID>]: gpg-agent running and available
# gpg-agent[<Process ID>]: no gpg-agent running in this session
# If it's already been started under the Jenkins service, it'll hang forever for no reason
# Run this:
# gpgconf --kill gpg-agent
# Then, restart it manually via RDP
# gpg -K
# If you run it with a cmd prompt, from a keyboard, it will allow the password prompt to appear, when you run these commands:
pushd "PlayFabClientSDK"
mvn clean deploy -e -X -P release && mvn nexus-staging:release
popd
pushd "PlayFabSDK"
mvn clean deploy -e -X -P release && mvn nexus-staging:release
popd
pushd "PlayFabServerSDK"
mvn clean deploy -e -X -P release && mvn nexus-staging:release
popd
fi
displayName: 'Build/Test/Report'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '*.xml'
testRunTitle: JavaTemplate