@docupace/pipeline 1.0.106 → 1.0.108

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.106",
3
+ "version": "1.0.108",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/next/jira.js CHANGED
@@ -37,13 +37,32 @@ export async function getJiraReleaseNotes(issueKey) {
37
37
  * @param {string} issueKey - The Jira issue key
38
38
  * @param {string} text - The release notes text to set
39
39
  */
40
+ async function ensureVersionsExist(projectKey, versions) {
41
+ for (const versionName of versions) {
42
+ try {
43
+ await jiraClient.post('/rest/api/2/version', {
44
+ name: versionName,
45
+ project: projectKey,
46
+ });
47
+ console.log(`Created version '${versionName}' in project ${projectKey}`);
48
+ } catch (error) {
49
+ const errors = error.response?.data?.errors;
50
+ if (errors?.name?.includes('already exists')) {
51
+ // Version already exists, nothing to do
52
+ } else {
53
+ throw error;
54
+ }
55
+ }
56
+ }
57
+ }
58
+
40
59
  export async function updateJiraReleaseNotes(
41
60
  issueKey,
42
61
  text,
43
62
  url,
44
63
  jiraVersions,
45
64
  ) {
46
- try {
65
+ const doUpdate = async () => {
47
66
  const payload = {
48
67
  fields: {
49
68
  customfield_10108: text,
@@ -51,15 +70,28 @@ export async function updateJiraReleaseNotes(
51
70
  fixVersions: jiraVersions.map((version) => ({ name: version })),
52
71
  },
53
72
  };
54
-
55
73
  await jiraClient.put(`/rest/api/2/issue/${issueKey}`, payload);
74
+ };
56
75
 
76
+ try {
77
+ await doUpdate();
57
78
  console.log(`Updated release notes for ${issueKey}`);
58
79
  } catch (error) {
59
- console.error(
60
- `Error updating Jira release notes for ${issueKey}: ${error.message}`,
61
- );
62
- throw error;
80
+ const responseErrors = error.response?.data?.errors;
81
+ if (responseErrors?.fixVersions) {
82
+ const projectKey = issueKey.split('-')[0];
83
+ console.log(
84
+ `Invalid fixVersions for ${issueKey}: ${responseErrors.fixVersions}. Creating missing versions in project ${projectKey}...`,
85
+ );
86
+ await ensureVersionsExist(projectKey, jiraVersions);
87
+ await doUpdate();
88
+ console.log(`Updated release notes for ${issueKey}`);
89
+ } else {
90
+ console.error(
91
+ `Error updating Jira release notes for ${issueKey}: ${error.message}`,
92
+ );
93
+ throw error;
94
+ }
63
95
  }
64
96
  }
65
97
 
@@ -103,6 +103,7 @@ elif [[ "$PROJECT" == "idp" ]]; then
103
103
  -var="configure_precisefp_client_credentials=${CONFIGURE_PRECISEFP_CLIENT_CREDENTIALS}" \
104
104
  -var="use_azuread_app=${USE_AZUREAD_APP}" \
105
105
  -var="deploy_azuread_app=${DEPLOY_AZUREAD_APP}" \
106
+ -var="allow_offline_access=${ALLOW_OFFLINE_ACCESS}" \
106
107
  -- "$IMPORT_ADDRESS" "$IMPORT_ID"
107
108
  else
108
109
  terraform import \
package/terraform/plan.sh CHANGED
@@ -84,6 +84,7 @@ elif [[ "$PROJECT" == "idp" ]]; then
84
84
  -var="configure_precisefp_client_credentials=${CONFIGURE_PRECISEFP_CLIENT_CREDENTIALS}" \
85
85
  -var="use_azuread_app=${USE_AZUREAD_APP}" \
86
86
  -var="deploy_azuread_app=${DEPLOY_AZUREAD_APP}" \
87
+ -var="allow_offline_access=${ALLOW_OFFLINE_ACCESS}" \
87
88
  $TARGET \
88
89
  -out .tfplan \
89
90
  $TF_OPTIONS