From e59b2b440cd63fff406fa93e648b86d390475546 Mon Sep 17 00:00:00 2001 From: Recolic K <bensl@microsoft.com> Date: Fri, 4 Jun 2021 17:06:54 +0800 Subject: [PATCH] cleanup --- .gitignore | 1 + .gitlab-ci.yml | 2 +- utility.hpp | 9 +- workflows/GoLocalSE-EOP.cc | 146 ----------------- workflows/golocal.cc | 150 ++++++++++++++++++ .../{ => old_samples}/E2EPOC-BuildPortal.cc | 0 .../E2EPOC-IC3TeamsVirtualWorkflow.cc | 0 workflows/{another.cc => test.cc} | 0 workflows/wds-go.cc | 34 ++++ 9 files changed, 194 insertions(+), 148 deletions(-) delete mode 100644 workflows/GoLocalSE-EOP.cc create mode 100644 workflows/golocal.cc rename workflows/{ => old_samples}/E2EPOC-BuildPortal.cc (100%) rename workflows/{ => old_samples}/E2EPOC-IC3TeamsVirtualWorkflow.cc (100%) rename workflows/{another.cc => test.cc} (100%) create mode 100644 workflows/wds-go.cc diff --git a/.gitignore b/.gitignore index 9448dfd..ce7949a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.out *.xaml *.o +.ccls-cache diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3fac75c..ce4e73c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,6 @@ before_script: - cd rlib && make install && cd .. build: - script: g++ workflows/another.cc -std=c++17 -o a.bin -I .. && ./a.bin + script: g++ workflows/test.cc -std=c++17 -o a.bin -I .. && ./a.bin diff --git a/utility.hpp b/utility.hpp index da1f935..8d1e13a 100644 --- a/utility.hpp +++ b/utility.hpp @@ -30,6 +30,13 @@ inline static auto HtmlEscapeString(rlib::string s) { return s.replace("&", "&").replace("<", "<").replace(">", ">"); } +struct CSharpExpr { + std::string exprText; + auto unescapeThisExprInQuotedCSharpString() { + return "\"+" + exprText + "+\""; + } +}; + } -#endif \ No newline at end of file +#endif diff --git a/workflows/GoLocalSE-EOP.cc b/workflows/GoLocalSE-EOP.cc deleted file mode 100644 index bea3a66..0000000 --- a/workflows/GoLocalSE-EOP.cc +++ /dev/null @@ -1,146 +0,0 @@ -// Remove this file on final merge. - -#include <cis-workflow-gen/quick-include.hpp> - -int main() { - #define A_2(task, entityName) ManualOperation("Task notice: "#task, "Hey, man. You need to build " #task, teamid, #entityName) - #define A_1(arg1) A_2(arg1, ) - #define A_proxy(x, Arg1, Arg2, FUNC, ...) FUNC - #define A(...) A_proxy(, ##__VA_ARGS__, A_2(__VA_ARGS__), A_1(__VA_ARGS__)) - #define AV(task, entityName) Noop("Virtual task: "#task, #entityName) - - auto teamid = "TODO.EOPTeamId"; - auto seqBody = - /*148*/ A(EOPServerDock) >> - /*149*/ A(EOPServerRTEG) >> - /*151*/ A(ConfigCheckin_And_ImportInventory) >> - /*152*/ A(EOPNetworkPrep) >> - /*153*/ A(RackElevation_And_ServerImport) >> - /*154*/ A(BurninPayload) >> - /*156*/ A(NewForestCreation) >> - /*157*/ A(GLSSetup_And_CNAMECreation) >> - /*158*/ A(StatefulFlattening) >> - /*159*/ A(DBDeployment) >> - /*160*/ A(StatelessDeployment, EntityTodo) >> - /*162*/ A(ForwardSync) >> - /*163*/ A(GTMGLSDNSConfigurations) >> - /*164*/ A(TestTenantCreation) >> - /*165*/ A(ValidationandComponentSignoff, EntityTodo) >> - /*166*/ A(WorkloadIntegrationwithEXO) >> - /*167*/ AV(EOPEngineeringReadinessSweden, EntityTodo); - - auto flowEop = - /*147*/ A(TAMAward) | - seqBody; - - println(to_file("GoLocalSE_EOPWorkflow.xaml"), flowEop.generateXaml("FleetAGC.Workflows.GoLocalSE_EOP")); - - teamid = "TODO.SPOTeamId"; - auto flowSpo = - /*114*/ A(TAMAward) | ( - /*115*/ A(SPOServer_And_NetworkDock) >> - /*116*/ A(SPOServer_And_NetworkRTEG) >> - /*119*/ A(ServerValidationNetwork_And_Hardware) >> - /*120*/ A(ServerImaging) >> - /*121*/ A(AzureSubscription_And_SubmitandValidateConsumption) >> - /*123*/ A(SPOFarmDeployments, EntityTodo_46) >> ( - /*124*/ A(SPOPostDeploymentValidation) | ( - /*126*/ A(MicroservicesDeployment, EntityTodo_487278) >> - /*127*/ A(MicroservicesPostDeploymentValidation) - ) >> - /*128*/ AV(ServiceReadiness, EntityTodo_108) >> - /*129*/ AV(WorkloadIntegration, EntityTodo_176_185) - ) - ); - - println(to_file("GoLocalSE_SPOWorkflow.xaml"), flowSpo.generateXaml("FleetAGC.Workflows.GoLocalSE_SPO")); - - teamid = "TODO.EXOTeamId"; - auto flowExo = - /*86*/ A(Backends_TAMAward) | - /*96*/ A(CAFE_Substrate_TAMAward) | - ( // begin the huge body - ( // dep group of 100 - /*8384*/ (A(ActiveDirectoryDock) >> A(ActiveDirectoryRteg)) | - /*8788*/ (A(BackEndsDock) >> A(BackEndsRteg)) | - /*9091*/ (A(ManagementDock) >> A(ManagementRteg)) | - /*9394*/ (A(CafeDock) >> A(CafeRteg)) | - /*9798*/ (A(SubstrateDock) >> A(SubstrateRteg)) - ) >> - /*100*/ A(DiscoveryADBackEndCafeSubstrateAllocationofServersIPsandRoles) >> - /*101*/ AV(ApplicationDeployment, EntityTodo_697744) >> - /*102*/ A(ResourceForestDeployment) >> - /*103*/ A(Backend_And_FrontEndDeployment) >> - /*104*/ A(CapacityUnitPrepDAG_And_CAFE) >> - /*106*/ A(ComponentValidation, EntityTodo_157) >> - /*107*/ A(Bugfix_And_Hotfixes) >> - /*108*/ A(MonitoringSetup) >> - /*109*/ A(WorkloadIntegration, EntityTodo_176_185) >> - /*110*/ AV(EXOEngineeringReadinessSweden, EntityTodo_nothing) - ); // end the huge body. - - println(to_file("GoLocalSE_EXOWorkflow.xaml"), flowExo.generateXaml("FleetAGC.Workflows.GoLocalSE_EXO")); - - teamid = "TODO.FastSearchTeamId"; - auto flowFS = - /*134*/ A(RTEGAzureResources, EntityTodo_48) | - /*135136*/ (A(Dock, EntityTodo_115) >> A(RTEG)) >> - /*138*/ AV(InfrastuctureDeployment, ) >> - ( - /*139*/ A(ServerValidationNetwork_And_Hardware) >> - /*140*/ A(ServerImaging) >> - /*141*/ A(AzureSubscription_And_SubmitandValidateConsumption) - ) | - /*142*/ A(FASTDeployment); - // Node143 depends on nothing in this workflow. I don't know where to put it. Wait for the email reply, I believe it depends on 141+142. - /*143*/ AV(FASTEngineeringReadinessSweden, EntityTodo_143); - - println(to_file("GoLocalSE_FastSearchWorkflow.xaml"), flowFS.generateXaml("FleetAGC.Workflows.GoLocalSE_FastSearch")); - - teamid = "TODO.WacTeamId"; - auto flowWac = - /*171*/ A(RTEGAzureResources, EntityTodo_47_73) >> - /*173*/ A(InfrastructureDeployment) >> - /*174*/ A(ServiceDeployment) >> - /*175*/ AV(ServiceReadiness, ) >> - /*176*/ AV(WACEngineeringReadinessSweden, ); - - println(to_file("GoLocalSE_WACWorkflow.xaml"), flowWac.generateXaml("FleetAGC.Workflows.GoLocalSE_WAC")); - - teamid = "TODO.OCSTeamId"; - auto flowOcs = - /*180*/ A(RtegAzureResources) >> - /*182*/ A(infrastuctureDeployment) >> - /*183*/ A(ServiceDeployment) >> - /*184*/ AV(ServiceReadiness, ) >> - /*185*/ AV(OCSEngineeringReadinessSweden, ); - - println(to_file("GoLocalSE_OCSWorkflow.xaml"), flowOcs.generateXaml("FleetAGC.Workflows.GoLocalSE_OCS")); - - teamid = "TODO.TeamsTeamId"; - auto flowTeams = - ( // first half begin - /*188*/ AV(TeamsRTEG, ) >> - /*189*/ A(PreRegCompute) | - /*190*/ A(RTEGAzureResources) - ) | ( // second half begin - /*192*/ A(ServicesDeployment) >> - /*193*/ A(TestingandStamping) >> - /*194*/ A(TeamsEngineeringReadinessSweden, EntityTodo_167_110) - ); - - println(to_file("GoLocalSE_TeamsWorkflow.xaml"), flowTeams.generateXaml("FleetAGC.Workflows.GoLocalSE_Teams")); - - teamid = "TODO.CountryLaunchTeamId"; - auto flowCL = - // I believe that, all of them should be Virtual Activity... (Use Noop) - /*196*/ AV(SwedenGAWorkloadAvailability, EntityTodo_manymanydep) >> - /*197*/ A(SwedenGABakePeriod) >> - /*198*/ A(SwedenGAMarketingRelease); - - println(to_file("GoLocalSE_CountryLaunchWorkflow.xaml"), flowCL.generateXaml("FleetAGC.Workflows.GoLocalSE_CountryLaunch")); - - - -} - diff --git a/workflows/golocal.cc b/workflows/golocal.cc new file mode 100644 index 0000000..6620ff3 --- /dev/null +++ b/workflows/golocal.cc @@ -0,0 +1,150 @@ +// Remove this file on final merge. + +#include <cis-workflow-gen/quick-include.hpp> + +int main() { + #define GEN_TASKNAME(taskname) (std::string(task_parent_note) + "." + taskname) + #define A_2(task, entityName) ManualOperation("Task notice: " + GEN_TASKNAME(#task), "Hey, man. You need to build " +GEN_TASKNAME(#task)+ ". Please resolve this ICM incident ONLY IF you have finished this task. ", teamid, #entityName) + #define A_1(arg1) A_2(arg1, ) + #define A_proxy(x, Arg1, Arg2, FUNC, ...) FUNC + #define A(...) A_proxy(, ##__VA_ARGS__, A_2(__VA_ARGS__), A_1(__VA_ARGS__)) + #define AV(task, entityName) Noop("Virtual task: "#task, #entityName) + + auto task_parent_note = "EOP"; + auto teamid = "GCBuild"; + + auto eopBody = + /*148*/ A(EOPServerDock) >> + /*149*/ A(EOPServerRTEG) >> + /*151*/ A(ConfigCheckin_And_ImportInventory) >> + /*152*/ A(EOPNetworkPrep) >> + /*153*/ A(RackElevation_And_ServerImport) >> + /*154*/ A(BurninPayload) >> + /*156*/ A(NewForestCreation) >> + /*157*/ A(GLSSetup_And_CNAMECreation, M365GoLocal.EOP.GLSAndCNAME) >> + /*158*/ A(StatefulFlattening) >> + /*159*/ A(DBDeployment) >> + /*160*/ A(StatelessDeployment, M365GoLocal.EOP.StatelessDeployment) >> + /*162*/ A(ForwardSync) >> + /*163*/ A(GTMGLSDNSConfigurations) >> + /*164*/ A(TestTenantCreation) >> + /*165*/ A(ValidationandComponentSignoff, M365GoLocal.EOP.Validation) >> + /*166*/ A(WorkloadIntegrationwithEXO) >> + /*167*/ AV(EOPEngineeringReadinessSweden, M365GoLocal.EOP.EngineeringReadiness); + + auto flowEop = + /*147*/ A(TAMAward) | + eopBody; + + println(to_file("EOPWorkflow.xaml"), flowEop.generateXaml("Microsoft.Office.FleetAGC.Workflows.SwedenBuildout.EOP")); + + task_parent_note = "SPO"; + auto flowSpo = + /*114*/ A(TAMAward) | ( + /*115*/ A(SPOServer_And_NetworkDock, M365GoLocal.SPO.Dock) >> + /*116*/ A(SPOServer_And_NetworkRTEG) >> + /*119*/ A(ServerValidationNetwork_And_Hardware) >> + /*120*/ A(ServerImaging) >> + /*121*/ A(AzureSubscription_And_SubmitandValidateConsumption) >> + /*123*/ A(SPOFarmDeployments, M365GoLocal.SPO.FarmDeployment) >> ( + /*124*/ A(SPOPostDeploymentValidation) | ( + /*126*/ A(MicroservicesDeployment, M365GoLocal.SPO.MicroServices) >> + /*127*/ A(MicroservicesPostDeploymentValidation) + ) >> + /*128*/ AV(ServiceReadiness, M365GoLocal.SPO.ServiceReadiness) >> + /*129*/ AV(WorkloadIntegration, M365GoLocal.SPO.WorkloadIntegration) >> + /*130*/ AV(SPOEngineeringReadinessSweden, M365GoLocal.SPO.EngineeringReadiness) + ) + ); + + println(to_file("SPOWorkflow.xaml"), flowSpo.generateXaml("Microsoft.Office.FleetAGC.Workflows.SwedenBuildout.SPO")); + + task_parent_note = "EXO"; + auto flowExo = + /*86*/ A(Backends_TAMAward) | + /*96*/ A(CAFE_Substrate_TAMAward) | + ( // begin the huge body + ( // dep group of 100 + /*8384*/ (A(ActiveDirectoryDock) >> A(ActiveDirectoryRteg, M365GoLocal.EXO.ActiveDirectoryRteg)) | + /*8788*/ (A(BackEndsDock) >> A(BackEndsRteg)) | + /*9091*/ (A(ManagementDock) >> A(ManagementRteg)) | + /*9394*/ (A(CafeDock) >> A(CafeRteg)) | + /*9798*/ (A(SubstrateDock) >> A(SubstrateRteg)) + ) >> + /*100*/ A(DiscoveryADBackEndCafeSubstrateAllocationofServersIPsandRoles, M365GoLocal.EXO.IPAllocationDiscovery) >> + /*101*/ AV(ApplicationDeployment, M365GoLocal.EXO.ApplicationDeployment) >> + /*102*/ A(ResourceForestDeployment) >> + /*103*/ A(Backend_And_FrontEndDeployment) >> + /*104*/ A(CapacityUnitPrepDAG_And_CAFE, M365GoLocal.EXO.CapacityUnitPrep) >> + /*106*/ A(ComponentValidation, M365GoLocal.EXO.ServiceReadiness) >> + /*107*/ A(Bugfix_And_Hotfixes) >> + /*108*/ A(MonitoringSetup, M365GoLocal.EXO.MonitoringSetup) >> + /*109*/ A(WorkloadIntegration, M365GoLocal.EXO.WorkloadIntegration) >> + /*110*/ AV(EXOEngineeringReadinessSweden, M365GoLocal.EXO.EngineeringReadiness) + ); // end the huge body. + + println(to_file("EXOWorkflow.xaml"), flowExo.generateXaml("Microsoft.Office.FleetAGC.Workflows.SwedenBuildout.EXO")); + + task_parent_note = "FastSearch"; + auto flowFS = + /*134*/ A(RTEGAzureResources, M365GoLocal.FastSearch.AzureResources) | + /*135136*/ (A(Dock, M365GoLocal.FastSearch.Dock) >> A(RTEG)) >> + /*138*/ AV(InfrastuctureDeployment, ) >> + ( + /*139*/ A(ServerValidationNetwork_And_Hardware) >> + /*140*/ A(ServerImaging) >> + /*141*/ A(AzureSubscription_And_SubmitandValidateConsumption) + ) | + /*142*/ A(FASTDeployment); + // Node143 depends on nothing in this workflow. I don't know where to put it. Wait for the email reply, I believe it depends on 141+142. + /*143*/ AV(FASTEngineeringReadinessSweden, M365GoLocal.FastSearch.EngineeringReadiness); + + println(to_file("FastSearchWorkflow.xaml"), flowFS.generateXaml("Microsoft.Office.FleetAGC.Workflows.SwedenBuildout.FastSearch")); + + task_parent_note = "Wac"; + auto flowWac = + /*171*/ A(RTEGAzureResources, M365GoLocal.WAC.AzureResources) >> + /*173*/ A(InfrastructureDeployment) >> + /*174*/ A(ServiceDeployment) >> + /*175*/ AV(ServiceReadiness, ) >> + /*176*/ AV(WACEngineeringReadinessSweden, M365GoLocal.WAC.EngineeringReadiness); + + println(to_file("WACWorkflow.xaml"), flowWac.generateXaml("Microsoft.Office.FleetAGC.Workflows.SwedenBuildout.WAC")); + + task_parent_note = "OCS"; + auto flowOcs = + /*180*/ A(RtegAzureResources, M365GoLocal.OCS.AzureResources) >> + /*182*/ A(infrastuctureDeployment) >> + /*183*/ A(ServiceDeployment) >> + /*184*/ AV(ServiceReadiness, ) >> + /*185*/ AV(OCSEngineeringReadinessSweden, M365GoLocal.OCS.EngineeringReadiness); + + println(to_file("OCSWorkflow.xaml"), flowOcs.generateXaml("Microsoft.Office.FleetAGC.Workflows.SwedenBuildout.OCS")); + + task_parent_note = "Teams"; + auto flowTeams = + ( // first half begin + /*188*/ AV(TeamsRTEG, ) >> + /*189*/ A(PreRegCompute) | + /*190*/ A(RTEGAzureResources, M365GoLocal.Teams.AzureResources) + ) | ( // second half begin + /*192*/ A(ServicesDeployment) >> + /*193*/ A(TestingandStamping) >> + /*194*/ A(TeamsEngineeringReadinessSweden, M365GoLocal.Teams.EngineeringReadiness) + ); + + println(to_file("TeamsWorkflow.xaml"), flowTeams.generateXaml("Microsoft.Office.FleetAGC.Workflows.SwedenBuildout.Teams")); + + task_parent_note = "CountryLaunch"; + auto flowCL = + // I believe that, all of them should be Virtual Activity... (Use Noop) + /*196*/ AV(SwedenGAWorkloadAvailability, M365GoLocal.CountryLaunch.GAWorkloadAvailability) >> + /*197*/ A(SwedenGABakePeriod) >> + /*198*/ A(SwedenGAMarketingRelease); + + println(to_file("CountryLaunchWorkflow.xaml"), flowCL.generateXaml("Microsoft.Office.FleetAGC.Workflows.SwedenBuildout.CountryLaunch")); + + + +} + diff --git a/workflows/E2EPOC-BuildPortal.cc b/workflows/old_samples/E2EPOC-BuildPortal.cc similarity index 100% rename from workflows/E2EPOC-BuildPortal.cc rename to workflows/old_samples/E2EPOC-BuildPortal.cc diff --git a/workflows/E2EPOC-IC3TeamsVirtualWorkflow.cc b/workflows/old_samples/E2EPOC-IC3TeamsVirtualWorkflow.cc similarity index 100% rename from workflows/E2EPOC-IC3TeamsVirtualWorkflow.cc rename to workflows/old_samples/E2EPOC-IC3TeamsVirtualWorkflow.cc diff --git a/workflows/another.cc b/workflows/test.cc similarity index 100% rename from workflows/another.cc rename to workflows/test.cc diff --git a/workflows/wds-go.cc b/workflows/wds-go.cc new file mode 100644 index 0000000..b6dafff --- /dev/null +++ b/workflows/wds-go.cc @@ -0,0 +1,34 @@ +#include <cis-workflow-gen/quick-include.hpp> + +int main() { + auto flow = + Activity("CreateResGrp", "FleetAGC.Activities.InitResourceGroupActivity") + .addInputSetting("ResourceGroup", "WdsTest") + >> Activity("CreateVM", "FleetAGC.Activities.CreateAzureResourceActivity") + .addInputSetting("ResourceGroup", "WdsTest") + .addInputSetting("DeploymentName", "DeployVM") + .addInputSetting("TemplateFilePath", "Resources/ArmTemplates/VM/Template_winserver2016.json") + .addInputSetting("ParameterFilePath", "Resources/ArmTemplates/VM/Parameters_WDS.json") + >> Activity("WaitForCreateVM", "FleetAGC.Activities.QueryAzureVMsActivity") + .addInputSetting("ResourceGroup", "WDSSeedingServer") + >> Activity("InstallWdsServices", "FleetAGC.Activities.RemotePSActivity") + .addInputSetting("PublicIP", "\" + GlobalSettings[\"GlobalAdminPublicIPAddress\"] + \"") + .addInputSetting("UserNameKey", "DC1AdminUserName") + .addInputSetting("PasswordKey", "DC1AdminPassword") + .addInputSetting("ScriptPath", "Resources/PSScript/WDSGo.ps1") + .addInputSetting("RequiresSAS","true") + >> Activity("WaitForWdsInstallFinish", "FleetAGC.Activities.RemotePSActivity") + .addInputSetting("PublicIP", "\" + GlobalSettings[\"GlobalAdminPublicIPAddress\"] + \"") + .addInputSetting("UserNameKey", "DC1AdminUserName") + .addInputSetting("PasswordKey", "DC1AdminPassword") + .addInputSetting("RetryTime", "2000") + .addInputSetting("RetryInterval", "1") + .addInputSetting("ScriptPath", "Resources/PSScript/WDSGo_CheckSuccess.ps1") + ; + + println(to_file("DeployWdsTestServerWorkflow.xaml"), flow.generateXaml("FleetAGC.Workflows.DeployWdsTestServerWorkflow")); +} + +// TODO: WDS server requires more UDP port to be opened. But we don't know the client's ip address. +// So, would security team be happy if we open UDP 67 and 69 to public? + -- GitLab