diff --git a/V2/bash/azuredevops/advanced/azure-release-pipeline-more-targets.yaml b/V2/bash/azuredevops/advanced/azure-release-pipeline-more-targets.yaml index bfa1641..5a2af38 100644 --- a/V2/bash/azuredevops/advanced/azure-release-pipeline-more-targets.yaml +++ b/V2/bash/azuredevops/advanced/azure-release-pipeline-more-targets.yaml @@ -71,7 +71,8 @@ stages: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans but as strings - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -86,4 +87,7 @@ stages: artifactId: $(artifactId) noBuildAndRestore: 'true' skipVersionCheck: 'true' + skipPreserveUmbracoCloudJson: 'false' + allowAnyTarget: 'false' + runSchemaExtraction: 'true' targetEnvironmentAlias: $(targetEnvironment) \ No newline at end of file diff --git a/V2/bash/azuredevops/azure-release-pipeline.yaml b/V2/bash/azuredevops/azure-release-pipeline.yaml index 4bc78e1..50d9e9a 100644 --- a/V2/bash/azuredevops/azure-release-pipeline.yaml +++ b/V2/bash/azuredevops/azure-release-pipeline.yaml @@ -43,7 +43,8 @@ stages: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans but as strings - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -51,9 +52,12 @@ stages: condition: in(dependencies.cloudPrepareArtifact.result, 'Succeeded') variables: artifactId: $[ stageDependencies.cloudPrepareArtifact.PrepareAndUploadArtifact.outputs['uploadArtifact.artifactId'] ] - jobs: + jobs: - template: cloud-deployment.yml parameters: artifactId: $(artifactId) noBuildAndRestore: 'false' - skipVersionCheck: 'false' \ No newline at end of file + skipVersionCheck: 'false' + skipPreserveUmbracoCloudJson: 'false' + allowAnyTarget: 'false' + runSchemaExtraction: 'true' \ No newline at end of file diff --git a/V2/bash/azuredevops/cloud-deployment.yml b/V2/bash/azuredevops/cloud-deployment.yml index c3e2e07..ae90bd6 100644 --- a/V2/bash/azuredevops/cloud-deployment.yml +++ b/V2/bash/azuredevops/cloud-deployment.yml @@ -7,6 +7,15 @@ parameters: - name: skipVersionCheck type: string default: 'false' + - name: skipPreserveUmbracoCloudJson + type: string + default: 'false' + - name: allowAnyTarget + type: string + default: 'false' + - name: runSchemaExtraction + type: string + default: 'true' - name: targetEnvironmentAlias type: string default: $(targetEnvironmentAlias) @@ -23,10 +32,13 @@ jobs: artifactId: ${{ parameters.artifactId }} noBuildAndRestore: ${{ parameters.noBuildAndRestore }} skipVersionCheck: ${{ parameters.skipVersionCheck }} + skipPreserveUmbracoCloudJson: ${{ parameters.skipPreserveUmbracoCloudJson }} + allowAnyTarget: ${{ parameters.allowAnyTarget }} + runSchemaExtraction: ${{ parameters.runSchemaExtraction }} inputs: targetType: 'filePath' filePath: devops/scripts/start_deployment.sh - arguments: > + arguments: > $(projectId) $(umbracoCloudApiKey) $artifactId @@ -34,6 +46,9 @@ jobs: "Run for $(Build.BuildNumber)" $noBuildAndRestore $skipVersionCheck + $skipPreserveUmbracoCloudJson + $allowAnyTarget + $runSchemaExtraction $(pipelineVendor) - job: CheckDeploymentProgress diff --git a/V2/bash/github/advanced/main-more-targets.yml b/V2/bash/github/advanced/main-more-targets.yml index 6c03b13..72b0ee3 100644 --- a/V2/bash/github/advanced/main-more-targets.yml +++ b/V2/bash/github/advanced/main-more-targets.yml @@ -57,7 +57,8 @@ jobs: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans but as strings cloud-deployment: name: "Deploy to Cloud" @@ -68,6 +69,9 @@ jobs: targetEnvironmentAlias: ${{ needs.set-env.outputs.targetEnvironmentAlias }} noBuildAndRestore: "false" skipVersionCheck: "false" + skipPreserveUmbracoCloudJson: "false" + allowAnyTarget: "false" + runSchemaExtraction: "true" secrets: projectId: ${{ secrets.PROJECT_ID }} umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} \ No newline at end of file diff --git a/V2/bash/github/cloud-deployment.yml b/V2/bash/github/cloud-deployment.yml index 2d842a6..e5b95f9 100644 --- a/V2/bash/github/cloud-deployment.yml +++ b/V2/bash/github/cloud-deployment.yml @@ -30,6 +30,21 @@ on: required: false type: string default: "false" + skipPreserveUmbracoCloudJson: + description: 'Skip preserving umbraco-cloud.json file' + required: false + type: string + default: "false" + allowAnyTarget: + description: 'Allows deployments to targets other than left-most or flexible' + required: false + type: string + default: "false" + runSchemaExtraction: + description: 'Run schema extraction during deployment' + required: false + type: string + default: "true" secrets: projectId: @@ -54,13 +69,16 @@ jobs: shell: bash run: > bash ${{ GITHUB.WORKSPACE }}/.github/scripts/start_deployment.sh - ${{ secrets.projectId }} - ${{ secrets.umbracoCloudApiKey }} + ${{ secrets.projectId }} + ${{ secrets.umbracoCloudApiKey }} ${{ inputs.artifactId }} ${{ inputs.targetEnvironmentAlias }} "Run for ${{ github.run_number }}" - ${{ inputs.noBuildAndRestore}} + ${{ inputs.noBuildAndRestore }} ${{ inputs.skipVersionCheck }} + ${{ inputs.skipPreserveUmbracoCloudJson }} + ${{ inputs.allowAnyTarget }} + ${{ inputs.runSchemaExtraction }} GITHUB awaitDeploymentFinished: diff --git a/V2/bash/github/main.yml b/V2/bash/github/main.yml index 66471b8..e8ed820 100644 --- a/V2/bash/github/main.yml +++ b/V2/bash/github/main.yml @@ -31,7 +31,8 @@ jobs: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans but as strings cloud-deployment: name: "Deploy to Cloud" @@ -42,6 +43,9 @@ jobs: targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }} noBuildAndRestore: "false" skipVersionCheck: "false" + skipPreserveUmbracoCloudJson: "false" + allowAnyTarget: "false" + runSchemaExtraction: "true" secrets: projectId: ${{ secrets.PROJECT_ID }} umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} diff --git a/V2/bash/start_deployment.sh b/V2/bash/start_deployment.sh index 1b3eb15..4e1a715 100644 --- a/V2/bash/start_deployment.sh +++ b/V2/bash/start_deployment.sh @@ -8,10 +8,13 @@ targetEnvironmentAlias="$4" commitMessage="$5" noBuildAndRestore="${6:-false}" skipVersionCheck="${7:-false}" -pipelineVendor="$8" +skipPreserveUmbracoCloudJson="${8:-false}" +allowAnyTarget="${9:-false}" +runSchemaExtraction="${10:-true}" +pipelineVendor="${11}" # Not required, defaults to https://api.cloud.umbraco.com -baseUrl="${9:-https://api.cloud.umbraco.com}" +baseUrl="${12:-https://api.cloud.umbraco.com}" ### Endpoint docs @@ -27,11 +30,15 @@ function call_api { echo " - commitMessage: $commitMessage" echo " - noBuildAndRestore: $noBuildAndRestore" echo " - skipVersionCheck: $skipVersionCheck" + echo " - skipPreserveUmbracoCloudJson: $skipPreserveUmbracoCloudJson" + echo " - allowAnyTarget: $allowAnyTarget" + echo " - runSchemaExtraction: $runSchemaExtraction" + response=$(curl -s -w "%{http_code}" -X POST $url \ -H "Umbraco-Cloud-Api-Key: $apiKey" \ -H "Content-Type: application/json" \ - -d "{\"targetEnvironmentAlias\": \"$targetEnvironmentAlias\",\"artifactId\": \"$artifactId\",\"commitMessage\": \"$commitMessage\",\"noBuildAndRestore\": $noBuildAndRestore,\"skipVersionCheck\": $skipVersionCheck}") + -d "{\"targetEnvironmentAlias\": \"$targetEnvironmentAlias\",\"artifactId\": \"$artifactId\",\"commitMessage\": \"$commitMessage\",\"noBuildAndRestore\": $noBuildAndRestore,\"skipVersionCheck\": $skipVersionCheck,\"allowAnyTarget\": $allowAnyTarget,\"runSchemaExtraction\": $runSchemaExtraction,\"skipPreserveUmbracoCloudJson\": $skipPreserveUmbracoCloudJson}") responseCode=${response: -3} content=${response%???} diff --git a/V2/powershell/Start-Deployment.ps1 b/V2/powershell/Start-Deployment.ps1 index fba2dbe..cf0f259 100644 --- a/V2/powershell/Start-Deployment.ps1 +++ b/V2/powershell/Start-Deployment.ps1 @@ -1,38 +1,50 @@ param( [Parameter(Position=0)] - [string] + [string] $ProjectId, [Parameter(Position=1)] - [string] + [string] $ApiKey, [Parameter(Position=2)] - [string] + [string] $ArtifactId, [Parameter(Position=3)] - [string] + [string] $TargetEnvironmentAlias, [Parameter(Position=4)] - [string] + [string] $CommitMessage = "", - + [Parameter(Position=5)] - [bool] + [bool] $NoBuildAndRestore = $false, [Parameter(Position=6)] - [bool] + [bool] $SkipVersionCheck = $false, [Parameter(Position=7)] - [string] + [bool] + $SkipPreserveUmbracoCloudJson = $false, + + [Parameter(Position=8)] + [bool] + $AllowAnyTarget = $false, + + [Parameter(Position=9)] + [bool] + $RunSchemaExtraction = $true, + + [Parameter(Position=10)] + [string] $PipelineVendor, ## GITHUB or AZUREDEVOPS - [Parameter(Position=8)] - [string] + [Parameter(Position=11)] + [string] $BaseUrl = "https://api.cloud.umbraco.com" ) @@ -52,6 +64,9 @@ $requestBody = @{ 'commitMessage' = $CommitMessage 'noBuildAndRestore' = $NoBuildAndRestore 'skipVersionCheck' = $SkipVersionCheck + 'skipPreserveUmbracoCloudJson' = $SkipPreserveUmbracoCloudJson + 'allowAnyTarget' = $AllowAnyTarget + 'runSchemaExtraction' = $RunSchemaExtraction } | ConvertTo-Json try { diff --git a/V2/powershell/azuredevops/advanced/azure-release-pipeline-more-targets.yaml b/V2/powershell/azuredevops/advanced/azure-release-pipeline-more-targets.yaml index 4eeec72..d90ed05 100644 --- a/V2/powershell/azuredevops/advanced/azure-release-pipeline-more-targets.yaml +++ b/V2/powershell/azuredevops/advanced/azure-release-pipeline-more-targets.yaml @@ -71,7 +71,8 @@ stages: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -86,4 +87,7 @@ stages: artifactId: $(artifactId) noBuildAndRestore: false skipVersionCheck: false + skipPreserveUmbracoCloudJson: false + allowAnyTarget: false + runSchemaExtraction: true targetEnvironmentAlias: $(targetEnvironment) \ No newline at end of file diff --git a/V2/powershell/azuredevops/azure-release-pipeline.yaml b/V2/powershell/azuredevops/azure-release-pipeline.yaml index c281537..6f0a1e4 100644 --- a/V2/powershell/azuredevops/azure-release-pipeline.yaml +++ b/V2/powershell/azuredevops/azure-release-pipeline.yaml @@ -43,7 +43,8 @@ stages: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -51,9 +52,12 @@ stages: condition: in(dependencies.cloudPrepareArtifact.result, 'Succeeded') variables: artifactId: $[ stageDependencies.cloudPrepareArtifact.PrepareAndUploadArtifact.outputs['uploadArtifact.artifactId'] ] - jobs: + jobs: - template: cloud-deployment.yml parameters: artifactId: $(artifactId) noBuildAndRestore: false - skipVersionCheck: false \ No newline at end of file + skipVersionCheck: false + skipPreserveUmbracoCloudJson: false + allowAnyTarget: false + runSchemaExtraction: true \ No newline at end of file diff --git a/V2/powershell/azuredevops/cloud-deployment.yml b/V2/powershell/azuredevops/cloud-deployment.yml index 05a8cc9..5e050dd 100644 --- a/V2/powershell/azuredevops/cloud-deployment.yml +++ b/V2/powershell/azuredevops/cloud-deployment.yml @@ -7,6 +7,15 @@ parameters: - name: skipVersionCheck type: boolean default: false + - name: skipPreserveUmbracoCloudJson + type: boolean + default: false + - name: allowAnyTarget + type: boolean + default: false + - name: runSchemaExtraction + type: boolean + default: true - name: targetEnvironmentAlias type: string default: $(targetEnvironmentAlias) @@ -23,7 +32,7 @@ jobs: pwsh: true targetType: 'filePath' filePath: devops/powershell/Start-Deployment.ps1 - arguments: > + arguments: > -ProjectId $(projectId) -ApiKey $(umbracoCloudApiKey) -ArtifactId ${{ parameters.artifactId }} @@ -31,6 +40,9 @@ jobs: -CommitMessage "Run for $(Build.BuildNumber)" -NoBuildAndRestore $${{ parameters.noBuildAndRestore }} -SkipVersionCheck $${{ parameters.skipVersionCheck }} + -SkipPreserveUmbracoCloudJson $${{ parameters.skipPreserveUmbracoCloudJson }} + -AllowAnyTarget $${{ parameters.allowAnyTarget }} + -RunSchemaExtraction $${{ parameters.runSchemaExtraction }} -PipelineVendor $(pipelineVendor) - job: CheckDeploymentProgress diff --git a/V2/powershell/github/advanced/main-more-targets.yml b/V2/powershell/github/advanced/main-more-targets.yml index 7b40175..1f229dc 100644 --- a/V2/powershell/github/advanced/main-more-targets.yml +++ b/V2/powershell/github/advanced/main-more-targets.yml @@ -57,7 +57,8 @@ jobs: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use 0 for false and 1 for true cloud-deployment: name: "Deploy to Cloud" @@ -68,6 +69,9 @@ jobs: targetEnvironmentAlias: ${{ needs.set-env.outputs.targetEnvironmentAlias }} noBuildAndRestore: 0 skipVersionCheck: 0 + skipPreserveUmbracoCloudJson: 0 + allowAnyTarget: 0 + runSchemaExtraction: 1 secrets: projectId: ${{ secrets.PROJECT_ID }} umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} \ No newline at end of file diff --git a/V2/powershell/github/cloud-deployment.yml b/V2/powershell/github/cloud-deployment.yml index 9c082a9..8fdd841 100644 --- a/V2/powershell/github/cloud-deployment.yml +++ b/V2/powershell/github/cloud-deployment.yml @@ -30,6 +30,21 @@ on: required: false type: number default: 0 + skipPreserveUmbracoCloudJson: + description: 'Skip preserving umbraco-cloud.json file' + required: false + type: number + default: 0 + allowAnyTarget: + description: 'Allows deployments to targets other than left-most or flexible' + required: false + type: number + default: 0 + runSchemaExtraction: + description: 'Run schema extraction during deployment' + required: false + type: number + default: 1 secrets: projectId: @@ -53,14 +68,17 @@ jobs: id: requestStartDeployment shell: pwsh run: > - ${{GITHUB.WORKSPACE}}/.github/powershell/Start-Deployment.ps1 - -ProjectId ${{ secrets.projectId }} - -ApiKey ${{ secrets.umbracoCloudApiKey }} + ${{GITHUB.WORKSPACE}}/.github/powershell/Start-Deployment.ps1 + -ProjectId ${{ secrets.projectId }} + -ApiKey ${{ secrets.umbracoCloudApiKey }} -ArtifactId ${{ inputs.artifactId }} -TargetEnvironmentAlias ${{ inputs.targetEnvironmentAlias }} - -CommitMessage "Run number ${{github.run_number}}" + -CommitMessage "Run number ${{github.run_number}}" -NoBuildAndRestore ${{ inputs.noBuildAndRestore }} -SkipVersionCheck ${{ inputs.skipVersionCheck }} + -SkipPreserveUmbracoCloudJson ${{ inputs.skipPreserveUmbracoCloudJson }} + -AllowAnyTarget ${{ inputs.allowAnyTarget }} + -RunSchemaExtraction ${{ inputs.runSchemaExtraction }} -PipelineVendor GITHUB awaitDeploymentFinished: diff --git a/V2/powershell/github/main.yml b/V2/powershell/github/main.yml index faeaec4..8172d87 100644 --- a/V2/powershell/github/main.yml +++ b/V2/powershell/github/main.yml @@ -31,7 +31,8 @@ jobs: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use 0 for false and 1 for true cloud-deployment: name: "Deploy to Cloud" @@ -42,6 +43,9 @@ jobs: targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }} noBuildAndRestore: 0 skipVersionCheck: 0 + skipPreserveUmbracoCloudJson: 0 + allowAnyTarget: 0 + runSchemaExtraction: 1 secrets: projectId: ${{ secrets.PROJECT_ID }} umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }}