Skip to content

Commit

Permalink
Cross platform changes of deploy engine (#111)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Sabrina Juarez Garcia <sabrina.juarez@globant.com>
  • Loading branch information
sjuarezgx and Sabrina Juarez Garcia authored Dec 15, 2024
1 parent d7c4f1a commit 26be34e
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/AWSECS/deploy.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<GX_PROGRAM_DIR>..\..</GX_PROGRAM_DIR>
<POWERSHELL_PATH>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</POWERSHELL_PATH>
<DeployDirectory>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)\..\..'))</DeployDirectory>
<DeployDirectory>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)/../..'))</DeployDirectory>

<TIMESTAMP_APPLICATION_VERSION>$([System.DateTime]::Now.ToString("yyyyMMddHHmm"))</TIMESTAMP_APPLICATION_VERSION>
<EFFECTIVE_TAG_NAME>$(AWSECS_DOCKER_TAG_NAME).$(TIMESTAMP_APPLICATION_VERSION)</EFFECTIVE_TAG_NAME>
Expand Down
2 changes: 1 addition & 1 deletion src/AWSLambdaFunctions/createpackage.msbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy" ToolsVersion="4.0">
<PropertyGroup>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)\..\..\..\..\web\$(ProjectName).gxdproj'))</GXDeployFileProject>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)/../../../../web/$(ProjectName).gxdproj'))</GXDeployFileProject>
<ApplicationType Condition="'$(AWSLAMBDA_FUNCTION_TRIGGER_TYPE)' == 'http'">Web</ApplicationType>
<ApplicationType Condition="'$(AWSLAMBDA_FUNCTION_TRIGGER_TYPE)' != 'http'">Function</ApplicationType>
<LambdaSourceDir>$(DeployFullPath)</LambdaSourceDir>
Expand Down
4 changes: 2 additions & 2 deletions src/AWSLambdaFunctions/deploy.msbuild
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy" ToolsVersion="4.0">
<PropertyGroup>
<PackageSource>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)\..\$(APPLICATION_NAME)'))</PackageSource>
<PackageSource>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)/../$(APPLICATION_NAME)'))</PackageSource>
<RoleARN>$(AWSLAMBDA_ROLE_NAME)</RoleARN>
<IAMPolicyJSONFile>..\AWSServerless\template\aws-iam-policy.json</IAMPolicyJSONFile>
<S3BucketName>gx-deploy-$(AWSLAMBDA_DEFAULT_REGION)-$(AWSLAMBDA_ACCESS_KEY_ID)$(AWSLAMBDA_PROFILE_NAME)</S3BucketName>
<PackageName>$(JAVA_PACKAGE_NAME)</PackageName>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)\..\..\..\..\web\$(ProjectName).gxdproj'))</GXDeployFileProject>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)/../../../../web/$(ProjectName).gxdproj'))</GXDeployFileProject>
<LambdaOutputFile>$(DEPLOY_PATH)\AWS_Lambda_Package.zip</LambdaOutputFile>
<LambdaJavaNamespace>com.genexus.cloud.serverless.aws.handler</LambdaJavaNamespace>
<LambdaJavaHandlerName>handleRequest</LambdaJavaHandlerName>
Expand Down
2 changes: 1 addition & 1 deletion src/AWSServerless/createpackage.msbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy" ToolsVersion="4.0">
<PropertyGroup>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)\..\..\..\..\web\$(ProjectName).gxdproj'))</GXDeployFileProject>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)/../../../../web/$(ProjectName).gxdproj'))</GXDeployFileProject>
<ApplicationType>Web</ApplicationType>
<LambdaSourceDir>$(DeployFullPath)</LambdaSourceDir>
<LambdaOutputFile>$(DeployFullPath)\AWS_Lambda_Package.zip</LambdaOutputFile>
Expand Down
2 changes: 1 addition & 1 deletion src/AWSServerless/deploy.msbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy" ToolsVersion="4.0">
<PropertyGroup>
<AWSLambdaDescriptor>$(GX_PROGRAM_DIR)\GeneXus.AWS.targets</AWSLambdaDescriptor>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)\..\..\..\..\web\$(ProjectName).gxdproj'))</GXDeployFileProject>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)/../../../../web/$(ProjectName).gxdproj'))</GXDeployFileProject>
<LambdaOutputFile>$(DEPLOY_PATH)\AWS_Lambda_Package.zip</LambdaOutputFile>
<OpenAPIForAWSServerlessOutputFile>$(DEPLOY_PATH)\api_gateway.swagger.json</OpenAPIForAWSServerlessOutputFile>
<ApiGatewaySwaggerExtensionTemplate>template\aws-apigateway-swagger-lambda-extension.json</ApiGatewaySwaggerExtensionTemplate>
Expand Down
2 changes: 1 addition & 1 deletion src/AzureServerless/createpackage.msbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CreatePackage" ToolsVersion="4.0">

