From b9f3edd13f160724f8936645de328aff84ea68d1 Mon Sep 17 00:00:00 2001 From: Matthew Blanski Date: Tue, 9 Mar 2021 10:02:57 -0600 Subject: [PATCH 1/4] Added cancel scheduled jobs task --- cumulusci.yml | 23 +++++++++++++++-------- scripts/schedule.cls | 26 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 scripts/schedule.cls diff --git a/cumulusci.yml b/cumulusci.yml index 207413f19b..566edbdeba 100644 --- a/cumulusci.yml +++ b/cumulusci.yml @@ -124,7 +124,7 @@ tasks: unmanaged: True deploy_unpackaged_relationship_autocreate_config: - description: Deploys relationship autocreation configuration for development. Creates an additional lookup to Contact on Contact for testing. + description: Deploys relationship autocreation configuration for development. Creates an additional lookup to Contact on Contact for testing. class_path: cumulusci.tasks.salesforce.Deploy options: namespace_inject: $project_config.project__package__namespace @@ -165,8 +165,15 @@ tasks: options: command: "force:user:permset:assign -n Encryption" + cancel_eda_scheduled_jobs: + description: Unscheduleds EDA Apex jobs + class_path: cumulusci.tasks.apex.anon.AnonymousApexTask + options: + path: scripts/schedule.cls + apex: cancelScheduledJobs(); + check_translation_workbench_enabled: - group: "EDA Metadata" + group: "EDA: Metadata" description: Detects whether or not translation workbench is enabled class_path: cumulusci.tasks.preflight.settings.CheckSettingsValue options: @@ -519,7 +526,7 @@ flows: task: execute_enable_course_connections options: namespaced: False - + deploy_health_check_localization: description: Deploys health check steps: @@ -548,16 +555,16 @@ flows: 3: task: execute_primary_affiliation_mapping_apex when: "'hed' in org_config.installed_packages" - 4: + 4: task: deploy_unpackaged_relationship_autocreate_config when: "'hed' in org_config.installed_packages" 5: task: deploy_preferred_email_config when: "'hed' in org_config.installed_packages" - 6: + 6: # execute tests in unmanaged package - task: run_tests - options: + task: run_tests + options: test_name_match: '%\_Unmanaged_TEST,%\_ATST,%\_MTST,%\_PTST,%\_UTST' upgraded_org: @@ -703,4 +710,4 @@ plans: checks: - when: "not tasks.has_einstein_licenses()" action: error - message: Einstein Analytics permission sets are not available. \ No newline at end of file + message: Einstein Analytics permission sets are not available. diff --git a/scripts/schedule.cls b/scripts/schedule.cls new file mode 100644 index 0000000000..309e48f806 --- /dev/null +++ b/scripts/schedule.cls @@ -0,0 +1,26 @@ +public static void cancelScheduledJobs() { + List edaScheduledJobs = + new List{ + 'Seasonal Addresses Update', + 'HEDA Async Apex Error Processing', + 'HEDA 90-day-old Error Cleaning' + }; + + List edaCronJobDetailList = [ + SELECT Id, + Name, + JobType + FROM CronJobDetail + WHERE Name IN:edaScheduledJobs + ]; + + List edaCronTriggerList = [ + SELECT Id + FROM CronTrigger + WHERE CronJobDetailId IN: edaCronJobDetailList + ]; + + for(CronTrigger cronTrigger : edaCronTriggerList) { + System.abortJob(cronTrigger.Id); + } +} From a7ab7759a2def0a6c8c9c627031e90d7177d3474 Mon Sep 17 00:00:00 2001 From: Matthew Blanski Date: Tue, 9 Mar 2021 10:05:12 -0600 Subject: [PATCH 2/4] Canceled eda scheduled jobs in dev config --- cumulusci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cumulusci.yml b/cumulusci.yml index 566edbdeba..6a61b0901a 100644 --- a/cumulusci.yml +++ b/cumulusci.yml @@ -378,10 +378,12 @@ flows: 3: task: execute_install_apex 4: - task: deploy_dev_config + task: cancel_eda_scheduled_jobs 5: - flow: run_unmanaged_unit_tests + task: deploy_dev_config 6: + flow: run_unmanaged_unit_tests + 7: flow: eda_settings_unmanaged config_dev_namespaced: From b1403f368959cce8e1dd907788f985677ca89ade Mon Sep 17 00:00:00 2001 From: Matthew Blanski Date: Tue, 9 Mar 2021 10:10:49 -0600 Subject: [PATCH 3/4] Added empty guard clauses --- scripts/schedule.cls | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/schedule.cls b/scripts/schedule.cls index 309e48f806..b018649f7c 100644 --- a/scripts/schedule.cls +++ b/scripts/schedule.cls @@ -11,15 +11,23 @@ public static void cancelScheduledJobs() { Name, JobType FROM CronJobDetail - WHERE Name IN:edaScheduledJobs + WHERE Name IN: edaScheduledJobs ]; + if(edaCronJobDetailList.isEmpty()) { + return; + } + List edaCronTriggerList = [ SELECT Id FROM CronTrigger WHERE CronJobDetailId IN: edaCronJobDetailList ]; + if(edaCronTriggerList.isEmpty()) { + return; + } + for(CronTrigger cronTrigger : edaCronTriggerList) { System.abortJob(cronTrigger.Id); } From 95c6e94f7a0849a159242c3724690673c83d7099 Mon Sep 17 00:00:00 2001 From: Matthew Blanski <45603724+MatthewBlanski@users.noreply.github.com> Date: Mon, 22 Mar 2021 14:59:09 -0500 Subject: [PATCH 4/4] Update cumulusci.yml Removed deprecated qa org 2gp config as it is now handled natively. --- cumulusci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cumulusci.yml b/cumulusci.yml index b6d9601419..bdf1562d1c 100644 --- a/cumulusci.yml +++ b/cumulusci.yml @@ -540,11 +540,6 @@ flows: - when: "not tasks.check_translation_workbench_enabled()" action: hide - qa_org_2gp: - steps: - 2: - flow: config_2gp - run_unmanaged_unit_tests: # description: Configure an org for use as a dev org after package metadata is deployed. steps: