-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathazure-pipelines.yml
116 lines (94 loc) · 3.89 KB
/
azure-pipelines.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
# Apigee pipeline
# Installed two free plugins to publish the HTML repo for the Static Code Analysis and Cucumber report
# https://marketplace.visualstudio.com/items?itemName=JakubRumpca.azure-pipelines-html-report and https://marketplace.visualstudio.com/items?itemName=MaciejMaciejewski.azure-pipelines-cucumber
trigger:
- feature/*
- main
- prod
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
- task: DownloadSecureFile@1
name: mySecureFile
displayName: 'Download config.json'
inputs:
secureFile: 'config.json'
# Set variables
- bash: |
echo "##vso[task.setvariable variable=APIGEE_ORG]ssv-apigee-asm-demo"
if [ "$(Build.SourceBranchName)" = "main" ]
then
echo "##vso[task.setvariable variable=APIGEE_PROFILE]test"
echo "##vso[task.setvariable variable=DEPLOYMENT_SUFFIX]"
elif [ "$(Build.SourceBranchName)" = "prod" ]
then
echo "##vso[task.setvariable variable=APIGEE_PROFILE]prod"
echo "##vso[task.setvariable variable=DEPLOYMENT_SUFFIX]"
else
echo "##vso[task.setvariable variable=APIGEE_PROFILE]dev"
echo "##vso[task.setvariable variable=DEPLOYMENT_SUFFIX]azureops"
fi
mvn clean
displayName: 'Clean'
- task: Npm@1
inputs:
command: 'install'
workingDir: '.'
displayName: Install Node dependencies
- bash: |
npm run lint
displayName: 'Static Code Analysis'
- task: PublishHtmlReport@1
condition: always()
displayName: 'Publish Apigeelint Report'
inputs:
reportDir: 'code_test_output/apigeelint-output.html'
tabName: 'Apigeelint Report'
- task: PublishHtmlReport@1
condition: always()
displayName: 'Publish ESLint Report'
inputs:
reportDir: 'code_test_output/eslint-output.html'
tabName: 'ESLint Report'
- bash: |
npm run unit-test
displayName: 'Unit Testing and Code Coverage'
- task: PublishHtmlReport@1
condition: always()
displayName: 'Publish Unit Test and Coverage Report'
inputs:
reportDir: 'code_test_output/coverage-output.html'
tabName: 'Coverage Report'
- bash: |
mvn -ntp process-resources -P$(APIGEE_PROFILE) -Dorg=$(APIGEE_ORG) -Ddeployment.suffix="$(DEPLOYMENT_SUFFIX)" -Dcommit=$(Build.SourceVersion) -Dbranch=$(Build.SourceBranchName) -Duser.name=azureops
displayName: 'Process Resources'
- bash: |
mvn apigee-config:targetservers -P$(APIGEE_PROFILE) -Ddeployment.suffix="$(DEPLOYMENT_SUFFIX)" -Dorg=$(APIGEE_ORG) -Dfile=$(mySecureFile.secureFilePath)
displayName: 'Pre-deployment configuration'
- bash: |
mvn -ntp apigee-enterprise:configure -P$(APIGEE_PROFILE) -Ddeployment.suffix="$(DEPLOYMENT_SUFFIX)" -Dorg=$(APIGEE_ORG) -Dfile=$(mySecureFile.secureFilePath)
displayName: 'Package proxy bundle'
- bash: |
mvn -ntp apigee-enterprise:deploy -P$(APIGEE_PROFILE) -Ddeployment.suffix="$(DEPLOYMENT_SUFFIX)" -Dorg=$(APIGEE_ORG) -Dfile=$(mySecureFile.secureFilePath)
displayName: 'Deploy proxy bundle'
- bash: |
mvn -ntp apigee-config:apiproducts apigee-config:developers apigee-config:apps -P$(APIGEE_PROFILE) -Ddeployment.suffix="$(DEPLOYMENT_SUFFIX)" -Dorg=$(APIGEE_ORG) -Dfile=$(mySecureFile.secureFilePath)
displayName: 'Post-deployment configuration'
- bash: |
npm run integration-test
displayName: 'Functional Test'
- task: PublishCucumberReport@1
displayName: 'Publish Integration Test Results'
inputs:
jsonDir: ./target/func_test_output
outputPath: ./target/func_test_output
name: 'Functional Test Report'
title: API
# the devportal username and password are stored as Pipeline variables as APIGEE_DEVPORTAL_USERNAME and APIGEE_DEVPORTAL_PASSWORD
- bash: |
mvn -ntp com.apigee.smartdocs.config:apigee-smartdocs-maven-plugin:apidoc@smartdocs-deploy -Pprod -Dorg=$(APIGEE_ORG) -Dpurl=$(APIGEE_DEVPORTAL_URL) -Dpusername=$(APIGEE_DEVPORTAL_USERNAME) -Dppassword=$(APIGEE_DEVPORTAL_PASSWORD)
displayName: 'Publish Open API Spec'
condition: eq(variables['Build.SourceBranchName'], 'prod')