Skip to content

Commit

Permalink
Merge pull request #11 from michaelmsonne/Add-toolToUnzipSingleBackup
Browse files Browse the repository at this point in the history
### Added
- Added a new tool (**AzureDevOpsBackupUnzipTool**) to the application, there let you unzip backups from .zip files based on the backup folder with the metadata files (.json), so the backups can be restored for a single project to save disk space vs unzipping all based on how many projects you have to backup, if you only need to restore a single project and not want to unzip the whole backup for all projects
- An option to not attach the logfile to the email report with argument: '**--noattatchlog**'
- Added support to send email report to multiple recipients with argument: '**--to**' - separated by comma

### Changed
- Changed default install folder name (reflects only the installer)
- Changed logfile location in the **'.\Log'** folder - now in a subfolder the the 2 tools to it not being mixed and supports for cleanup:
    - **AzureDevOpsBackupTool.exe**: **'.\Logs\Backup'**
    - **AzureDevOpsBackupUnzipTool.exe**: **'.\Logs\Unzip tool'**
    
### Fixed
- A lot documentation and help text overall fixed/added

Dump v. to 1.1.0.0
  • Loading branch information
michaelmsonne authored Aug 10, 2024
2 parents 7630b16 + aa158f0 commit ae4e1fa
Show file tree
Hide file tree
Showing 26 changed files with 1,119 additions and 143 deletions.
66 changes: 44 additions & 22 deletions AdvancedInstaller/AzureDevOpsBackup Installer.aip

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions AzureDevOpsBackup/AzureDevOpsBackup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@
<None Include="app.manifest" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AzureDevOpsBackupUnzipTool\AzureDevOpsBackupUnzipTool.csproj">
<Project>{050b25b3-9a27-44c2-a793-59357cfbcdc3}</Project>
<Name>AzureDevOpsBackupUnzipTool</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Release (
Expand Down
10 changes: 10 additions & 0 deletions AzureDevOpsBackup/AzureDevOpsBackup.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Scripts\RenameOutputRelease.ps1 = Scripts\RenameOutputRelease.ps1
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureDevOpsBackupUnzipTool", "..\AzureDevOpsBackupUnzipTool\AzureDevOpsBackupUnzipTool.csproj", "{050B25B3-9A27-44C2-A793-59357CFBCDC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Any CPU = All|Any CPU
Expand All @@ -39,6 +41,14 @@ Global
{24DA63B0-77D2-4861-8DC1-C47EB93E88EF}.DefaultBuild|Any CPU.Build.0 = DefaultBuild
{24DA63B0-77D2-4861-8DC1-C47EB93E88EF}.Release|Any CPU.ActiveCfg = DefaultBuild
{24DA63B0-77D2-4861-8DC1-C47EB93E88EF}.Release|Any CPU.Build.0 = DefaultBuild
{050B25B3-9A27-44C2-A793-59357CFBCDC3}.All|Any CPU.ActiveCfg = Debug|Any CPU
{050B25B3-9A27-44C2-A793-59357CFBCDC3}.All|Any CPU.Build.0 = Debug|Any CPU
{050B25B3-9A27-44C2-A793-59357CFBCDC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{050B25B3-9A27-44C2-A793-59357CFBCDC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{050B25B3-9A27-44C2-A793-59357CFBCDC3}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU
{050B25B3-9A27-44C2-A793-59357CFBCDC3}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU
{050B25B3-9A27-44C2-A793-59357CFBCDC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{050B25B3-9A27-44C2-A793-59357CFBCDC3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 6 additions & 2 deletions AzureDevOpsBackup/Class/DisplayHelp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public static void DisplayGuide()
Console.WriteLine("\t--server: IP address or DNS name of the SMTP server");
Console.WriteLine("\t--port: The port for the SMTP server");
Console.WriteLine("\t--from: The email address the report is send from");
Console.WriteLine("\t--toemail: The email address the report is send to\n");
Console.WriteLine("\t--to: The email address the report is send to - support multiple recipients with");
Console.WriteLine("\t\t\t argument separated by comma");
Console.WriteLine(" Optional:");
Console.WriteLine("\t--tokenfile <token>: Save a token to access the API in Azure DevOps to an encrypted token.bin file");
Console.WriteLine("\t\t\t (use this before using the '--token token.bin' argument!)");
Expand All @@ -36,6 +37,7 @@ public static void DisplayGuide()
Console.WriteLine("\t\t\t be deleted (default is 30 dayes) (optional)");
Console.WriteLine("\t--simpelreport: If set the email report layout there is send is simple, if not set it use the default");
Console.WriteLine("\t\t\t report layout");
Console.WriteLine("\t--noattatchlog: Set the email report to not attach the logfile in the mail report sent");
Console.WriteLine("\t--priority: Set the email report priority to other then default (normal)");
Console.WriteLine("\t high: Set the email report priority to 'high'");
Console.WriteLine("\t low: Set the email report priority to 'low'");
Expand All @@ -57,7 +59,9 @@ public static void DisplayGuide()
Console.WriteLine($"\t{Globals._currentExeFileName} --token XXX... --org OrgName --backup C:\\Backup --server smtp.domain.local");
Console.WriteLine("\t--port 25 --from [email protected] --to [email protected] --unzip --simpelreport --priority high\n");
Console.WriteLine($"\t{Globals._currentExeFileName} --token token.bin --org OrgName --backup C:\\Backup --server smtp.domain.local");
Console.WriteLine("\t--port 25 --from [email protected] --to [email protected] --unzip --simpelreport --priority low");
Console.WriteLine("\t--port 25 --from [email protected] --to [email protected] --unzip --simpelreport --priority low\n");
Console.WriteLine($"\t{Globals._currentExeFileName} --token token.bin --org OrgName --backup C:\\Backup --server smtp.domain.local");
Console.WriteLine("\t--port 25 --from [email protected] --to [email protected],[email protected] --unzip --noattatchlog");
Console.WriteLine();
Console.WriteLine("Output:");
Console.WriteLine("\tA timestamped folder containing the backup will be created within this directory unless --backup");
Expand Down
2 changes: 1 addition & 1 deletion AzureDevOpsBackup/Class/Files.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static string LogFilePath
get
{
// Root folder for log files
var logfilePathvar = ProgramDataFilePath + @"\Log";
var logfilePathvar = ProgramDataFilePath + @"\Log\Backups";
return logfilePathvar;
}
}
Expand Down
59 changes: 30 additions & 29 deletions AzureDevOpsBackup/Class/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ namespace AzureDevOpsBackup.Class
{
public static class Globals
{
public static string _currentExeFileName;
public static int _errors;
public static string _vData;
public static string _companyName;
public static string _orgName;
public static string _startTime;
public static string _endTime;
public static int _totalFilesIsDeletedAfterUnZipped;
public static int _numZip;
public static int _numJson;
public static bool _checkForLeftoverFilesAfterCleanup;
public static bool _deletedFilesAfterUnzip;
public static string AppName;
public static string _copyrightData;
public static int _totalBackupsIsDeleted;
public static string _fileAttachedIneMailReport;
public static MailPriority EmailPriority = MailPriority.Normal;
public static int _currentBackupsInBackupFolderCount;
public static string _currentExeFileName; // The name of the current executable file
public static int _errors; // The number of errors that have occurred
public static string _vData; // The version data of the current executable file
public static string _companyName; // The company name of the current executable file
public static string _orgName; // The organization name of Azure DevOps to backup
public static string _startTime; // The time the backup started
public static string _endTime; // The time the backup ended
public static int _totalFilesIsDeletedAfterUnZipped; // The total number of files deleted after unzipping
public static int _numZip; // The number of zip files
public static int _numJson; // The number of json files
public static bool _checkForLeftoverFilesAfterCleanup; // Check for leftover files after cleanup
public static bool _deletedFilesAfterUnzip; // Delete files after unzipping
public static string AppName; // The name of the application
public static string _copyrightData; // The copyright data of the application
public static int _totalBackupsIsDeleted; // The total number of backups deleted
public static string _fileAttachedIneMailReport; // The file attached in the email report (name)
public static MailPriority EmailPriority = MailPriority.Normal; // The priority of the email report (default is normal)
public static int _currentBackupsInBackupFolderCount;
public static int _oldLogFilesToDeleteCount;
public static bool _oldLogfilesToDelete;
public const string APIversion = "api-version=7.0"; // https://learn.microsoft.com/en-us/rest/api/azure/devops/
public static string _backupFolder;
public static string _sanitizedbackupFolder;
public static string _dateOfToday;
public const string APIversion = "api-version=7.0"; // See more at: https://learn.microsoft.com/en-us/rest/api/azure/devops/ for information on API versions
public static string _backupFolder; // The folder to backup to (default is the current directory)
public static string _sanitizedbackupFolder; // The sanitized folder to backup to (default is the current directory)
public static string _dateOfToday; // The date of today
public static string _repoCountStatusText;
public static string _totalFilesIsBackupUnZippedStatusText;
public static string _totalBlobFilesIsBackupStatusText;
Expand All @@ -39,12 +39,13 @@ public static class Globals
public static string _isOutputFolderContainFilesStatusText;
public static string _repoItemsCountStatusText;
public static string _isDaysToKeepNotDefaultStatusText;
public static int _projectCount;
public static int _totalFilesIsBackupUnZipped;
public static int _totalBlobFilesIsBackup;
public static int _totalTreeFilesIsBackup;
public static int _repoItemsCount;
public static int _repoCount;
public static string _emailStatusMessage;
public static int _projectCount; // The number of projects in the organization to backup
public static int _totalFilesIsBackupUnZipped; // The total number of files in the backups unzipped
public static int _totalBlobFilesIsBackup; // The total number of blob files in the backups
public static int _totalTreeFilesIsBackup; // The total number of tree files in the backups
public static int _repoItemsCount; // The number of items in the repository
public static int _repoCount; // The number of repositories in the organization
public static string _emailStatusMessage; // The status message of the email
public static bool _noAttatchLog; // TODO
}
}
Loading

0 comments on commit ae4e1fa

Please sign in to comment.