@docupace/pipeline 1.0.107 → 1.0.109

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.107",
3
+ "version": "1.0.109",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1006,6 +1006,7 @@ export async function deployFromSite(
1006
1006
  }
1007
1007
  }
1008
1008
 
1009
+ let autoDeployUpdated = false;
1009
1010
  if (!oldVersion || !newVersion) {
1010
1011
  console.log(
1011
1012
  `Info: Could not determine versions for auto-deploy check (old: ${oldVersion}, new: ${newVersion})`,
@@ -1015,7 +1016,7 @@ export async function deployFromSite(
1015
1016
  `Info: Version unchanged (${newVersion}), skipping auto-deploy update`,
1016
1017
  );
1017
1018
  } else {
1018
- const autoDeployUpdated = await updateAutoDeployVersion(
1019
+ autoDeployUpdated = await updateAutoDeployVersion(
1019
1020
  fromEnv,
1020
1021
  toEnv,
1021
1022
  toSite,
@@ -1037,6 +1038,14 @@ export async function deployFromSite(
1037
1038
  toRepoPath,
1038
1039
  `Updated deployment configurations from ${fromEnv}/${fromSite} to ${toEnv}/${toSite}`,
1039
1040
  );
1041
+ // auto-deploy.yaml lives in gitops-dev; push it separately when toEnv isn't dev
1042
+ if (autoDeployUpdated && toEnv !== 'dev') {
1043
+ const { repoPath: devRepoPath } = getRepoLocalPath('dev');
1044
+ await pushDeployConfig(
1045
+ devRepoPath,
1046
+ `Update auto-deploy version for ${toEnv}/${toSite}`,
1047
+ );
1048
+ }
1040
1049
  console.log('All configurations updated and pushed successfully.');
1041
1050
  } else {
1042
1051
  console.log('No changes detected. Nothing to push.');
@@ -712,6 +712,50 @@ describe('deployFromSite', () => {
712
712
  });
713
713
  });
714
714
 
715
+ it('should push gitops-dev when auto-deploy is updated for non-dev toEnv', async () => {
716
+ // fromEnv=dev, toEnv=qa — auto-deploy.yaml lives in gitops-dev (the from repo)
717
+ // Deploying v1.17.x → v1.18.x causes a major/minor bump, so auto-deploy.yaml is updated
718
+ const mockFromConfig = { image: { tag: 'v1.18.0' } };
719
+ const mockToConfig = { image: { tag: 'v1.17.5' } };
720
+ const mockToAppConfig = { revision: 'v1.17.5' };
721
+ const mockAutoDeployConfig = [
722
+ { env: 'qa', site: 'usafinancial', version: '1.17' },
723
+ ];
724
+
725
+ yaml.load
726
+ .mockReturnValueOnce(mockFromConfig) // version capture: fromConfig
727
+ .mockReturnValueOnce(mockToConfig) // version capture: toConfig
728
+ .mockReturnValueOnce(mockFromConfig) // deployApp: fromDeployConfig
729
+ .mockReturnValueOnce(mockToConfig) // deployApp: toDeployConfig
730
+ .mockReturnValueOnce(mockToAppConfig) // deployApp: toDeployAppConfig
731
+ .mockReturnValueOnce(mockAutoDeployConfig) // updateAutoDeployVersion: auto-deploy.yaml
732
+ .mockReturnValueOnce(mockFromConfig) // validateDeployVersionConsistency: values
733
+ .mockReturnValueOnce(mockToAppConfig); // validateDeployVersionConsistency: app
734
+
735
+ yaml.dump.mockReturnValue('updated');
736
+
737
+ // auto-deploy.yaml exists in gitops-dev
738
+ fs.existsSync.mockImplementation((p) => {
739
+ if (p.includes('auto-deploy.yaml')) return true;
740
+ return true;
741
+ });
742
+
743
+ const gitStatusCalls = [];
744
+ $.mockImplementation((strings) => {
745
+ const cmdStr = Array.isArray(strings) ? strings.join('') : String(strings);
746
+ if (cmdStr.includes('git status --porcelain')) {
747
+ gitStatusCalls.push(cmdStr);
748
+ return Promise.resolve({ stdout: ' M file.yaml\n', stderr: '' });
749
+ }
750
+ return Promise.resolve({ stdout: '', stderr: '' });
751
+ });
752
+
753
+ await deployFromSite('dev', 'financialdev', 'qa', 'usafinancial', 'false', 'false');
754
+
755
+ // Two pushes should have occurred: one for gitops-qa, one for gitops-dev
756
+ expect(gitStatusCalls.length).toBeGreaterThanOrEqual(2);
757
+ });
758
+
715
759
  it('should require JIRA ticket for prod deployments', async () => {
716
760
  // Setup mocks for yaml.load (need 3 calls for fromConfig, toConfig, toAppConfig)
717
761
  const mockFromConfig = { image: { tag: 'v1.0.0' } };
@@ -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