@qualtrics/plugin-ui-react 1.4.0-alpha.0 → 1.4.0-alpha.11

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.
Files changed (59) hide show
  1. package/.eslintignore +3 -0
  2. package/CHANGELOG.md +20 -0
  3. package/dist/common/capture-event/capture-event.d.ts +10 -6
  4. package/dist/common/field-mapper/field-mapper-key/field-mapper-key.d.ts +4 -3
  5. package/dist/common/field-mapper/field-mapper-row/field-mapper-row.d.ts +3 -4
  6. package/dist/common/field-mapper/field-mapper-value/field-mapper-value.d.ts +7 -3
  7. package/dist/common/field-mapper/field-mapper.d.ts +3 -5
  8. package/dist/common/piped-text-select/piped-text-menu/embedded-data-menu/embedded-data-input/embedded-data-input.d.ts +10 -0
  9. package/dist/common/piped-text-select/piped-text-menu/embedded-data-menu/embedded-data-menu.d.ts +15 -2
  10. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-item/piped-text-menu-item.d.ts +10 -7
  11. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-item-service.d.ts +7 -0
  12. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-keyboard-ctrl.d.ts +27 -0
  13. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-list/piped-text-menu-list.d.ts +24 -0
  14. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-list/piped-text-menu-load-error/piped-text-menu-load-error.d.ts +7 -0
  15. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-list/piped-text-search-input/piped-text-search-input.d.ts +10 -0
  16. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu.d.ts +26 -4
  17. package/dist/common/piped-text-select/piped-text-menu/piped-text-submenu-item/piped-text-submenu-item.d.ts +7 -4
  18. package/dist/common/popover/popover-options.d.ts +3 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.es.js +48 -0
  21. package/dist/index.js +48 -0
  22. package/dist/lib/merge-refs.d.ts +2 -0
  23. package/package.json +35 -33
  24. package/tsconfig.json +7 -1
  25. package/.dockerignore +0 -10
  26. package/Dockerfile +0 -18
  27. package/Makefile +0 -33
  28. package/dist/common/capture-event/capture-event.test.d.ts +0 -1
  29. package/dist/common/copy-text/copy-text.test.d.ts +0 -1
  30. package/dist/common/dynamic-search-input/dynamic-search-input.d.ts +0 -1
  31. package/dist/common/dynamic-search-input/dynamic-search-input.test.d.ts +0 -1
  32. package/dist/common/event-registry.d.ts +0 -9
  33. package/dist/common/language-service.d.ts +0 -1
  34. package/dist/common/multiselect-dropdown/multiselect-dropdown.d.ts +0 -1
  35. package/dist/common/multiselect-dropdown/multiselect-dropdown.test.d.ts +0 -1
  36. package/dist/common/multiselect-dropdown/select-item/select-item.d.ts +0 -1
  37. package/dist/common/multiselect-dropdown/select-item/select-item.test.d.ts +0 -1
  38. package/dist/common/piped-text-input/piped-text-input.test.d.ts +0 -1
  39. package/dist/common/piped-text-select/piped-text-select.d.ts +0 -1
  40. package/dist/common/piped-text-select/piped-text-select.test.d.ts +0 -1
  41. package/dist/common/plugin-sdk-service.d.ts +0 -5
  42. package/dist/common/popover/popover.d.ts +0 -1
  43. package/dist/common/portal.d.ts +0 -10
  44. package/dist/common/task-fields/field-item/field-item.d.ts +0 -1
  45. package/dist/common/task-fields/field-item/field-item.test.d.ts +0 -1
  46. package/dist/common/task-fields/field-row/field-row.d.ts +0 -1
  47. package/dist/common/task-fields/field-row/field-row.test.d.ts +0 -1
  48. package/dist/common/task-fields/task-fields.d.ts +0 -1
  49. package/dist/common/task-fields/task-fields.test.d.ts +0 -1
  50. package/dist/main.es.js +0 -3126
  51. package/dist/main.js +0 -3154
  52. package/dist/plugin-app/example-data.d.ts +0 -102
  53. package/dist/plugin-app/plugin-app.d.ts +0 -1
  54. package/jenkins.groovy +0 -284
  55. package/jenkinsPipelineUtils/jira.groovy +0 -84
  56. package/jenkinsPipelineUtils/notifications.groovy +0 -34
  57. package/jenkinsPipelineUtils/pipelineControls.groovy +0 -56
  58. package/jenkinsPipelineUtils/trs.groovy +0 -30
  59. 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,284 +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
