From c53da9ce761909ec327aff3e110e82694785182c Mon Sep 17 00:00:00 2001 From: Jesper Madsen Date: Mon, 22 Sep 2025 14:17:24 +0200 Subject: [PATCH 1/4] powershell --- V2/powershell/Start-Deployment.ps1 | 7 ++++++- .../advanced/azure-release-pipeline-more-targets.yaml | 3 ++- V2/powershell/azuredevops/azure-release-pipeline.yaml | 5 +++-- V2/powershell/azuredevops/cloud-deployment.yml | 4 ++++ V2/powershell/github/advanced/main-more-targets.yml | 5 ++++- V2/powershell/github/cloud-deployment.yml | 5 +++++ V2/powershell/github/main.yml | 3 ++- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/V2/powershell/Start-Deployment.ps1 b/V2/powershell/Start-Deployment.ps1 index fba2dbe..ac02263 100644 --- a/V2/powershell/Start-Deployment.ps1 +++ b/V2/powershell/Start-Deployment.ps1 @@ -28,10 +28,14 @@ param( $SkipVersionCheck = $false, [Parameter(Position=7)] + [bool] + $AllowAnyTarget = $false, + + [Parameter(Position=8)] [string] $PipelineVendor, ## GITHUB or AZUREDEVOPS - [Parameter(Position=8)] + [Parameter(Position=9)] [string] $BaseUrl = "https://api.cloud.umbraco.com" ) @@ -52,6 +56,7 @@ $requestBody = @{ 'commitMessage' = $CommitMessage 'noBuildAndRestore' = $NoBuildAndRestore 'skipVersionCheck' = $SkipVersionCheck + 'allowAnyTarget' = $AllowAnyTarget } | 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..b03906c 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,7 @@ stages: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck and allowAnyTarget # use booleans - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -86,4 +86,5 @@ stages: artifactId: $(artifactId) noBuildAndRestore: false skipVersionCheck: false + allowAnyTarget: false 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..a594265 100644 --- a/V2/powershell/azuredevops/azure-release-pipeline.yaml +++ b/V2/powershell/azuredevops/azure-release-pipeline.yaml @@ -43,7 +43,7 @@ stages: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck and allowAnyTarget # use booleans - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -56,4 +56,5 @@ stages: parameters: artifactId: $(artifactId) noBuildAndRestore: false - skipVersionCheck: false \ No newline at end of file + skipVersionCheck: false + allowAnyTarget: false \ No newline at end of file diff --git a/V2/powershell/azuredevops/cloud-deployment.yml b/V2/powershell/azuredevops/cloud-deployment.yml index 05a8cc9..0d6815c 100644 --- a/V2/powershell/azuredevops/cloud-deployment.yml +++ b/V2/powershell/azuredevops/cloud-deployment.yml @@ -7,6 +7,9 @@ parameters: - name: skipVersionCheck type: boolean default: false + - name: allowAnyTarget + type: boolean + default: false - name: targetEnvironmentAlias type: string default: $(targetEnvironmentAlias) @@ -31,6 +34,7 @@ jobs: -CommitMessage "Run for $(Build.BuildNumber)" -NoBuildAndRestore $${{ parameters.noBuildAndRestore }} -SkipVersionCheck $${{ parameters.skipVersionCheck }} + -AllowAnyTarget $${{ parameters.allowAnyTarget }} -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 839e2f3..1acdde4 100644 --- a/V2/powershell/github/advanced/main-more-targets.yml +++ b/V2/powershell/github/advanced/main-more-targets.yml @@ -49,13 +49,15 @@ jobs: name: "Prepare and Upload Artifact" uses: ./.github/workflows/cloud-artifact.yml needs: cloud-sync + with: + newSha: ${{ needs.cloud-sync.outputs.newSha }} secrets: projectId: ${{ secrets.PROJECT_ID }} umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck and allowAnyTarget # use 0 for false and 1 for true cloud-deployment: name: "Deploy to Cloud" @@ -66,6 +68,7 @@ jobs: targetEnvironmentAlias: ${{ needs.set-env.outputs.targetEnvironmentAlias }} noBuildAndRestore: 0 skipVersionCheck: 0 + allowAnyTarget: 0 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..12dcd29 100644 --- a/V2/powershell/github/cloud-deployment.yml +++ b/V2/powershell/github/cloud-deployment.yml @@ -30,6 +30,11 @@ on: required: false type: number default: 0 + allowAnyTarget: + description: 'Allows deployments to targets other than left-most or flexible' + required: false + type: number + default: 0 secrets: projectId: diff --git a/V2/powershell/github/main.yml b/V2/powershell/github/main.yml index faeaec4..a855b2f 100644 --- a/V2/powershell/github/main.yml +++ b/V2/powershell/github/main.yml @@ -31,7 +31,7 @@ jobs: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck and allowAnyTarget # use 0 for false and 1 for true cloud-deployment: name: "Deploy to Cloud" @@ -42,6 +42,7 @@ jobs: targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }} noBuildAndRestore: 0 skipVersionCheck: 0 + allowAnyTarget: 0 secrets: projectId: ${{ secrets.PROJECT_ID }} umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} From 6ce9a6907b0d89d8362778f787254fc02296a865 Mon Sep 17 00:00:00 2001 From: Jesper Madsen Date: Mon, 22 Sep 2025 14:18:38 +0200 Subject: [PATCH 2/4] bash --- .../advanced/azure-release-pipeline-more-targets.yaml | 1 + V2/bash/azuredevops/azure-release-pipeline.yaml | 5 +++-- V2/bash/azuredevops/cloud-deployment.yml | 5 +++++ V2/bash/github/advanced/main-more-targets.yml | 5 ++++- V2/bash/github/cloud-deployment.yml | 6 ++++++ V2/bash/github/main.yml | 3 ++- V2/bash/start_deployment.sh | 6 ++++-- V2/powershell/github/cloud-deployment.yml | 1 + 8 files changed, 26 insertions(+), 6 deletions(-) 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..594308d 100644 --- a/V2/bash/azuredevops/advanced/azure-release-pipeline-more-targets.yaml +++ b/V2/bash/azuredevops/advanced/azure-release-pipeline-more-targets.yaml @@ -86,4 +86,5 @@ stages: artifactId: $(artifactId) noBuildAndRestore: 'true' skipVersionCheck: 'true' + allowAnyTarget: 'false' 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..2afcb65 100644 --- a/V2/bash/azuredevops/azure-release-pipeline.yaml +++ b/V2/bash/azuredevops/azure-release-pipeline.yaml @@ -43,7 +43,7 @@ stages: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck and allowAnyTarget # use booleans but as strings - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -56,4 +56,5 @@ stages: parameters: artifactId: $(artifactId) noBuildAndRestore: 'false' - skipVersionCheck: 'false' \ No newline at end of file + skipVersionCheck: 'false' + allowAnyTarget: 'false' \ No newline at end of file diff --git a/V2/bash/azuredevops/cloud-deployment.yml b/V2/bash/azuredevops/cloud-deployment.yml index c3e2e07..e11cecf 100644 --- a/V2/bash/azuredevops/cloud-deployment.yml +++ b/V2/bash/azuredevops/cloud-deployment.yml @@ -7,6 +7,9 @@ parameters: - name: skipVersionCheck type: string default: 'false' + - name: allowAnyTarget + type: string + default: 'false' - name: targetEnvironmentAlias type: string default: $(targetEnvironmentAlias) @@ -23,6 +26,7 @@ jobs: artifactId: ${{ parameters.artifactId }} noBuildAndRestore: ${{ parameters.noBuildAndRestore }} skipVersionCheck: ${{ parameters.skipVersionCheck }} + allowAnyTarget: ${{ parameters.allowAnyTarget }} inputs: targetType: 'filePath' filePath: devops/scripts/start_deployment.sh @@ -34,6 +38,7 @@ jobs: "Run for $(Build.BuildNumber)" $noBuildAndRestore $skipVersionCheck + $allowAnyTarget $(pipelineVendor) - job: CheckDeploymentProgress diff --git a/V2/bash/github/advanced/main-more-targets.yml b/V2/bash/github/advanced/main-more-targets.yml index ddcb7fd..2d6ee72 100644 --- a/V2/bash/github/advanced/main-more-targets.yml +++ b/V2/bash/github/advanced/main-more-targets.yml @@ -49,13 +49,15 @@ jobs: name: "Prepare and Upload Artifact" uses: ./.github/workflows/cloud-artifact.yml needs: cloud-sync + with: + newSha: ${{ needs.cloud-sync.outputs.newSha }} secrets: projectId: ${{ secrets.PROJECT_ID }} umbracoCloudApiKey: ${{ secrets.UMBRACO_CLOUD_API_KEY }} # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck and allowAnyTarget # use booleans but as strings cloud-deployment: name: "Deploy to Cloud" @@ -66,6 +68,7 @@ jobs: targetEnvironmentAlias: ${{ needs.set-env.outputs.targetEnvironmentAlias }} noBuildAndRestore: "false" skipVersionCheck: "false" + allowAnyTarget: "false" 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..0f1e354 100644 --- a/V2/bash/github/cloud-deployment.yml +++ b/V2/bash/github/cloud-deployment.yml @@ -30,6 +30,11 @@ on: required: false type: string default: "false" + allowAnyTarget: + description: 'Allows deployments to targets other than left-most or flexible' + required: false + type: string + default: "false" secrets: projectId: @@ -61,6 +66,7 @@ jobs: "Run for ${{ github.run_number }}" ${{ inputs.noBuildAndRestore}} ${{ inputs.skipVersionCheck }} + ${{ inputs.allowAnyTarget }} GITHUB awaitDeploymentFinished: diff --git a/V2/bash/github/main.yml b/V2/bash/github/main.yml index 66471b8..963c72e 100644 --- a/V2/bash/github/main.yml +++ b/V2/bash/github/main.yml @@ -31,7 +31,7 @@ jobs: # Deploy to Umbraco Cloud # #### - # you can edit the variables noBuildAndRestore and skipVersionCheck + # you can edit the variables noBuildAndRestore, skipVersionCheck and allowAnyTarget # use booleans but as strings cloud-deployment: name: "Deploy to Cloud" @@ -42,6 +42,7 @@ jobs: targetEnvironmentAlias: ${{ vars.TARGET_ENVIRONMENT_ALIAS }} noBuildAndRestore: "false" skipVersionCheck: "false" + allowAnyTarget: "false" 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..c8702c9 100644 --- a/V2/bash/start_deployment.sh +++ b/V2/bash/start_deployment.sh @@ -8,7 +8,8 @@ targetEnvironmentAlias="$4" commitMessage="$5" noBuildAndRestore="${6:-false}" skipVersionCheck="${7:-false}" -pipelineVendor="$8" +allowAnyTarget="${8:-false}" +pipelineVendor="$9" # Not required, defaults to https://api.cloud.umbraco.com baseUrl="${9:-https://api.cloud.umbraco.com}" @@ -27,11 +28,12 @@ function call_api { echo " - commitMessage: $commitMessage" echo " - noBuildAndRestore: $noBuildAndRestore" echo " - skipVersionCheck: $skipVersionCheck" + echo " - allowAnyTarget: $allowAnyTarget" 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}") responseCode=${response: -3} content=${response%???} diff --git a/V2/powershell/github/cloud-deployment.yml b/V2/powershell/github/cloud-deployment.yml index 12dcd29..7460c32 100644 --- a/V2/powershell/github/cloud-deployment.yml +++ b/V2/powershell/github/cloud-deployment.yml @@ -66,6 +66,7 @@ jobs: -CommitMessage "Run number ${{github.run_number}}" -NoBuildAndRestore ${{ inputs.noBuildAndRestore }} -SkipVersionCheck ${{ inputs.skipVersionCheck }} + -AllowAnyTarget ${{ inputs.allowAnyTarget }} -PipelineVendor GITHUB awaitDeploymentFinished: From 6674c78224a1d6f918cc504a4245bef7980d2ee9 Mon Sep 17 00:00:00 2001 From: Jesper Madsen <32263802+jesp209i@users.noreply.github.com> Date: Mon, 29 Sep 2025 12:32:11 +0200 Subject: [PATCH 3/4] Update start_deployment.sh to use baseUrl not pipelineVendor --- V2/bash/start_deployment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/V2/bash/start_deployment.sh b/V2/bash/start_deployment.sh index c8702c9..f60db13 100644 --- a/V2/bash/start_deployment.sh +++ b/V2/bash/start_deployment.sh @@ -12,7 +12,7 @@ allowAnyTarget="${8:-false}" pipelineVendor="$9" # Not required, defaults to https://api.cloud.umbraco.com -baseUrl="${9:-https://api.cloud.umbraco.com}" +baseUrl="${10:-https://api.cloud.umbraco.com}" ### Endpoint docs From 4bb695e98201c1089bd3e7102d3a7e4cd9486fb6 Mon Sep 17 00:00:00 2001 From: Jesper Madsen Date: Thu, 4 Dec 2025 13:26:01 +0100 Subject: [PATCH 4/4] Update scripts to include RunSchemaExtraction option --- .../azure-release-pipeline-more-targets.yaml | 5 ++- .../azuredevops/azure-release-pipeline.yaml | 9 +++-- V2/bash/azuredevops/cloud-deployment.yml | 12 ++++++- V2/bash/github/advanced/main-more-targets.yml | 5 ++- V2/bash/github/cloud-deployment.yml | 18 ++++++++-- V2/bash/github/main.yml | 5 ++- V2/bash/start_deployment.sh | 13 ++++--- V2/powershell/Start-Deployment.ps1 | 36 ++++++++++++------- .../azure-release-pipeline-more-targets.yaml | 5 ++- .../azuredevops/azure-release-pipeline.yaml | 9 +++-- .../azuredevops/cloud-deployment.yml | 10 +++++- .../github/advanced/main-more-targets.yml | 5 ++- V2/powershell/github/cloud-deployment.yml | 20 ++++++++--- V2/powershell/github/main.yml | 5 ++- 14 files changed, 119 insertions(+), 38 deletions(-) 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 594308d..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,5 +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 2afcb65..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, skipVersionCheck and allowAnyTarget + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans but as strings - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -51,10 +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' - allowAnyTarget: 'false' \ No newline at end of file + 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 e11cecf..ae90bd6 100644 --- a/V2/bash/azuredevops/cloud-deployment.yml +++ b/V2/bash/azuredevops/cloud-deployment.yml @@ -7,9 +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) @@ -26,11 +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 @@ -38,7 +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 2d6ee72..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, skipVersionCheck and allowAnyTarget + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans but as strings cloud-deployment: name: "Deploy to Cloud" @@ -68,7 +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 0f1e354..e5b95f9 100644 --- a/V2/bash/github/cloud-deployment.yml +++ b/V2/bash/github/cloud-deployment.yml @@ -30,11 +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: @@ -59,14 +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 963c72e..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, skipVersionCheck and allowAnyTarget + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans but as strings cloud-deployment: name: "Deploy to Cloud" @@ -42,7 +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 f60db13..4e1a715 100644 --- a/V2/bash/start_deployment.sh +++ b/V2/bash/start_deployment.sh @@ -8,11 +8,13 @@ targetEnvironmentAlias="$4" commitMessage="$5" noBuildAndRestore="${6:-false}" skipVersionCheck="${7:-false}" -allowAnyTarget="${8:-false}" -pipelineVendor="$9" +skipPreserveUmbracoCloudJson="${8:-false}" +allowAnyTarget="${9:-false}" +runSchemaExtraction="${10:-true}" +pipelineVendor="${11}" # Not required, defaults to https://api.cloud.umbraco.com -baseUrl="${10:-https://api.cloud.umbraco.com}" +baseUrl="${12:-https://api.cloud.umbraco.com}" ### Endpoint docs @@ -28,12 +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,\"allowAnyTarget\": $allowAnyTarget}") + -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 ac02263..cf0f259 100644 --- a/V2/powershell/Start-Deployment.ps1 +++ b/V2/powershell/Start-Deployment.ps1 @@ -1,42 +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)] - [bool] - $AllowAnyTarget = $false, + [bool] + $SkipPreserveUmbracoCloudJson = $false, [Parameter(Position=8)] - [string] + [bool] + $AllowAnyTarget = $false, + + [Parameter(Position=9)] + [bool] + $RunSchemaExtraction = $true, + + [Parameter(Position=10)] + [string] $PipelineVendor, ## GITHUB or AZUREDEVOPS - [Parameter(Position=9)] - [string] + [Parameter(Position=11)] + [string] $BaseUrl = "https://api.cloud.umbraco.com" ) @@ -56,7 +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 b03906c..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, skipVersionCheck and allowAnyTarget + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -86,5 +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 a594265..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, skipVersionCheck and allowAnyTarget + # you can edit the variables noBuildAndRestore, skipVersionCheck, skipPreserveUmbracoCloudJson, + # allowAnyTarget and runSchemaExtraction # use booleans - stage: CloudDeploymentStage displayName: Deploy To Cloud @@ -51,10 +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 - allowAnyTarget: false \ No newline at end of file + 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 0d6815c..5e050dd 100644 --- a/V2/powershell/azuredevops/cloud-deployment.yml +++ b/V2/powershell/azuredevops/cloud-deployment.yml @@ -7,9 +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) @@ -26,7 +32,7 @@ jobs: pwsh: true targetType: 'filePath' filePath: devops/powershell/Start-Deployment.ps1 - arguments: > + arguments: > -ProjectId $(projectId) -ApiKey $(umbracoCloudApiKey) -ArtifactId ${{ parameters.artifactId }} @@ -34,7 +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 1acdde4..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, skipVersionCheck and allowAnyTarget + # 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,7 +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 7460c32..8fdd841 100644 --- a/V2/powershell/github/cloud-deployment.yml +++ b/V2/powershell/github/cloud-deployment.yml @@ -30,11 +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: @@ -58,15 +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 a855b2f..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, skipVersionCheck and allowAnyTarget + # 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,7 +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 }}