Skip to content

Commit 16dd9b0

Browse files
authored
add ADO pipeline(#63)
1 parent 7b918bc commit 16dd9b0

File tree

4 files changed

+173
-0
lines changed

4 files changed

+173
-0
lines changed

PostmanCollectionJobTemplate.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# JOB LEVEL TEMPLATE:
2+
# Used to build PostmanCollection
3+
# Reusable
4+
# Meant to be run from the single PostmanCollectionTemplate pipeline (default), or
5+
# from a multi-pipeline such as publishing (should specify alternate params)
6+
7+
parameters:
8+
- name: ApiSpecSource
9+
displayName: ApiSpecSource
10+
type: string
11+
default: -apiSpecGitUrl https://github.com/PlayFab/API_Specs/master/
12+
- name: CommitMessage
13+
displayName: CommitMessage
14+
type: string
15+
default: Automated build from ADO Pipeline
16+
- name: GitDestBranch
17+
displayName: GitDestBranch
18+
type: string
19+
default: doNotCommit
20+
- name: GitJSetupBranch
21+
displayName: GitJSetupBranch
22+
type: string
23+
default: master
24+
- name: GitSdkGenBranch
25+
displayName: GitSdkGenBranch
26+
type: string
27+
default: master
28+
- name: isVersioned
29+
displayName: isVersioned
30+
type: boolean
31+
default: false
32+
- name: SelfTemplateResource
33+
displayName: SelfTemplateResource
34+
type: string
35+
default: self
36+
37+
jobs:
38+
- job: PostmanCollectionJobTemplate
39+
steps:
40+
- bash: echo PostmanCollectionJobTemplate
41+
- job: PostmanCollectionTemplate
42+
pool:
43+
vmImage: 'windows-latest'
44+
steps:
45+
- template: PostmanCollectionStepTemplate.yml
46+
parameters:
47+
ApiSpecSource: ${{ parameters.ApiSpecSource }}
48+
CommitMessage: ${{ parameters.CommitMessage }}
49+
GitDestBranch: ${{ parameters.GitDestBranch }}
50+
GitJSetupBranch: ${{ parameters.GitJSetupBranch }}
51+
GitSdkGenBranch: ${{ parameters.GitSdkGenBranch }}
52+
isVersioned: ${{ parameters.isVersioned }}
53+
SelfTemplateResource: ${{ parameters.SelfTemplateResource }}

PostmanCollectionResourceTemplate.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# TOP LEVEL TEMPLATE:
2+
# Can only be used to run the single PostmanCollectionTemplate pipeline.
3+
# Why: Resources can only be defined once.
4+
# This determines the resources available to all "jobs" and "steps" no matter which templates are loaded after this
5+
# If resources is ever defined again, it'll break so badly that the pipeline won't even parse
6+
7+
resources:
8+
repositories:
9+
- repository: JenkinsSdkSetupScripts
10+
type: github
11+
endpoint: GitHub_PlayFab
12+
name: PlayFab/JenkinsSdkSetupScripts
13+
- repository: API_Specs
14+
type: github
15+
endpoint: GitHub_PlayFab
16+
name: PlayFab/API_Specs
17+
- repository: SdkGenerator
18+
type: github
19+
endpoint: GitHub_PlayFab
20+
name: PlayFab/SdkGenerator
21+
- repository: PostmanCollection
22+
endpoint: GitHub_PlayFab
23+
type: github
24+
name: PlayFab/PostmanCollection
25+
26+
jobs:
27+
- job: PostmanCollectionResourceTemplate
28+
steps:
29+
- bash: echo PostmanCollectionResourceTemplate
30+
- template: PostmanCollectionJobTemplate.yml

PostmanCollectionStepTemplate.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# STEPS LEVEL TEMPLATE:
2+
# Used to build PostmanCollection
3+
# Reusable
4+
# Used to "hide" the additional variables specific to this SDK which shouldn't be set from a higher level, or
5+
# shared from a multi-build pipeline like a publish
6+
7+
parameters:
8+
- name: ApiSpecSource
9+
displayName: ApiSpecSource
10+
type: string
11+
default: -apiSpecGitUrl https://github.com/PlayFab/API_Specs/master/
12+
- name: CommitMessage
13+
displayName: CommitMessage
14+
type: string
15+
default: Automated build from ADO Pipeline
16+
- name: GitDestBranch
17+
displayName: GitDestBranch
18+
type: string
19+
default: doNotCommit
20+
- name: SdkName
21+
displayName: SdkName
22+
type: string
23+
default: PostmanCollection
24+
- name: GitJSetupBranch
25+
displayName: GitJSetupBranch
26+
type: string
27+
default: master
28+
- name: GitSdkGenBranch
29+
displayName: GitSdkGenBranch
30+
type: string
31+
default: master
32+
- name: isVersioned
33+
displayName: isVersioned
34+
type: boolean
35+
default: false
36+
- name: SelfTemplateResource
37+
displayName: SelfTemplateResource
38+
type: string
39+
default: self
40+
41+
steps:
42+
- checkout: JenkinsSdkSetupScripts
43+
clean: true
44+
path: s
45+
- checkout: API_Specs
46+
clean: true
47+
path: s/API_Specs
48+
- checkout: SdkGenerator
49+
clean: true
50+
path: s/SdkGenerator
51+
- checkout: ${{ parameters.SelfTemplateResource }}
52+
clean: true
53+
submodules: true
54+
path: s/sdks/PostmanCollection
55+
persistCredentials: true
56+
- bash: |
57+
set -e
58+
59+
echo alias the ADO variables into local variables
60+
ApiSpecSource="${{ parameters.ApiSpecSource }}"
61+
CommitMessage="${{ parameters.CommitMessage }}"
62+
GitDestBranch="${{ parameters.GitDestBranch }}"
63+
SdkName="${{ parameters.SdkName }}"
64+
WORKSPACE=$(pwd -W)
65+
# Hack attempt to get WORKSPACE into a sub-environment
66+
export WORKSPACE="$WORKSPACE"
67+
68+
echo === load util.sh to find msbuild ===
69+
. "$WORKSPACE/JenkinsSdkSetupScripts/JenkinsScripts/Pipeline/util.sh"
70+
71+
. "$WORKSPACE/JenkinsSdkSetupScripts/JenkinsScripts/Pipeline/testInit.sh"
72+
73+
cd "$WORKSPACE/SDKGenerator/SDKBuildScripts"
74+
export PF_TEST_TITLE_DATA_JSON="$WORKSPACE\JenkinsSdkSetupScripts\Creds\testTitleData.json"
75+
. ./shared_build.sh
76+
echo todo: at least parse and ensure the json file is valid?
77+
displayName: 'Build/Test/Report'
78+
- task: PublishTestResults@2
79+
inputs:
80+
testResultsFormat: 'JUnit'
81+
testResultsFiles: '*.xml'
82+
testRunTitle: PostmanCollectionTemplate

azure-pipelines.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pool:
2+
vmImage: 'ubuntu-latest'
3+
4+
trigger:
5+
- master
6+
7+
extends:
8+
template: PostmanCollectionResourceTemplate.yml

0 commit comments

Comments
 (0)