- PUBLIC_REGISTRY = 'https://registry.npmjs.org'
8
-
9
- // Project Contstants
10
- SLACK_DEPLOY_CHANNEL = '#app-sdk-deploys'
11
- SLACK_MR_VALIDATION_CHANNEL = '#app-sdk-mr-validation'
12
-
13
- PROJECTS = [
14
- [
15
- name: '@qualtrics/plugin-ui-react',
16
- directory: '.',
17
- jobParameterProject: JOB_PARAMETER_PROJECT_PLUGIN_UI_REACT,
18
- trsId: '1d15e1dc-f156-45a2-966e-89dba1797e68',
19
- trsServiceTag: 'qualtrics-plugin-ui-react'
20
- ]
21
- ]
22
-
23
- TRS_TEAM = 'appsdk'
24
- 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}"
25
- TEST_RESULTS_FILE = 'junit.xml'
26
- CODE_COVERAGE_FILE = 'cobertura-coverage.xml'
27
-
28
- JIRA_SERVICE_TEAM_ID = '18254'
29
- JIRA_LABELS = ['DPEE']
30
- TEAM_RUNBOOK = 'https://odo.corp.qualtrics.com/wiki/index.php/AppSDK_Team_Runbook'
31
- TEAM_ROLLBACK = 'https://odo.corp.qualtrics.com/wiki/index.php/AppSDK_Team_Runbook#Task_Rollback'
32
-
33
- MAKE_PUBLISH_EXTERNAL = 'make publish-external'
34
- MAKE_BUILD = 'make build'
35
- MAKE_TEST = 'make test'
36
- MAKE_CLEAN = 'make clean'
37
-
38
- MAIN_BRANCH = 'master'
39
-
40
- pipeline {
41
- agent {
42
- label 'nomad-builder'
43
- }
44
- environment {
45
- DOCKER_HOST = '127.0.0.1:2375'
46
- WORKSPACE_PATH = "/var/lib/nomad/alloc/${NOMAD_ALLOC_ID}/${NOMAD_TASK_NAME}${WORKSPACE}"
47
- }
48
-
49
- options {
50
- timestamps()
51
- buildDiscarder(logRotator(numToKeepStr: '5'))
52
- timeout(time: 60, unit: 'MINUTES')
53
- }
54
-
55
- stages {
56
- stage('Setup') {
57
- steps {
58
- script {
59
- def rootDir = pwd()
60
- def jenkinsUtilsFolder = "${rootDir}/jenkinsPipelineUtils"
61
- trs = load("${jenkinsUtilsFolder}/trs.groovy")
62
- jira = load("${jenkinsUtilsFolder}/jira.groovy")
63
- notifications = load("${jenkinsUtilsFolder}/notifications.groovy")
64
- pipelineControls = load("${jenkinsUtilsFolder}/pipelineControls.groovy")
65
-
66
- notifications.setCommitStatus('running')
67
-
68
- PROJECT_NAME_VERSION = ''
69
-
70
- for (project in PROJECTS) {
71
- def nameVersion = getProjectNameAndVersion(project.name, project.directory)
72
- PROJECT_NAME_VERSION += "${nameVersion} "
73
- TRS_GRAFANA_PROJECT_URL += "&var-unit_service=${project.trsServiceTag}"
74
- echo "Project: ${nameVersion}"
75
- }
76
- echo "Workspace: ${WORKSPACE_PATH}"
77
- echo "Git action: ${env.gitlabActionType}"
78
- echo "Git source branch: ${env.gitlabSourceBranch}"
79
-
80
- currentBuild.displayName = pipelineControls.getJobDisplayName(currentBuild.number, PROJECT_NAME_VERSION, MAIN_BRANCH)
81
- }
82
- }
83
- }
84
- stage('Build') {
85
- when {
86
- expression {
87
- !isManualPCTicketJob()
88
- }
89
- }
90
- steps {
91
- sh script: MAKE_BUILD
92
- }
93
- }
94
- stage('Unit Test') {
95
- when {
96
- expression {
97
- !isManualPCTicketJob()
98
- }
99
- }
100
- steps {
101
- script {
102
- for (project in PROJECTS) {
103
- echo "testing ${project.name}"
104
- sh script: "${MAKE_TEST} DIRECTORY=${project.directory}"
105
- }
106
- }
107
- }
108
- }
109
- stage('TRS') {
110
- when {
111
- expression {
112
- pipelineControls.isPushToMain(MAIN_BRANCH)
113
- }
114
- }
115
- steps {
116
- script {
117
- for (project in PROJECTS) {
118
- publishToTRS(project)
119
- }
120
- echo "To see the TRS dashboard vist ${TRS_GRAFANA_PROJECT_URL}"
121
- }
122
- }
123
- }
124
- stage('PC Tickets') {
125
- when {
126
- expression {
127
- isManualPCTicketJob()
128
- }
129
- }
130
- steps {
131
- script {
132
- for (project in PROJECTS) {
133
- if (project.jobParameterProject == JOB_PARAMETER_PROJECT) {
134
- createPCReleaseTicket(project)
135
- }
136
- }
137
- }
138
- }
139
- }
140
- stage('Publish') {
141
- when {
142
- expression {
143
- pipelineControls.isPushToMain(MAIN_BRANCH) || JOB_PARAMETER_RELEASE_STEP == JOB_PARAMETER_RELEASE_STEP_PUBLISH
144
- }
145
- }
146
- steps {
147
- script {
148
- for (project in PROJECTS) {
149
- if (isDeploymentJob(project.jobParameterProject, project.directory)) {
150
- publishToNpm(project)
151
- }
152
- }
153
- }
154
- }
155
- }
156
- }
157
-
158
- post {
159
- success {
160
- script {
161
- if (!isManualPCTicketJob()) {
162
- def validationChannel = pipelineControls.isMergeRequest(MAIN_BRANCH) ? SLACK_MR_VALIDATION_CHANNEL : SLACK_DEPLOY_CHANNEL
163
- notifications.sendSlackVerifiedProjectMessage(PROJECT_NAME_VERSION, validationChannel)
164
- }
165
- notifications.setCommitStatus('success')
166
- }
167
- }
168
- failure {
169
- script {
170
- def validationChannel = pipelineControls.isMergeRequest(MAIN_BRANCH) ? SLACK_MR_VALIDATION_CHANNEL : SLACK_DEPLOY_CHANNEL
171
- notifications.sendSlackFailedToVerifyProjectMessage(PROJECT_NAME_VERSION, validationChannel)
172
- notifications.setCommitStatus('failed')
173
- }
174
- }
175
- aborted {
176
- script {
177
- notifications.setCommitStatus('canceled')
178
- }
179
- }
180
- always {
181
- sh script: MAKE_CLEAN
182
- }
183
- }
184
- }
185
-
186
- def publishToTRS(project) {
187
- echo "publishing ${project.name} to TRS"
188
- def resultsDir = "./coverage/${project.directory}/${TEST_RESULTS_FILE}"
189
- def coverageDir = "./coverage/${project.directory}/${CODE_COVERAGE_FILE}"
190
- trs.publishResultsToTRS(project.trsId, project.trsServiceTag, resultsDir, coverageDir, WORKSPACE_PATH, TRS_TEAM)
191
- }
192
-
193
- def createPCReleaseTicket(project) {
194
- def nameVersion = getProjectNameAndVersion(project.name, project.directory)
195
- echo "creating PC ticket for ${nameVersion}"
196
-
197
- def pcTicketUrl = jira.createPCTicket(nameVersion, JIRA_SERVICE_TEAM_ID, TEAM_RUNBOOK, TEAM_ROLLBACK, JIRA_LABELS)
198
- notifications.sendPCTicketCreatedMessage(pcTicketUrl, nameVersion, SLACK_DEPLOY_CHANNEL)
199
-
200
- echo "PC ticket for ${nameVersion} was created"
201
- echo "PC ticket URL: ${pcTicketUrl}"
202
- }
203
-
204
- def publishToNpm(project) {
205
- def nameVersion = getProjectNameAndVersion(project.name, project.directory)
206
- echo "publishing ${nameVersion}"
207
-
208
- if (hasVersionBeenPublished(project)) {
209
- def alreadyPublishedMessage = "${nameVersion} has already been published."
210
- if (isManualDeployJob()) {
211
- notifications.sendSlackFailedToPublishMessage(nameVersion, SLACK_DEPLOY_CHANNEL)
212
- erorr alreadyPublishedMessage
213
- }
214
- echo "${alreadyPublishedMessage} Skipping..."
215
- return
216
- }
217
-
218
- def packageJsonPath = getPackageJsonPath(project.directory)
219
- def tag = pipelineControls.isAlphaVersion(packageJsonPath) ? 'alpha' : 'latest'
220
- def publishStatus = publishToPublicRegistry(project.directory, tag)
221
-
222
- if (publishStatus == 0) {
223
- echo "${nameVersion} was published"
224
- notifications.sendSlackPublishedMessage(nameVersion, SLACK_DEPLOY_CHANNEL)
225
- } else {
226
- notifications.sendSlackFailedToPublishMessage(nameVersion, SLACK_DEPLOY_CHANNEL)
227
-
228
- def failureMessage = "Unable to publish ${nameVersion}"
229
- echo failureMessage
230
- if (isManualDeployJob()) {
231
- throw new Error(failureMessage)
232
- }
233
- }
234
- }
235
-
236
- def publishToPublicRegistry(directory, tag) {
237
- def publishStatus = 0
238
- def configuration = [vaultCredentialId: 'INT_NPM_PUBLISH_TOKEN']
239
- def secrets = [
240
- [path: 'secret/dev-platform/teams/appsdk/npm-public-registry', secretValues: [
241
- [envVar: 'INT_NPM_TOKEN', vaultKey: 'int_npm_publish_token'],
242
- ]],
243
- ]
244
- withVault([configuration: configuration, vaultSecrets: secrets]) {
245
- publishStatus = sh(returnStatus: true, script: 'INT_NPM_TOKEN=$INT_NPM_TOKEN ' + "DIRECTORY=${directory} TAG=${tag} ${MAKE_PUBLISH_EXTERNAL}")
246
- }
247
- return publishStatus
248
- }
249
-
250
- def isManualPCTicketJob() {
251
- return pipelineControls.isManual() && JOB_PARAMETER_RELEASE_STEP == JOB_PARAMETER_RELEASE_STEP_PC_TICKETS
252
- }
253
-
254
- def isManualDeployJob() {
255
- return pipelineControls.isManual() && JOB_PARAMETER_RELEASE_STEP == JOB_PARAMETER_RELEASE_STEP_PUBLISH
256
- }
257
-
258
- def isDeploymentJob(jobParameterProject, directory) {
259
- def packageJsonPath = getPackageJsonPath(directory)
260
- if (isManualDeployJob()) {
261
- return JOB_PARAMETER_PROJECT == jobParameterProject
262
- }
263
- return pipelineControls.isAlphaRelease(packageJsonPath, MAIN_BRANCH)
264
- }
265
-
266
- def getPackageJsonPath(directory) {
267
- def rootDir = pwd()
268
- return "${rootDir}/${directory}/package.json"
269
- }
270
-
271
- def getProjectNameAndVersion(name, directory) {
272
- def version = getPackageVersion(directory)
273
- return "${name}@${version}"
274
- }
275
-
276
- def getPackageVersion(directory) {
277
- def packageJsonPath = getPackageJsonPath(directory)
278
- return pipelineControls.parseVersionNumber(packageJsonPath)
279
- }
280
-
281
- def hasVersionBeenPublished(project) {
282
- def version = getPackageVersion(project.directory)
283
- return pipelineControls.hasPackageBeenPreviouslyPublished(project.name, version, PUBLIC_REGISTRY)
284
- }
@@ -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,56 +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 parseVersionNumber(packageJsonPath) {
16
- def versionNumberPattern = /(\d+).(\d+).(\d+(-alpha.(\d)+)?)/
17
- def manifest = readFile(packageJsonPath)
18
- def version = (manifest =~ /\"version\": \"${versionNumberPattern}\"/)
19
- version = (version[0][0] =~ /${versionNumberPattern}/)
20
- return version[0][0]
21
- }
22
-
23
- def isAlphaVersion(packageJsonPath) {
24
- def folderVerionNumber = parseVersionNumber(packageJsonPath)
25
- return folderVerionNumber.contains('-alpha')
26
- }
27
-
28
- def isMergeRequest(mainBranch) {
29
- return (env.gitlabActionType == PUSH || env.gitlabActionType == NOTE) && env.gitlabSourceBranch != mainBranch
30
- }
31
-
32
- def isPushToMain(mainBranch) {
33
- return env.gitlabActionType == PUSH && env.gitlabSourceBranch == mainBranch
34
- }
35
-
36
- def isManual() {
37
- return env.gitlabSourceBranch == null
38
- }
39
-
40
- def isAlphaRelease(packageJsonPath, mainBranch) {
41
- return isPushToMain(MAIN_BRANCH) && isAlphaVersion(packageJsonPath)
42
- }
43
-
44
- def hasPackageBeenPreviouslyPublished(packageName, packageVersion, registryUrl) {
45
- try {
46
- def getPackageVersionScript = "curl ${registryUrl}/${packageName}/${packageVersion}"
47
- def packageVersionString = sh(script: getPackageVersionScript, returnStdout: true)
48
- def parsedPackageVersion = new JsonSlurper().parseText(packageVersionString)
49
- return parsedPackageVersion instanceof Map && parsedPackageVersion.containsKey("name")
50
- } catch(Exception e) {
51
- echo e
52
- error "Was unable to check if package version has been already published"
53
- }
54
- }
55
-
56
- 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