Enabling Code Coverage for Sitecore with Coverlet & Github Actions

Last week I was tasked with enabling Code Coverage in our Sitecore Visual Studio solution and getting it into CodeCov (via our build pipeline). I ended up going down quite the Rabbit hole of different options and hitting a lot of brick walls along the way. I finally figured it out and got it working though so thought I’d share my findings and what I did in the end to get this working. TLDR – add this to your CI workflow in Github actions and adjust the settings as required. What is Code Coverage? In simple terms it gives you an idea of how many of your lines of code are covered by tests and therefore how confident you can be in making changes and releasing without breaking things. I’m not going to get into if this is a good idea, how accurate it is as a indication of the … Continue reading Enabling Code Coverage for Sitecore with Coverlet & Github Actions

Sitecore Page Exporter

Something I need to do regularly is pull down a page from an higher environment (such as UAT or Production) to my local machine or Test. I’ve done this in the past by manually building packages, using Sitecore Sidekick or SPE’s ‘Quick Download Tree as package’ option. However the SPE’s package option does not support packaging up the datasource items (unless they are child items of the page). In my experience there are often global datasources that are not sub-items of the page. This can take quite some time to do manually, especially for large pages. Enter Sitecore Page Exporter So I decided to create ‘Sitecore Page Exporter’ using SPE which will handle this. It supports exporting a specific page as an package and optionally the datasources, images and sub-items. This is v1 so I plan to add more features in the near future. Pre-requisites You must have Sitecore PowerShell … Continue reading Sitecore Page Exporter

Automating Sitecore Azure SQL Database Maintenance

For a long time Sitecore have recommended that you run SQL Maintenance regularly and rebuild the indexes. However you can’t run maintenance plans like this (as you would in an On-Prem environment) in Azure. So I did some research and it seems that Sitecore set these up for you if you using Managed Cloud. but I couldn’t find much further info on this. However I did come across this SSE post with a very useful answer from Richard Hauer on using Azure Runbooks and PowerShell to run database maintenance. There was unfortunately not a lot of detail on how to set it up or use it, I’d only really used Azure Runbooks once before for monitoring and re-starting Solr – so I am certainly no expert on this. So having done this recently I thought I’d write this post to help others who need to do this, follow the steps … Continue reading Automating Sitecore Azure SQL Database Maintenance

Bulk Enable/Disable Sitecore Users with SPE

We’re currently pretty close to completing an upgrade to Sitecore 10.3 for a client and during the go live process we needed to disable most of the users apart from a few admin users and then re-enable them again after go-live. We have a lot of users in the system and so I turned to Sitecore PowerShell Extensions (SPE) to automate this process. Here is the script I came up with: When you run the script it has a dialog which allows you to select if you would like to enable or disable users and to choose which Admin users you would like Exclude when running the Disable/Enable: Obviously you don’t want to accidently lock yourself out of Sitecore by disabling the main sitecore\Admin user!, therefore I’ve put a check in for this to try and stop this happening: Once the script has completed you will see a modal confirming … Continue reading Bulk Enable/Disable Sitecore Users with SPE

Deleting IAR items from the Database & Content Editor warnings for over-written IAR Files

Having recently created an Sitecore 10.3 IAR Package for the Scheduled Publishing Module I needed to remove the files from the database as they were still there even though they are now in the .dat files I created. In previous versions of Sitecore it was quite tricky to do this but luckily were using Sitecore 10.3 and the Sitecore CLI has been updated to allow us to delete specific items from the database with the itemres cleanup command. The commands we need to run are as follows: It’s possible to run these commands using the ‘what if’ flag (-w), to see what would happen if you ran them which is quite handy for testing them first. You will see a message saying that no changes will be made: Note that unfortunately It’s not possible to run the ‘what if’ if not providing a path. It seems this might be coming … Continue reading Deleting IAR items from the Database & Content Editor warnings for over-written IAR Files

Convert Publish files to Sitecore CLI JSON format

I’m currently working on an Sitecore upgrade for a client and this week I needed to upgrade the Scheduled Publishing Module to be compatible with Sitecore 10.3. And whilst the code had been upgraded recently by Nehemiah Jeyakumar, there was no package for it still. I was really keen to use an Item as Resource File (IAR) version, but to do so I’d need an Sitecore CLI JSON file which I didn’t have. There was however a Package.xml file which was used to create previous Sitecore Packages for the module. I wondered if I’d be able to use this to create an Sitecore CLI JSON file but couldn’t find anything online that anyone had done. So I decided I’d write a PowerShell Script to do this for me. You can find this below: The script essentially loads each x-item entry in an Package.xml file, calculates the item path and name … Continue reading Convert Publish files to Sitecore CLI JSON format

My Sitecore SUGCON 2023 Takeaways – Day 2

> DAY ONE – If you haven’t read about Day One you can read it here. SUGCON DAY 2 The 2nd Day of SUGCON started bright an early so after a quick breakfast and cup of tea at the hotel I headed down to the first session I’d planned to see. Rob’s session is one of the key sessions I really didn’t want to miss this year. A few clients I’ve spoken to recently (and other Sitecore Dev’s I’ve chatted to at SUGCON so far) are facing this challenge: ‘How do we move to XM Cloud from XP and what do we need to consider?’ – so I was keen to learn from Rob’s experiences. Migrating advanced Sitecore implementations to XM Cloud – Rob Habraken Rob started with telling us the differences with XM Cloud and explaining how publishing works differently (given you publish to the Edge): Rob then shared … Continue reading My Sitecore SUGCON 2023 Takeaways – Day 2

My Sitecore SUGCON 2023 Takeaways – Day 1

I’ve just got back from and awesome weekend in Malaga at Sitecore SUGCON 2023. If you are not aware of what it is, it’s the developer conference organised by the Community each year to bring Sitecore Developers together in Europe. I’ve been to quite a few SUGCONs over the years but I think this has been one of the best. The talks were really interesting and it was great to catch-up with everyone in the Sitecore Community. I arrived late on Wednesday at the rather impressive Melia near Malaga – right next to the beach. I’ve certainly been to worse locations for conferences. More venue’s like this for future SUGCONs please Sitecore :-). The roof top bar was particularly special – but there was some learning to do before I would be able to enjoy the pool. > DAY TWO – you can read about Day Two here. Day 1 … Continue reading My Sitecore SUGCON 2023 Takeaways – Day 1

What I’m looking forward to seeing at SUGCON 2023

I’m really looking forward to SUGCON 2023 in Malaga in a couple of days time and have decided I’d take an more in-depth look at the conference sessions. At previous SUGCON’s I’ve generally planned the talks I want to go to on the plane flight over, so this time I thought I’d try and do so up-front and share my thoughts on why. Bear in mind that I’m a Sitecore Developer and Consultant so I naturally lean towards more technical tracks. You can find the full agenda here and you can read more about the sessions here. Thursday After the Opening Keynote by Steve Tzikakis and Dave O’Flanagan and the other initial sessions we need to decide on which of the parallel talks to attend. As usual there are a few clashes here, but these are my selections for the rest of the day: Selected Talk Title Rationale Notable Alternative 3:10 pm – 3:55 … Continue reading What I’m looking forward to seeing at SUGCON 2023