<PropertyGroup>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)\..\..\..\..\web\$(ProjectName).gxdproj'))</GXDeployFileProject>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)/../../../../web/$(ProjectName).gxdproj'))</GXDeployFileProject>
<STATICRESOURCES_PROVIDER>azureblobstorage</STATICRESOURCES_PROVIDER>
</PropertyGroup>
<Import Project="$(GX_PROGRAM_DIR)\GeneXus.AzureDeploy.targets"/>
Expand Down
4 changes: 2 additions & 2 deletions src/AzureServerless/deploy.msbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy" ToolsVersion="4.0">

<PropertyGroup>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)\..\..\..\..\web\$(ProjectName).gxdproj'))</GXDeployFileProject>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)/../../../../web/$(ProjectName).gxdproj'))</GXDeployFileProject>
</PropertyGroup>

<Import Project= "createpackage.msbuild" Condition = "'$(CreateCloudPackage)' == 'true'" />
Expand All @@ -20,7 +20,7 @@

<Target Name="AzPublish">
<ItemGroup>
<pathToFile Include="$([MSBuild]::Escape('$(DeployFileFullPath)\$(ProjectName)_$(AZURE_SERVERLESS_FUNCTION_NAME).zip'))" />
<pathToFile Include="$([MSBuild]::Escape('$(DeployFileFullPath)/$(ProjectName)_$(AZURE_SERVERLESS_FUNCTION_NAME).zip'))" />
</ItemGroup>

<Message Text="Deploying to Azure functions ...." Importance="high"/>
Expand Down
1 change: 1 addition & 0 deletions src/Docker/deploy.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

<PropertyGroup>
<UnslashedDeployDirectory>$([System.Text.RegularExpressions.Regex]::Replace ($(DeployDirectory), `\\$`, ""))</UnslashedDeployDirectory>
<UnslashedDeployDirectory>$([System.Text.RegularExpressions.Regex]::Replace ($(DeployDirectory), `\/$`, ""))</UnslashedDeployDirectory>
<Dockerfile>$(DeployDirectory)\Dockerfile</Dockerfile>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/HCP/deploy.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<PropertyGroup>
<ApplicationLowerName>$([System.String]::new('$(HCP_APPNAME)').ToLower())</ApplicationLowerName>
<SourceWar>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)\..\..\$(APPLICATION_NAME).war'))</SourceWar>
<TargetWar>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)\..\..\$(ApplicationLowerName).war'))</TargetWar>
<SourceWar>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)/../../$(APPLICATION_NAME).war'))</SourceWar>
<TargetWar>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)/../../$(ApplicationLowerName).war'))</TargetWar>
</PropertyGroup>

<Target Name="Deploy">
<Message Text="$(Name)"/>
<Copy SourceFiles="$(SourceWar)" DestinationFiles="$(TargetWar)"/>
<Exec Command='"$(HCP_SDK_DIR)\Tools\neo" deploy --host $(HCP_HOST) --account $(HCP_ACCOUNT) --application $(ApplicationLowerName) --source "$(TargetWar)" --user $(HCP_USER) -p $(HCP_PASSWORD)' />
<Exec Command='"$(HCP_SDK_DIR)/Tools/neo" deploy --host $(HCP_HOST) --account $(HCP_ACCOUNT) --application $(ApplicationLowerName) --source "$(TargetWar)" --user $(HCP_USER) -p $(HCP_PASSWORD)' />
</Target>

</Project>
2 changes: 1 addition & 1 deletion src/IBMCF/deploy.msbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy">

<PropertyGroup>
<SourceWar>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)\..\..\$(APPLICATION_NAME).war'))</SourceWar>
<SourceWar>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)/../../$(APPLICATION_NAME).war'))</SourceWar>
<SettingAPICommand>cf api https://api.ng.bluemix.net</SettingAPICommand>
<LoginCommand>cf login -u $(IBMCF_USER) -p $(IBMCF_PASSWORD) -o $(IBMCF_ORGANIZATION) -s $(IBMCF_SPACE)</LoginCommand>
<PushJavaApplicationCommand>cf push $(IBMCF_APPLICATION) -b liberty-for-java -p $(SourceWar)</PushJavaApplicationCommand>
Expand Down
2 changes: 1 addition & 1 deletion src/Local/deploy.msbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy" ToolsVersion="4.0">
<PropertyGroup>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)\..\..\..\..\web\$(ProjectName).gxdproj'))</GXDeployFileProject>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)/../../../../web/$(ProjectName).gxdproj'))</GXDeployFileProject>
</PropertyGroup>

