@qualtrics/plugin-ui-react 1.4.0-alpha.8 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/field-mapper/field-mapper-key/field-mapper-key.d.ts +3 -0
- package/dist/common/field-mapper/field-mapper-row/field-mapper-row.d.ts +1 -2
- package/dist/common/field-mapper/field-mapper-value/field-mapper-value.d.ts +4 -2
- package/dist/common/field-mapper/field-mapper.d.ts +1 -2
- package/dist/common/piped-text-input/piped-text-input.d.ts +1 -1
- package/dist/index.es.js +48 -0
- package/dist/index.js +48 -0
- package/dist/lib/models/field-mapper-item.d.ts +0 -1
- package/dist/lib/models/piped-text.d.ts +3 -3
- package/package.json +32 -32
- package/tsconfig.json +7 -1
- package/.dockerignore +0 -8
- package/Dockerfile +0 -15
- package/Makefile +0 -25
- package/dist/common/capture-event/capture-event.test.d.ts +0 -1
- package/dist/common/copy-text/copy-text.test.d.ts +0 -1
- package/dist/common/dynamic-search-input/dynamic-search-input.d.ts +0 -1
- package/dist/common/dynamic-search-input/dynamic-search-input.test.d.ts +0 -1
- package/dist/common/event-registry.d.ts +0 -9
- package/dist/common/language-service.d.ts +0 -1
- package/dist/common/multiselect-dropdown/multiselect-dropdown.d.ts +0 -1
- package/dist/common/multiselect-dropdown/multiselect-dropdown.test.d.ts +0 -1
- package/dist/common/multiselect-dropdown/select-item/select-item.d.ts +0 -1
- package/dist/common/multiselect-dropdown/select-item/select-item.test.d.ts +0 -1
- package/dist/common/piped-text-input/piped-text-input.test.d.ts +0 -1
- package/dist/common/piped-text-select/piped-text-select.d.ts +0 -1
- package/dist/common/piped-text-select/piped-text-select.test.d.ts +0 -1
- package/dist/common/plugin-sdk-service.d.ts +0 -5
- package/dist/common/popover/popover.d.ts +0 -1
- package/dist/common/portal.d.ts +0 -10
- package/dist/common/task-fields/field-item/field-item.d.ts +0 -1
- package/dist/common/task-fields/field-item/field-item.test.d.ts +0 -1
- package/dist/common/task-fields/field-row/field-row.d.ts +0 -1
- package/dist/common/task-fields/field-row/field-row.test.d.ts +0 -1
- package/dist/common/task-fields/task-fields.d.ts +0 -1
- package/dist/common/task-fields/task-fields.test.d.ts +0 -1
- package/dist/main.es.js +0 -50
- package/dist/main.js +0 -50
- package/dist/plugin-app/example-data.d.ts +0 -102
- package/dist/plugin-app/plugin-app.d.ts +0 -1
- package/jenkins.groovy +0 -290
- package/jenkinsPipelineUtils/jira.groovy +0 -84
- package/jenkinsPipelineUtils/notifications.groovy +0 -34
- package/jenkinsPipelineUtils/pipelineControls.groovy +0 -64
- package/jenkinsPipelineUtils/trs.groovy +0 -30
- package/test_results/junit.xml +0 -101
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
export const singleLevelItems: {
|
|
2
|
-
label: string;
|
|
3
|
-
key: number;
|
|
4
|
-
value: string;
|
|
5
|
-
}[];
|
|
6
|
-
export const multiLevelItems: ({
|
|
7
|
-
label: string;
|
|
8
|
-
key: number;
|
|
9
|
-
value: string;
|
|
10
|
-
submenu?: undefined;
|
|
11
|
-
} | {
|
|
12
|
-
label: string;
|
|
13
|
-
key: number;
|
|
14
|
-
submenu: {
|
|
15
|
-
items: ({
|
|
16
|
-
label: string;
|
|
17
|
-
key: number;
|
|
18
|
-
value: string;
|
|
19
|
-
submenu?: undefined;
|
|
20
|
-
} | {
|
|
21
|
-
label: string;
|
|
22
|
-
key: number;
|
|
23
|
-
submenu: {
|
|
24
|
-
items: {
|
|
25
|
-
label: string;
|
|
26
|
-
key: number;
|
|
27
|
-
value: string;
|
|
28
|
-
}[];
|
|
29
|
-
};
|
|
30
|
-
value?: undefined;
|
|
31
|
-
})[];
|
|
32
|
-
};
|
|
33
|
-
value?: undefined;
|
|
34
|
-
})[];
|
|
35
|
-
export const pipedTextMockData: ({
|
|
36
|
-
label: string;
|
|
37
|
-
disabled: boolean;
|
|
38
|
-
selected: boolean;
|
|
39
|
-
header: boolean;
|
|
40
|
-
value?: undefined;
|
|
41
|
-
submenu?: undefined;
|
|
42
|
-
action?: undefined;
|
|
43
|
-
} | {
|
|
44
|
-
label: string;
|
|
45
|
-
value: string;
|
|
46
|
-
submenu: {
|
|
47
|
-
searchable: boolean;
|
|
48
|
-
localizedText: {
|
|
49
|
-
emptyText: string;
|
|
50
|
-
searchText: string;
|
|
51
|
-
};
|
|
52
|
-
items: any[];
|
|
53
|
-
};
|
|
54
|
-
disabled?: undefined;
|
|
55
|
-
selected?: undefined;
|
|
56
|
-
header?: undefined;
|
|
57
|
-
action?: undefined;
|
|
58
|
-
} | {
|
|
59
|
-
label: string;
|
|
60
|
-
value: {
|
|
61
|
-
locator: string;
|
|
62
|
-
};
|
|
63
|
-
disabled?: undefined;
|
|
64
|
-
selected?: undefined;
|
|
65
|
-
header?: undefined;
|
|
66
|
-
submenu?: undefined;
|
|
67
|
-
action?: undefined;
|
|
68
|
-
} | {
|
|
69
|
-
label: string;
|
|
70
|
-
submenu: {
|
|
71
|
-
items: {
|
|
72
|
-
label: string;
|
|
73
|
-
value: {
|
|
74
|
-
locator: string;
|
|
75
|
-
};
|
|
76
|
-
}[];
|
|
77
|
-
searchable?: undefined;
|
|
78
|
-
localizedText?: undefined;
|
|
79
|
-
};
|
|
80
|
-
disabled?: undefined;
|
|
81
|
-
selected?: undefined;
|
|
82
|
-
header?: undefined;
|
|
83
|
-
value?: undefined;
|
|
84
|
-
action?: undefined;
|
|
85
|
-
} | {
|
|
86
|
-
label: string;
|
|
87
|
-
value: string;
|
|
88
|
-
action: any;
|
|
89
|
-
disabled?: undefined;
|
|
90
|
-
selected?: undefined;
|
|
91
|
-
header?: undefined;
|
|
92
|
-
submenu?: undefined;
|
|
93
|
-
} | {
|
|
94
|
-
label: string;
|
|
95
|
-
header: boolean;
|
|
96
|
-
disabled?: undefined;
|
|
97
|
-
selected?: undefined;
|
|
98
|
-
value?: undefined;
|
|
99
|
-
submenu?: undefined;
|
|
100
|
-
action?: undefined;
|
|
101
|
-
})[];
|
|
102
|
-
export function kittenIterator(): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function PluginApp(props: any): JSX.Element;
|
package/jenkins.groovy
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
// Job Parameters
|
|
2
|
-
JOB_PARAMETER_RELEASE_STEP_PUBLISH = 'publish'
|
|
3
|
-
JOB_PARAMETER_RELEASE_STEP_PC_TICKETS = 'pc tickets'
|
|
4
|
-
|
|
5
|
-
JOB_PARAMETER_PROJECT_PLUGIN_UI_REACT = 'plugin-ui-react'
|
|
6
|
-
|
|
7
|
-
// Project Contstants
|
|
8
|
-
SLACK_DEPLOY_CHANNEL = '#app-sdk-deploys'
|
|
9
|
-
SLACK_MR_VALIDATION_CHANNEL = '#app-sdk-mr-validation'
|
|
10
|
-
|
|
11
|
-
PROJECTS = [
|
|
12
|
-
[
|
|
13
|
-
name: '@qualtrics/plugin-ui-react',
|
|
14
|
-
directory: '.',
|
|
15
|
-
jobParameterProject: JOB_PARAMETER_PROJECT_PLUGIN_UI_REACT,
|
|
16
|
-
trsId: '1d15e1dc-f156-45a2-966e-89dba1797e68',
|
|
17
|
-
trsServiceTag: 'qualtrics-plugin-ui-react'
|
|
18
|
-
]
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
TRS_TEAM = 'appsdk'
|
|
22
|
-
TRS_GRAFANA_PROJECT_URL = "https://grafana.eng.qops.net/d/2qriuzfMk/trs-unit-tests-by-service?orgId=1&refresh=1h&var-unit_team=${TRS_TEAM}"
|
|
23
|
-
TEST_RESULTS_FILE = 'junit.xml'
|
|
24
|
-
CODE_COVERAGE_FILE = 'cobertura-coverage.xml'
|
|
25
|
-
|
|
26
|
-
JIRA_SERVICE_TEAM_ID = '18254'
|
|
27
|
-
JIRA_LABELS = ['DPEE']
|
|
28
|
-
TEAM_RUNBOOK = 'https://odo.corp.qualtrics.com/wiki/index.php/AppSDK_Team_Runbook'
|
|
29
|
-
TEAM_ROLLBACK = 'https://odo.corp.qualtrics.com/wiki/index.php/AppSDK_Team_Runbook#Task_Rollback'
|
|
30
|
-
|
|
31
|
-
MAKE_PUBLISH = 'make publish'
|
|
32
|
-
MAKE_BUILD = 'make build'
|
|
33
|
-
MAKE_TEST = 'make test'
|
|
34
|
-
MAKE_CLEAN = 'make clean'
|
|
35
|
-
|
|
36
|
-
MAIN_BRANCH = 'master'
|
|
37
|
-
|
|
38
|
-
pipeline {
|
|
39
|
-
agent {
|
|
40
|
-
label 'nomad-builder'
|
|
41
|
-
}
|
|
42
|
-
environment {
|
|
43
|
-
DOCKER_HOST = '127.0.0.1:2375'
|
|
44
|
-
WORKSPACE_PATH = "/var/lib/nomad/alloc/${NOMAD_ALLOC_ID}/${NOMAD_TASK_NAME}${WORKSPACE}"
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
options {
|
|
48
|
-
timestamps()
|
|
49
|
-
buildDiscarder(logRotator(numToKeepStr: '5'))
|
|
50
|
-
timeout(time: 60, unit: 'MINUTES')
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
stages {
|
|
54
|
-
stage('Setup') {
|
|
55
|
-
steps {
|
|
56
|
-
script {
|
|
57
|
-
def rootDir = pwd()
|
|
58
|
-
def jenkinsUtilsFolder = "${rootDir}/jenkinsPipelineUtils"
|
|
59
|
-
trs = load("${jenkinsUtilsFolder}/trs.groovy")
|
|
60
|
-
jira = load("${jenkinsUtilsFolder}/jira.groovy")
|
|
61
|
-
notifications = load("${jenkinsUtilsFolder}/notifications.groovy")
|
|
62
|
-
pipelineControls = load("${jenkinsUtilsFolder}/pipelineControls.groovy")
|
|
63
|
-
|
|
64
|
-
notifications.setCommitStatus('running')
|
|
65
|
-
|
|
66
|
-
PROJECT_NAME_VERSION = ''
|
|
67
|
-
|
|
68
|
-
for (project in PROJECTS) {
|
|
69
|
-
def nameVersion = getProjectNameAndVersion(project.name, project.directory)
|
|
70
|
-
PROJECT_NAME_VERSION += "${nameVersion} "
|
|
71
|
-
TRS_GRAFANA_PROJECT_URL += "&var-unit_service=${project.trsServiceTag}"
|
|
72
|
-
echo "Project: ${nameVersion}"
|
|
73
|
-
}
|
|
74
|
-
echo "Workspace: ${WORKSPACE_PATH}"
|
|
75
|
-
echo "Git action: ${env.gitlabActionType}"
|
|
76
|
-
echo "Git source branch: ${env.gitlabSourceBranch}"
|
|
77
|
-
|
|
78
|
-
currentBuild.displayName = pipelineControls.getJobDisplayName(currentBuild.number, PROJECT_NAME_VERSION, MAIN_BRANCH)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
stage('Build') {
|
|
83
|
-
when {
|
|
84
|
-
expression {
|
|
85
|
-
!isManualPCTicketJob()
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
steps {
|
|
89
|
-
sh script: MAKE_BUILD
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
stage('Unit Test') {
|
|
93
|
-
when {
|
|
94
|
-
expression {
|
|
95
|
-
!isManualPCTicketJob()
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
steps {
|
|
99
|
-
script {
|
|
100
|
-
for (project in PROJECTS) {
|
|
101
|
-
echo "testing ${project.name}"
|
|
102
|
-
sh script: "${MAKE_TEST} DIRECTORY=${project.directory}"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
stage('TRS') {
|
|
108
|
-
when {
|
|
109
|
-
expression {
|
|
110
|
-
pipelineControls.isPushToMain(MAIN_BRANCH)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
steps {
|
|
114
|
-
script {
|
|
115
|
-
for (project in PROJECTS) {
|
|
116
|
-
publishToTRS(project)
|
|
117
|
-
}
|
|
118
|
-
echo "To see the TRS dashboard vist ${TRS_GRAFANA_PROJECT_URL}"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
stage('PC Tickets') {
|
|
123
|
-
when {
|
|
124
|
-
expression {
|
|
125
|
-
isManualPCTicketJob()
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
steps {
|
|
129
|
-
script {
|
|
130
|
-
for (project in PROJECTS) {
|
|
131
|
-
if (project.jobParameterProject == JOB_PARAMETER_PROJECT) {
|
|
132
|
-
createPCReleaseTicket(project)
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
stage('Publish') {
|
|
139
|
-
when {
|
|
140
|
-
expression {
|
|
141
|
-
pipelineControls.isPushToMain(MAIN_BRANCH) || JOB_PARAMETER_RELEASE_STEP == JOB_PARAMETER_RELEASE_STEP_PUBLISH
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
steps {
|
|
145
|
-
script {
|
|
146
|
-
for (project in PROJECTS) {
|
|
147
|
-
if (isDeploymentJob(project.jobParameterProject, project.directory)) {
|
|
148
|
-
publishToNpm(project)
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
post {
|
|
157
|
-
success {
|
|
158
|
-
script {
|
|
159
|
-
if (!isManualPCTicketJob()) {
|
|
160
|
-
def validationChannel = pipelineControls.isMergeRequest(MAIN_BRANCH) ? SLACK_MR_VALIDATION_CHANNEL : SLACK_DEPLOY_CHANNEL
|
|
161
|
-
notifications.sendSlackVerifiedProjectMessage(PROJECT_NAME_VERSION, validationChannel)
|
|
162
|
-
}
|
|
163
|
-
notifications.setCommitStatus('success')
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
failure {
|
|
167
|
-
script {
|
|
168
|
-
def validationChannel = pipelineControls.isMergeRequest(MAIN_BRANCH) ? SLACK_MR_VALIDATION_CHANNEL : SLACK_DEPLOY_CHANNEL
|
|
169
|
-
notifications.sendSlackFailedToVerifyProjectMessage(PROJECT_NAME_VERSION, validationChannel)
|
|
170
|
-
notifications.setCommitStatus('failed')
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
aborted {
|
|
174
|
-
script {
|
|
175
|
-
notifications.setCommitStatus('canceled')
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
always {
|
|
179
|
-
sh script: MAKE_CLEAN
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
def publishToTRS(project) {
|
|
185
|
-
echo "publishing ${project.name} to TRS"
|
|
186
|
-
def resultsDir = "./coverage/${project.directory}/${TEST_RESULTS_FILE}"
|
|
187
|
-
def coverageDir = "./coverage/${project.directory}/${CODE_COVERAGE_FILE}"
|
|
188
|
-
trs.publishResultsToTRS(project.trsId, project.trsServiceTag, resultsDir, coverageDir, WORKSPACE_PATH, TRS_TEAM)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
def createPCReleaseTicket(project) {
|
|
192
|
-
def nameVersion = getProjectNameAndVersion(project.name, project.directory)
|
|
193
|
-
echo "creating PC ticket for ${nameVersion}"
|
|
194
|
-
|
|
195
|
-
def pcTicketUrl = jira.createPCTicket(nameVersion, JIRA_SERVICE_TEAM_ID, TEAM_RUNBOOK, TEAM_ROLLBACK, JIRA_LABELS)
|
|
196
|
-
notifications.sendPCTicketCreatedMessage(pcTicketUrl, nameVersion, SLACK_DEPLOY_CHANNEL)
|
|
197
|
-
|
|
198
|
-
echo "PC ticket for ${nameVersion} was created"
|
|
199
|
-
echo "PC ticket URL: ${pcTicketUrl}"
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
def publishToNpm(project) {
|
|
203
|
-
def nameVersion = getProjectNameAndVersion(project.name, project.directory)
|
|
204
|
-
|
|
205
|
-
if (hasVersionBeenPublished(project)) {
|
|
206
|
-
def alreadyPublishedMessage = "${nameVersion} has already been published."
|
|
207
|
-
if (isManualDeployJob()) {
|
|
208
|
-
notifications.sendSlackFailedToPublishMessage(nameVersion, SLACK_DEPLOY_CHANNEL)
|
|
209
|
-
error alreadyPublishedMessage
|
|
210
|
-
}
|
|
211
|
-
echo "${alreadyPublishedMessage} Skipping..."
|
|
212
|
-
return
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
def packageJsonPath = getPackageJsonPath(project.directory)
|
|
216
|
-
def tag = pipelineControls.isAlphaVersion(packageJsonPath) ? 'alpha' : 'latest'
|
|
217
|
-
|
|
218
|
-
echo "publishing ${nameVersion}"
|
|
219
|
-
def publishStatus = publishToPublicRegistry(project.directory, tag)
|
|
220
|
-
|
|
221
|
-
if (publishStatus == 0) {
|
|
222
|
-
echo "${nameVersion} was published"
|
|
223
|
-
notifications.sendSlackPublishedMessage(nameVersion, SLACK_DEPLOY_CHANNEL)
|
|
224
|
-
} else {
|
|
225
|
-
notifications.sendSlackFailedToPublishMessage(nameVersion, SLACK_DEPLOY_CHANNEL)
|
|
226
|
-
|
|
227
|
-
def failureMessage = "Unable to publish ${nameVersion}"
|
|
228
|
-
echo failureMessage
|
|
229
|
-
if (isManualDeployJob()) {
|
|
230
|
-
throw new Error(failureMessage)
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
def publishToPublicRegistry(directory, tag) {
|
|
236
|
-
def publishStatus = 0
|
|
237
|
-
def configuration = [vaultCredentialId: 'INT_NPM_PUBLISH_TOKEN']
|
|
238
|
-
def secrets = [
|
|
239
|
-
[path: 'secret/dev-platform/teams/appsdk/npm-public-registry', secretValues: [
|
|
240
|
-
[envVar: 'INT_NPM_TOKEN', vaultKey: 'int_npm_publish_token'],
|
|
241
|
-
]],
|
|
242
|
-
]
|
|
243
|
-
withVault([configuration: configuration, vaultSecrets: secrets]) {
|
|
244
|
-
publishStatus = sh(returnStatus: true, script: 'INT_NPM_TOKEN=$INT_NPM_TOKEN ' + "DIRECTORY=${directory} TAG=${tag} ${MAKE_PUBLISH}")
|
|
245
|
-
}
|
|
246
|
-
return publishStatus
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
def isManualPCTicketJob() {
|
|
250
|
-
return pipelineControls.isManual() && JOB_PARAMETER_RELEASE_STEP == JOB_PARAMETER_RELEASE_STEP_PC_TICKETS
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
def isManualDeployJob() {
|
|
254
|
-
return pipelineControls.isManual() && JOB_PARAMETER_RELEASE_STEP == JOB_PARAMETER_RELEASE_STEP_PUBLISH
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
def isDeploymentJob(jobParameterProject, directory) {
|
|
258
|
-
def packageJsonPath = getPackageJsonPath(directory)
|
|
259
|
-
if (isManualDeployJob()) {
|
|
260
|
-
return JOB_PARAMETER_PROJECT == jobParameterProject
|
|
261
|
-
}
|
|
262
|
-
return pipelineControls.isAlphaRelease(packageJsonPath, MAIN_BRANCH)
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
def getNpmrcPath(directory) {
|
|
266
|
-
def rootDir = pwd()
|
|
267
|
-
return "${rootDir}/${directory}/.npmrc"
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
def getPackageJsonPath(directory) {
|
|
271
|
-
def rootDir = pwd()
|
|
272
|
-
return "${rootDir}/${directory}/package.json"
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
def getProjectNameAndVersion(name, directory) {
|
|
276
|
-
def version = getPackageVersion(directory)
|
|
277
|
-
return "${name}@${version}"
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
def getPackageVersion(directory) {
|
|
281
|
-
def packageJsonPath = getPackageJsonPath(directory)
|
|
282
|
-
return pipelineControls.parseVersionNumber(packageJsonPath)
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
def hasVersionBeenPublished(project) {
|
|
286
|
-
def version = getPackageVersion(project.directory)
|
|
287
|
-
def npmrcPath = getNpmrcPath(project.directory)
|
|
288
|
-
def registryUrl = pipelineControls.parseRegistryUrl(npmrcPath)
|
|
289
|
-
return pipelineControls.hasPackageBeenPreviouslyPublished(project.name, version, registryUrl)
|
|
290
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import groovy.json.JsonOutput
|
|
2
|
-
import groovy.json.JsonSlurper
|
|
3
|
-
|
|
4
|
-
// JIRA ID's
|
|
5
|
-
CHANGE_TYPE_FIELD_ID = 'customfield_17900'
|
|
6
|
-
SERVICE_TEAM_FIELD_ID = 'customfield_12900'
|
|
7
|
-
RISK_FIELD_ID = 'customfield_14500'
|
|
8
|
-
IMPACT_FIELD_ID = 'customfield_15200'
|
|
9
|
-
DILIGENCE_FIELD_ID = 'customfield_15201'
|
|
10
|
-
DATA_CENTER_FIELD_ID = 'customfield_10400'
|
|
11
|
-
RUNBOOK_FIELD_ID = 'customfield_15202'
|
|
12
|
-
ROLLBACK_PLAN_FIELD_ID = 'customfield_15203'
|
|
13
|
-
PROD_CHANGE_CHECKLIST_FIELD_ID = 'customfield_11503'
|
|
14
|
-
|
|
15
|
-
STANDARD_DEPLOYMENT_ID = '16503'
|
|
16
|
-
LOW_RISK_ID = '13602'
|
|
17
|
-
LOW_IMPACT_ID = '14302'
|
|
18
|
-
LOW_DILIGENCE_ID = '14305'
|
|
19
|
-
STATIC_ASSETS_ID = '18113'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def createPCTicket(nameVersion, serviceTeamId, runBookUrl, rollbackUrl, labels) {
|
|
23
|
-
data = [
|
|
24
|
-
fields: [
|
|
25
|
-
labels: labels,
|
|
26
|
-
project: [key: 'PC'],
|
|
27
|
-
issuetype: [id: '10000'],
|
|
28
|
-
summary: "Publish ${nameVersion} to production",
|
|
29
|
-
description: "Publishing ${nameVersion} to production",
|
|
30
|
-
(SERVICE_TEAM_FIELD_ID): [id: serviceTeamId],
|
|
31
|
-
(RUNBOOK_FIELD_ID): runBookUrl,
|
|
32
|
-
(ROLLBACK_PLAN_FIELD_ID): rollbackUrl,
|
|
33
|
-
(CHANGE_TYPE_FIELD_ID): [id: STANDARD_DEPLOYMENT_ID],
|
|
34
|
-
(RISK_FIELD_ID): [id: LOW_RISK_ID],
|
|
35
|
-
(IMPACT_FIELD_ID): [id: LOW_IMPACT_ID],
|
|
36
|
-
(DILIGENCE_FIELD_ID): [id: LOW_DILIGENCE_ID],
|
|
37
|
-
(DATA_CENTER_FIELD_ID): [[id: STATIC_ASSETS_ID]],
|
|
38
|
-
(PROD_CHANGE_CHECKLIST_FIELD_ID): """
|
|
39
|
-
What: ${nameVersion}
|
|
40
|
-
When: Now
|
|
41
|
-
Why: New version
|
|
42
|
-
Risk: low
|
|
43
|
-
Customer Impact: low
|
|
44
|
-
Code Reviewer: appsdk
|
|
45
|
-
Who will be reviewing the change as it is conducted? <FILL OUT>
|
|
46
|
-
What have you done to test this change? manually tested the corresponding alpha release
|
|
47
|
-
What will you do to validate this change? manually test the newly released version
|
|
48
|
-
"""
|
|
49
|
-
]
|
|
50
|
-
]
|
|
51
|
-
issueId = callJira(data)
|
|
52
|
-
issueUrl = "https://qualtrics.atlassian.net/browse/${issueId}"
|
|
53
|
-
return issueUrl
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
def callJira(data) {
|
|
57
|
-
def body = JsonOutput.toJson(data)
|
|
58
|
-
def escapedBody = body.replaceAll("'", "'\"'\"'")
|
|
59
|
-
def configuration = [$class: 'VaultConfiguration', vaultCredentialId: 'INTEGRATIONS-EXTENSION-JENKINS_VAULT-TOKEN']
|
|
60
|
-
def secrets = [[$class: 'VaultSecret', path: 'secret/external-apis/jira/it-jira-admin/prod', secretValues: [
|
|
61
|
-
[envVar: 'JIRA_API_TOKEN', vaultKey: 'JIRA_API_TOKEN'],
|
|
62
|
-
[envVar: 'JIRA_API_EMAIL_ADDRESS', vaultKey: 'JIRA_API_EMAIL_ADDRESS']
|
|
63
|
-
]]]
|
|
64
|
-
wrap([$class: 'VaultBuildWrapper', configuration: configuration, vaultSecrets: secrets]) {
|
|
65
|
-
response = sh(
|
|
66
|
-
script: """
|
|
67
|
-
curl -s -X 'POST' \
|
|
68
|
-
-H 'Content-Type: application/json' \
|
|
69
|
-
-u '${JIRA_API_EMAIL_ADDRESS}:${JIRA_API_TOKEN}' \
|
|
70
|
-
-d '${escapedBody}' \
|
|
71
|
-
'https://qualtrics.atlassian.net/rest/api/2/issue'
|
|
72
|
-
""",
|
|
73
|
-
returnStdout: true
|
|
74
|
-
).trim()
|
|
75
|
-
}
|
|
76
|
-
if (response == '') {
|
|
77
|
-
return []
|
|
78
|
-
}
|
|
79
|
-
echo response
|
|
80
|
-
def parsedResponse = new JsonSlurper().parseText(response)
|
|
81
|
-
return parsedResponse.key
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return this
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
def sendSlackPublishedMessage(projectName, channel) {
|
|
2
|
-
def message = ":rocket: <${BUILD_URL}| Published> *${projectName}*"
|
|
3
|
-
slackSend color: 'good', message: message, channel: channel
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
def sendSlackFailedToPublishMessage(projectName, channel) {
|
|
7
|
-
def message = ":boom: Failed to <${BUILD_URL}| publish> *${projectName}*"
|
|
8
|
-
slackSend color: 'warning', message: message, channel: channel
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
def sendSlackVerifiedProjectMessage(projectName, channel) {
|
|
12
|
-
def message = ":four_leaf_clover: *${projectName}* <${BUILD_URL}| passed> validation"
|
|
13
|
-
slackSend color: 'good', message: message, channel: channel
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
def sendSlackFailedToVerifyProjectMessage(projectName, channel) {
|
|
17
|
-
def message = ":hot_pepper: *${projectName}* <${BUILD_URL}| failed> validation"
|
|
18
|
-
slackSend color: 'warning', message: message, channel: channel
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
def sendPCTicketCreatedMessage(pcTicketUrl, projectName, channel) {
|
|
22
|
-
def message = ":mailbox: <${pcTicketUrl}| PC ticket> for ${projectName} created"
|
|
23
|
-
slackSend color: 'good', message: message, channel: channel
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
def setCommitStatus(status) {
|
|
27
|
-
try {
|
|
28
|
-
updateGitlabCommitStatus name: JOB_NAME, state: status
|
|
29
|
-
} catch (Exception ex) {
|
|
30
|
-
echo "Ignoring Gitlab commit status error ${ex}"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return this
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import groovy.json.JsonSlurper
|
|
2
|
-
|
|
3
|
-
PUSH = 'PUSH'
|
|
4
|
-
NOTE = 'NOTE'
|
|
5
|
-
|
|
6
|
-
def getJobDisplayName(currentBuildNumber, projectName, mainBranch) {
|
|
7
|
-
if (isMergeRequest(mainBranch)) {
|
|
8
|
-
def commitHash = sh(returnStdout: true, script: 'git rev-parse --short HEAD | tr -d \'[:space:]\'')
|
|
9
|
-
return "#${currentBuildNumber} - MR Validation ${commitHash}"
|
|
10
|
-
} else {
|
|
11
|
-
return "#${currentBuild.number} - Publishing ${projectName}"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
def parseRegistryUrl(npmrcPath) {
|
|
16
|
-
def npmrcContents = readFile(npmrcPath)
|
|
17
|
-
def npmrcLines = npmrcContents.split('\n')
|
|
18
|
-
def registryLine = npmrcLines.find({line -> line.startsWith('registry=')})
|
|
19
|
-
def registryUrl = registryLine.minus('registry=')
|
|
20
|
-
return registryUrl
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
def parseVersionNumber(packageJsonPath) {
|
|
24
|
-
def versionNumberPattern = /(\d+).(\d+).(\d+(-alpha.(\d)+)?)/
|
|
25
|
-
def manifest = readFile(packageJsonPath)
|
|
26
|
-
def version = (manifest =~ /\"version\": \"${versionNumberPattern}\"/)
|
|
27
|
-
version = (version[0][0] =~ /${versionNumberPattern}/)
|
|
28
|
-
return version[0][0]
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
def isAlphaVersion(packageJsonPath) {
|
|
32
|
-
def folderVerionNumber = parseVersionNumber(packageJsonPath)
|
|
33
|
-
return folderVerionNumber.contains('-alpha')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
def isMergeRequest(mainBranch) {
|
|
37
|
-
return (env.gitlabActionType == PUSH || env.gitlabActionType == NOTE) && env.gitlabSourceBranch != mainBranch
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
def isPushToMain(mainBranch) {
|
|
41
|
-
return env.gitlabActionType == PUSH && env.gitlabSourceBranch == mainBranch
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
def isManual() {
|
|
45
|
-
return env.gitlabSourceBranch == null
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
def isAlphaRelease(packageJsonPath, mainBranch) {
|
|
49
|
-
return isPushToMain(MAIN_BRANCH) && isAlphaVersion(packageJsonPath)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
def hasPackageBeenPreviouslyPublished(packageName, packageVersion, registryUrl) {
|
|
53
|
-
try {
|
|
54
|
-
def getPackageVersionScript = "curl ${registryUrl}/${packageName}/${packageVersion}"
|
|
55
|
-
def packageVersionString = sh(script: getPackageVersionScript, returnStdout: true)
|
|
56
|
-
def parsedPackageVersion = new JsonSlurper().parseText(packageVersionString)
|
|
57
|
-
return parsedPackageVersion instanceof Map && parsedPackageVersion.containsKey("name")
|
|
58
|
-
} catch(Exception e) {
|
|
59
|
-
echo e
|
|
60
|
-
error "Was unable to check if package version has been already published"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return this
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
def publishResultsToTRS(uuid, serviceTag, reportFilePath, coverageFilePath, workspacePath, team) {
|
|
2
|
-
if (!fileExists(reportFilePath)) {
|
|
3
|
-
currentBuild.result = 'FAILURE'
|
|
4
|
-
echo 'Was not able to find test result artifacts'
|
|
5
|
-
return
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
if (!fileExists(coverageFilePath)) {
|
|
9
|
-
currentBuild.result = 'FAILURE'
|
|
10
|
-
echo 'Was not able to find code coverage artifacts'
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
sh """
|
|
15
|
-
docker run --rm \
|
|
16
|
-
-e REPORT_CONFIG_ID=${uuid} \
|
|
17
|
-
-e TEAM_NAME_TAG="${team}" \
|
|
18
|
-
-e SERVICE_NAME_TAG="${serviceTag}" \
|
|
19
|
-
-e TEST_TYPE_TAG="unittests" \
|
|
20
|
-
-e REPORT_FILE_PATH=\"./mounted/${reportFilePath}\" \
|
|
21
|
-
-e REPORT_TYPE=JUNIT \
|
|
22
|
-
-v \"${workspacePath}/${reportFilePath}\":/home/node/mounted/${reportFilePath} \
|
|
23
|
-
-e CODE_COVERAGE_FILE_PATH=\"./mounted/${coverageFilePath}\" \
|
|
24
|
-
-e CODE_COVERAGE_REPORT_TYPE=COBERTURA \
|
|
25
|
-
-v \"${workspacePath}/${coverageFilePath}\":/home/node/mounted/${coverageFilePath} \
|
|
26
|
-
registry-app.eng.qops.net:5001/test-tools/trs-uploader
|
|
27
|
-
"""
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return this
|