Skip to content

Commit

Permalink
CP-45071: Convert XenCenter build scripts to PowerShell. (#3219)
Browse files Browse the repository at this point in the history
* CP-45071: Convert XenCenter build scripts to PowerShell.
* Removed obsolete variable.
* Pass the timestamp server and the certificate thumbprint as parameters to the build and sign scripts.
* Added further logging and made the verbose output of cmdlets optional.
* Updated README.
* Improved script readability.

Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 authored Sep 6, 2023
1 parent 53dd3d9 commit dd98fe6
Show file tree
Hide file tree
Showing 21 changed files with 520 additions and 441 deletions.
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!groovy

/* Copyright (c) Cloud Software Group, Inc.
/* Copyright (c) Cloud Software Group, Inc.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
Expand Down Expand Up @@ -30,10 +30,10 @@
* SUCH DAMAGE.
*/

def XENADMIN_BRANDING_TAG = 'v5.1'
def XENADMIN_BRANDING_TAG = 'v5.2'

@Library(['PacmanSharedLibrary', "xencenter-pipeline@v4.9"])
import com.citrix.pipeline.xencenter.*
@Library(['PacmanSharedLibrary', "xencenter-pipeline@v4.10"])
import com.xenserver.pipeline.xencenter.*

properties([
[
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ To run the [NUnit](http://www.nunit.org/) tests you will need the following libr
* Moq.dll

which can be obtained from <http://www.nuget.org/>.

Note that the build script assumes that you have added MSBuild's location (usually
`C:\Program Files\Microsoft Visual Studio\2022\<edition>\MSBuild\Current\Bin`)
to your `PATH` environment variable.
18 changes: 9 additions & 9 deletions WixInstaller/XenCenter.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="XenServer" Name="$(var.BrandProduct)">
<Directory Id="INSTALLDIR" ShortName="$(var.BrandConsoleShort)" Name="$(var.BrandConsoleNoSpace)">
<Directory Id="INSTALLDIR" ShortName="$(var.BrandConsoleShort)" Name="$(var.BrandConsole)">
<Component Id="ReportViewer" Guid="$(var.ReportViewerGuid)">
<File Id="MicRepVwrCmnDLL" Source="$(env.RepoRoot)\XenAdmin\ReportViewer\Microsoft.ReportViewer.Common.dll" />
<File Id="MicRepVwrPrcObjDLL" Source="$(env.RepoRoot)\XenAdmin\ReportViewer\Microsoft.ReportViewer.ProcessingObjectModel.dll" />
Expand All @@ -56,11 +56,11 @@
</Component>
<Component Id="MainExecutable" Guid="$(var.MainExeGuid)">
<!-- XenCenter EXE -->
<File Id="XenCenterEXE" Source="$(env.RepoRoot)\XenAdmin\bin\Release\$(var.BrandConsoleNoSpace).exe" KeyPath="yes" />
<File Id="XenCenterEXE" Source="$(env.RepoRoot)\XenAdmin\bin\Release\$(var.BrandConsole).exe" KeyPath="yes" />
<!-- other EXEs -->
<File Id="XeEXE" Source="$(env.RepoRoot)\xe\bin\Release\xe.exe" />
<!-- config -->
<File Id="XenCenterCONFIG" Source="$(env.RepoRoot)\XenAdmin\bin\Release\$(var.BrandConsoleNoSpace).exe.config" />
<File Id="XenCenterCONFIG" Source="$(env.RepoRoot)\XenAdmin\bin\Release\$(var.BrandConsole).exe.config" />
<!-- DLLs -->
<File Id="CommandLibDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\CommandLib.dll" />
<File Id="CookComputingDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\CookComputing.XmlRpcV2.dll" />
Expand Down Expand Up @@ -149,16 +149,16 @@
<Condition>INSTALLSHORTCUT</Condition>
<Shortcut Id="DesktopXenCenter"
Name="$(var.BrandConsole)"
Target="[INSTALLDIR]$(var.BrandConsoleNoSpace).exe"
Target="[INSTALLDIR]$(var.BrandConsole).exe"
WorkingDirectory="INSTALLDIR"
/>
<RegistryValue Root="HKCU" Key="Software\$(var.BrandProduct)\$(var.BrandConsoleNoSpace)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
<RegistryValue Root="HKCU" Key="Software\$(var.BrandProduct)\$(var.BrandConsole)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</Directory>
</Directory>
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="$(var.RegEntriesGuid)">
<RegistryKey Root="HKMU" Key="Software\$(var.BrandProduct)\$(var.BrandConsoleNoSpace)">
<RegistryKey Root="HKMU" Key="Software\$(var.BrandProduct)\$(var.BrandConsole)">
<RegistryValue Type="string" Name="InstallDir" Value="[INSTALLDIR]" />
<?if "$(var.HiddenFeatures)" != ""?>
<RegistryValue Type="string" Name="HiddenFeatures" Value="$(var.HiddenFeatures)" />
Expand All @@ -172,9 +172,9 @@

<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="$(var.AppShortcutGuid)">
<Shortcut Id="StartmenuXenCenter" ShortName="$(var.BrandConsoleShort)" Name="$(var.BrandConsole)" Target="[INSTALLDIR]$(var.BrandConsoleNoSpace).exe" WorkingDirectory="INSTALLDIR" Icon="XenCenterICO" />
<Shortcut Id="StartmenuXenCenter" ShortName="$(var.BrandConsoleShort)" Name="$(var.BrandConsole)" Target="[INSTALLDIR]$(var.BrandConsole).exe" WorkingDirectory="INSTALLDIR" Icon="XenCenterICO" />
<RemoveFolder Id="ApplicationProgramsFolder" On="both" />
<RegistryValue Root="HKCU" Key="Software\$(var.BrandProduct)\$(var.BrandConsoleNoSpace)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
<RegistryValue Root="HKCU" Key="Software\$(var.BrandProduct)\$(var.BrandConsole)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>

Expand All @@ -200,7 +200,7 @@
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#528040")]]>
</Condition>
<Property Id="PERMACHINEINSTALL">
<RegistrySearch Id="InstallRegistry" Type="raw" Root="HKLM" Key="Software\$(var.BrandProduct)\$(var.BrandConsoleNoSpace)" Name="InstallDir" />
<RegistrySearch Id="InstallRegistry" Type="raw" Root="HKLM" Key="Software\$(var.BrandProduct)\$(var.BrandConsole)" Name="InstallDir" />
</Property>
<Property Id="REINSTALLMODE" Value="amus" />
<Property Id="INSTALLSHORTCUT" Value="0"/>
Expand Down
3 changes: 1 addition & 2 deletions WixInstaller/branding.wxi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) Cloud Software Group, Inc.
Copyright (c) Cloud Software Group, Inc.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided
Expand Down Expand Up @@ -49,7 +49,6 @@
<?define CompanyNameLegal="@COMPANY_NAME_LEGAL@"?>
<?define CompanyNameShort="@COMPANY_NAME_SHORT@"?>
<?define BrandConsole="@BRAND_CONSOLE@"?>
<?define BrandConsoleNoSpace="@BRAND_CONSOLE_NO_SPACE@"?>
<?define BrandConsoleShort="@BRAND_CONSOLE_SHORT@"?>
<?define BrandProduct="@PRODUCT_BRAND@"?>
<?define FileExtBackup="xbk"?>
Expand Down
29 changes: 0 additions & 29 deletions WixInstaller/candleList.txt

This file was deleted.

29 changes: 0 additions & 29 deletions WixInstaller/litList.txt

This file was deleted.

13 changes: 7 additions & 6 deletions WixInstaller/wix_src.patch
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ diff -ru wixlib/Common.wxs wixlib/Common.wxs
+<Fragment>
+ <Binary Id="WixUIWixca" SourceFile="PrintEula.dll" />
+</Fragment>
+
+
</Wix>
diff -ru wixlib/CustomizeDlg.wxs wixlib/CustomizeDlg.wxs
--- wixlib/CustomizeDlg.wxs 2019-09-15 07:13:54.000000000 +0100
Expand Down Expand Up @@ -158,7 +158,7 @@ diff -ru wixlib/CustomizeDlg.wxs wixlib/CustomizeDlg.wxs
diff -ru wixlib/CustomizeStdDlg.wxs wixlib/CustomizeStdDlg.wxs
--- wixlib/CustomizeStdDlg.wxs Tue Feb 21 12:03:46 2012
+++ wixlib/CustomizeStdDlg.wxs Tue Jul 20 20:54:33 2015
@@ -13,7 +13,7 @@
@@ -5,7 +5,7 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
Expand Down Expand Up @@ -554,7 +554,7 @@ diff -ru wixlib/WixUI_en-us.wxl wixlib/WixUI_en-us.wxl
<String Id="UITextVolumeCostRequired" Overridable="yes"><!-- _locID_text="UITextVolumeCostRequired" _locComment="UITextVolumeCostRequired" -->Required</String>
<String Id="UITextVolumeCostSize" Overridable="yes"><!-- _locID_text="UITextVolumeCostSize" _locComment="UITextVolumeCostSize" -->Disk Size</String>
<String Id="UITextVolumeCostVolume" Overridable="yes"><!-- _locID_text="UITextVolumeCostVolume" _locComment="UITextVolumeCostVolume" -->Volume</String>
+
+
+ <String Id="ErrorNewerProduct">A newer version of this product is already installed.</String>
+ <String Id="InstallDirDlgUsersLabel">Install for:</String>
+ <String Id="InstallDirDlgUsersAllRadioButton">&amp;All Users</String>
Expand Down Expand Up @@ -600,10 +600,10 @@ diff -ru wixlib/WixUI_FeatureTree.wxs wixlib/WixUI_FeatureTree.wxs
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
+
+
+ <Publish Dialog="CustomizeStdDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
+ <Publish Dialog="CustomizeStdDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+
+
</UI>

<UIRef Id="WixUI_Common" />
Expand Down Expand Up @@ -1023,4 +1023,5 @@ diff --git wixlib/MsiRMFilesInUse.wxs wixlib/MsiRMFilesInUse.wxs
+ <Publish Property="XS_WixUIRMPressedOk" Value="1">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="EndDialog" Value="Exit">1</Publish>
<Publish Event="EndDialog" Value="Exit">1</Publish>

2 changes: 1 addition & 1 deletion XenAdmin/Alerts/Types/ClientUpdateAlert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public override bool Equals(Alert other)

public static void DownloadAndInstallNewClient(ClientUpdateAlert updateAlert, IWin32Window parent)
{
var outputPathAndFileName = Path.Combine(Path.GetTempPath(), $"{BrandManager.BrandConsoleNoSpace}.msi");
var outputPathAndFileName = Path.Combine(Path.GetTempPath(), $"{BrandManager.BrandConsole}.msi");

var downloadAndInstallClientAction = new DownloadAndUpdateClientAction(updateAlert.Name, new Uri(updateAlert.NewVersion.Url), outputPathAndFileName, updateAlert.Checksum);

Expand Down
2 changes: 1 addition & 1 deletion XenAdmin/Core/Registry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static string GetYumRepoDevTeamSource()
private const string FORCE_SYSTEM_FONTS = "ForceSystemFonts";
private const string DISABLE_PLUGINS = "DisablePlugins";
private const string DONT_SUDO = "DontSudo";
private static readonly string XENCENTER_LOCAL_KEYS = $"SOFTWARE\\{BrandManager.ProductBrand}\\{BrandManager.BrandConsoleNoSpace}";
private static readonly string XENCENTER_LOCAL_KEYS = $"SOFTWARE\\{BrandManager.ProductBrand}\\{BrandManager.BrandConsole}";
private const string PSExecutionPolicyKey = @"Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell";
private const string PSExecutionPolicyName = "ExecutionPolicy";
private const string PowerShellKey = @"Software\Microsoft\PowerShell\1";
Expand Down
10 changes: 5 additions & 5 deletions XenAdmin/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ static Program()
var logFolder = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
BrandManager.ProductBrand,
BrandManager.BrandConsoleNoSpace,
BrandManager.BrandConsole,
"logs");

log4net.GlobalContext.Properties["LOG_FILE"] = Path.Combine(logFolder, $"{BrandManager.BrandConsoleNoSpace}.log");
log4net.GlobalContext.Properties["AUDIT_TRAIL"] = Path.Combine(logFolder, $"{BrandManager.BrandConsoleNoSpace}-AuditTrail.log");
log4net.GlobalContext.Properties["NETWORK_TRACE"] = Path.Combine(logFolder, $"{BrandManager.BrandConsoleNoSpace}-NetworkTrace.log");
log4net.GlobalContext.Properties["LOG_FILE"] = Path.Combine(logFolder, $"{BrandManager.BrandConsole}.log");
log4net.GlobalContext.Properties["AUDIT_TRAIL"] = Path.Combine(logFolder, $"{BrandManager.BrandConsole}-AuditTrail.log");
log4net.GlobalContext.Properties["NETWORK_TRACE"] = Path.Combine(logFolder, $"{BrandManager.BrandConsole}-NetworkTrace.log");

log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(Assembly.GetCallingAssembly().Location + ".config"));
log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
Expand All @@ -145,7 +145,7 @@ static Program()
public static void Main(string[] args)
{
string appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value;
_pipePath = string.Format(PIPE_PATH_PATTERN, BrandManager.BrandConsoleNoSpace, Process.GetCurrentProcess().SessionId, Environment.UserName, appGuid);
_pipePath = string.Format(PIPE_PATH_PATTERN, BrandManager.BrandConsole, Process.GetCurrentProcess().SessionId, Environment.UserName, appGuid);

if (NamedPipes.Pipe.ExistsPipe(_pipePath))
{
Expand Down
2 changes: 1 addition & 1 deletion XenAdmin/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ private static void UpgradeFromPreviousInstallation()
Version previousVersion = null;
Version currentVersion = Program.Version;

var directories = companyFolder.GetDirectories($"{BrandManager.BrandConsoleNoSpace}*");
var directories = companyFolder.GetDirectories($"{BrandManager.BrandConsole}*");

foreach (var dir in directories)
{
Expand Down
2 changes: 1 addition & 1 deletion XenAdmin/XenAdmin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>XenAdmin</RootNamespace>
<AssemblyName>[XenCenter_No_Space]</AssemblyName>
<AssemblyName>[XenCenter]</AssemblyName>
<ApplicationIcon>..\Branding\Images\AppIcon.ico</ApplicationIcon>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
Expand Down
2 changes: 1 addition & 1 deletion XenAdminTests/CodeTests/AssemblyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace XenAdminTests.CodeTests
[TestFixture, Category(TestCategories.Unit)]
public class AssemblyTests
{
private static readonly string MainAssemblyName = BrandManager.BrandConsoleNoSpace;
private static readonly string MainAssemblyName = BrandManager.BrandConsole;

public class TestDataClass
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected override void Run()

private void CopyClientLogs()
{
string logDestination = string.Format("{0}\\{1}-{2}.log", filePath, timeString, BrandManager.BrandConsoleNoSpace);
string logDestination = string.Format("{0}\\{1}-{2}.log", filePath, timeString, BrandManager.BrandConsole);
if (includeClientLogs)
{
string logPath = XenAdminConfigManager.Provider.GetLogFile();
Expand Down
3 changes: 0 additions & 3 deletions XenModel/BrandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ static BrandManager()
var customBranding = (CustomBrandingAttribute)assembly.GetCustomAttribute(typeof(CustomBrandingAttribute));

BrandConsole = customBranding.BrandConsole;
BrandConsoleNoSpace = customBranding.BrandConsoleNoSpace;
CompanyNameShort = customBranding.CompanyNameShort;
ProductBrand = customBranding.ProductBrand;
ProductVersionPost82 = customBranding.ProductVersionText;
Expand All @@ -66,8 +65,6 @@ static BrandManager()

public static readonly string BrandConsole;

public static readonly string BrandConsoleNoSpace;

public static readonly string Cis = Get("CIS");

public static readonly string CompanyNameLegacy = Get("COMPANY_NAME_LEGACY");
Expand Down
10 changes: 3 additions & 7 deletions XenModel/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
using System.Runtime.InteropServices;
using XenAdmin.Properties;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

Expand All @@ -43,8 +43,8 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("[XenCenter]")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

Expand All @@ -55,7 +55,6 @@

[assembly: CustomBranding(
"[XenCenter]",
"[XenCenter_No_Space]",
"[Vendor]",
"[XenServerProduct]",
"[XenServer version]",
Expand All @@ -77,7 +76,6 @@ public class CustomBrandingAttribute : Attribute
{
public CustomBrandingAttribute(
string brandConsole,
string brandConsoleNoSpace,
string companyNameShort,
string productBrand,
string productVersionText,
Expand All @@ -94,7 +92,6 @@ string yumRepoNormalSource
)
{
BrandConsole = brandConsole;
BrandConsoleNoSpace = brandConsoleNoSpace;
CompanyNameShort = companyNameShort;
ProductBrand = productBrand;
ProductVersionText = productVersionText;
Expand All @@ -111,7 +108,6 @@ string yumRepoNormalSource
}

public string BrandConsole { get; }
public string BrandConsoleNoSpace { get; }
public string CompanyNameShort { get; }
public string ProductBrand { get; }
public string ProductVersionText { get; }
Expand Down
Loading

0 comments on commit dd98fe6

Please sign in to comment.