<Import Project="$(GXDeployFileProject)" Condition="Exists('$(GXDeployFileProject)')"/>
Expand Down
8 changes: 4 additions & 4 deletions src/SAPCloudFoundry/deploy.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<ApplicationLowerName>$([System.String]::new('$(SAPCF_APPNAME)').ToLower())</ApplicationLowerName>
<DeployFileFullPath>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)\..\..\'))</DeployFileFullPath>
<DeployFileFullPath>$([System.IO.Path]::GetFullPath('$(DEPLOY_PATH)/../../'))</DeployFileFullPath>
<SourceWar>$(DeployFileFullPath)\$(APPLICATION_NAME).war</SourceWar>
<TargetWar>$(DeployFileFullPath)\$(ApplicationLowerName).war</TargetWar>
<ManifestFile>$(DEPLOY_PATH)\..\..\manifest.yml</ManifestFile>
Expand All @@ -15,9 +15,9 @@
<Error Text="The HANA Instance name cannot be empty" Condition="'$(SAPCF_HANAINSTANCENAME)' == ''"/>
<Error Text="The Application Name cannot be empty" Condition="'$(SAPCF_APPNAME)' == ''"/>
<Copy SourceFiles="$(SourceWar)" DestinationFiles="$(TargetWar)"/>
<Exec Command='"$(SAPCF_CLI_DIR)\cf" login -a $(SAPCF_APIEP) -u $(SAPCF_USER) -p $(SAPCF_PASSWORD) -o $(SAPCF_ORG) -s $(SAPCF_SPACE)' Condition="'$(SAPCF_ORIGIN)' == ''"/>
<Exec Command='"$(SAPCF_CLI_DIR)\cf" login -a $(SAPCF_APIEP) -u $(SAPCF_USER) -p $(SAPCF_PASSWORD) -o $(SAPCF_ORG) -s $(SAPCF_SPACE) --origin $(SAPCF_ORIGIN)' Condition="'$(SAPCF_ORIGIN)' != ''"/>
<Exec Command='"$(SAPCF_CLI_DIR)\cf" push -f "$(ManifestFile)"' />
<Exec Command='"$(SAPCF_CLI_DIR)/cf" login -a $(SAPCF_APIEP) -u $(SAPCF_USER) -p $(SAPCF_PASSWORD) -o $(SAPCF_ORG) -s $(SAPCF_SPACE)' Condition="'$(SAPCF_ORIGIN)' == ''"/>
<Exec Command='"$(SAPCF_CLI_DIR)/cf" login -a $(SAPCF_APIEP) -u $(SAPCF_USER) -p $(SAPCF_PASSWORD) -o $(SAPCF_ORG) -s $(SAPCF_SPACE) --origin $(SAPCF_ORIGIN)' Condition="'$(SAPCF_ORIGIN)' != ''"/>
<Exec Command='"$(SAPCF_CLI_DIR)/cf" push -f "$(ManifestFile)"' />
</Target>

<Target Name="GenerateContextXML">
Expand Down
2 changes: 1 addition & 1 deletion src/StaticFrontEnd/deploy.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<GX_PROGRAM_DIR>..\..</GX_PROGRAM_DIR>
<UploadBasePath>/</UploadBasePath>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)\..\..\..\..\web\$(ProjectName).gxdproj'))</GXDeployFileProject>
<GXDeployFileProject>$([System.IO.Path]::GetFullPath('$(DeployFullPath)/../../../../web/$(ProjectName).gxdproj'))</GXDeployFileProject>
<DeployProviderImplementation>..\StaticFrontEnd\deploy\$(STATICFRONTEND_PROVIDER).targets</DeployProviderImplementation>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/StaticFrontEnd/deploy/docker.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<DeployDirectory>$(DeployFullPath)\context</DeployDirectory>
<Dockerfile>$(DeployDirectory)\Dockerfile</Dockerfile>
<UnslashedDeployDirectory>$([System.Text.RegularExpressions.Regex]::Replace ($(DeployDirectory), `\\$`, ""))</UnslashedDeployDirectory>
<UnslashedDeployDirectory>$([System.Text.RegularExpressions.Regex]::Replace ($(DeployDirectory), `\/$`, ""))</UnslashedDeployDirectory>
</PropertyGroup>

<Message Text="Building Docker image $(STATICFRONTEND_DOCKER_IMAGE_NAME)" Importance="high" Condition="'$(DOCKER_EXIT_CODE)' == '0'"/>
Expand Down
2 changes: 1 addition & 1 deletion src/StaticResources/deploy/azureblobstorage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Message Text="Uploading resources to Azure Blob Storage (this may take a while)... $(DeployFullPath)\%(StaticResources.Identity)" Importance="high"/>

<Exec
Command="az storage blob upload-batch -s $(DeployFullPath)\%(StaticResources.Identity) -d $web\%(StaticResources.Identity) --account-name $(STATICRESOURCES_AZURE_STORAGE_ACCOUNT) --account-key $(STATICRESOURCES_AZURE_STORAGE_ACCOUNT_KEY) &gt; NUL 2&gt;1" ConsoleToMSBuild="true"
Command="az storage blob upload-batch -s $(DeployFullPath)/%(StaticResources.Identity) -d $web/%(StaticResources.Identity) --account-name $(STATICRESOURCES_AZURE_STORAGE_ACCOUNT) --account-key $(STATICRESOURCES_AZURE_STORAGE_ACCOUNT_KEY) &gt; NUL 2&gt;1" ConsoleToMSBuild="true"
WorkingDirectory="$(DeployFullPath)\%(StaticResources.Identity)" Condition = "Exists('$(DeployFullPath)\%(StaticResources.Identity)')">
<Output TaskParameter="ConsoleOutput" PropertyName="OUTPUT_MESSAGE" />
<Output TaskParameter="ExitCode" PropertyName="AZ_EXIT_CODE"/>
Expand Down

0 comments on commit 26be34e

Please sign in to comment.