From 0d4fc8864713218eec240011b095f4bbcb4e6a5e Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Tue, 30 Jan 2024 16:33:32 +0200 Subject: [PATCH 01/23] Fix PR tests after PR#212 PR#212 made some changes on `main` and `8.12` that require the presence of MANIFEST_URL. However, the pipeline is still configured to run the same script when a PR (from an upstream branch) is raised and it currently fails. This commit fixes PR tests by picking up a suitable MANIFEST_URL. --- .buildkite/scripts/build.ps1 | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index 21b4673..e5bbff3 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -1,7 +1,35 @@ $ErrorActionPreference = "Stop" Set-Strictmode -version 3 -if (-not (Test-Path env:MANIFEST_URL)) { +if (-not (Test-Path env:MANIFEST_URL) -and (Test-Path env:BUILDKITE_PULL_REQUEST) -and ($env:BUILDKITE_PULL_REQUEST -ne "false")) { + # we are called via a PR + Write-Host "~~~ Running in pull request mode" + + $targetBranch = $env:BUILDKITE_PULL_REQUEST_BASE_BRANCH + if ( ($targetBranch -ne "main") -and -not ($targetBranch -like "8*")) { + Write-Host "^^^ +++" + $errorMessage = "This PR is targetting the [$targetBranch] branch, but running tests is only supported against `main` and `8.x` branches. Exiting." + Write-Host $errorMessage + throw $errorMessage + } + + # the snapshot API url expects master where we normally use main + $snapshotsApiTargetBranch = if ($targetBranch -eq "main") { "master" } else { $targetBranch } + + $snapshotsUrl = "https://snapshots.elastic.co/latest/$snapshotsApiTargetBranch.json" + Write-Host "snapshots url is $snapshotsUrl" + try { + $response = Invoke-WebRequest -UseBasicParsing -Uri $snapshotsUrl + $responseJson = $response.Content | ConvertFrom-Json + $env:MANIFEST_URL = $responseJson.manifest_url + Write-Host "Using MANIFEST_URL=$env:MANIFEST_URL" + } catch { + $errorMessage = "There was an error parsing manifest_url from $snapshotsUrl. Exiting." + throw $errorMessage + } +} +elseif (-not (Test-Path env:MANIFEST_URL)) { + # any other invocation of this script (e.g. from unified release) must supply MANIFEST_URL $errorMessage = "Error: Required environment variable [MANIFEST_URL] is missing." Write-Host $errorMessage throw $errorMessage From 1585419991f1b3b6caf41410c31f762bb29b6617 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Tue, 30 Jan 2024 16:52:26 +0200 Subject: [PATCH 02/23] PR comment --- .buildkite/scripts/build.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index e5bbff3..6af7810 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -1,12 +1,14 @@ $ErrorActionPreference = "Stop" Set-Strictmode -version 3 +$eligibleReleaseBranchesMajor = "^[8]" + if (-not (Test-Path env:MANIFEST_URL) -and (Test-Path env:BUILDKITE_PULL_REQUEST) -and ($env:BUILDKITE_PULL_REQUEST -ne "false")) { # we are called via a PR Write-Host "~~~ Running in pull request mode" $targetBranch = $env:BUILDKITE_PULL_REQUEST_BASE_BRANCH - if ( ($targetBranch -ne "main") -and -not ($targetBranch -like "8*")) { + if ( ($targetBranch -ne "main") -and -not ($targetBranch -like $eligibleReleaseBranchesMajor)) { Write-Host "^^^ +++" $errorMessage = "This PR is targetting the [$targetBranch] branch, but running tests is only supported against `main` and `8.x` branches. Exiting." Write-Host $errorMessage From 2b753cfe5edbd2f688fd309dcdf4cfecf694a002 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Tue, 30 Jan 2024 18:10:58 +0200 Subject: [PATCH 03/23] Fix tests when run via branch push --- .buildkite/pull-requests.json | 22 ++++++++++++++++ .buildkite/scripts/build.ps1 | 47 +++++++++++++++++++++++++++-------- catalog-info.yaml | 8 ++++-- 3 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 .buildkite/pull-requests.json diff --git a/.buildkite/pull-requests.json b/.buildkite/pull-requests.json new file mode 100644 index 0000000..9a8136b --- /dev/null +++ b/.buildkite/pull-requests.json @@ -0,0 +1,22 @@ +{ + "jobs": [ + { + "enabled": true, + "pipeline_slug": "elastic-stack-installers", + "allow_org_users": true, + "allowed_repo_permissions": ["admin", "write"], + "allowed_list": ["github-actions[bot]"], + "set_commit_status": true, + "build_on_commit": true, + "build_on_comment": true, + "trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))", + "always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))", + "skip_ci_labels": [ ], + "skip_target_branches": [ ], + "skip_ci_on_only_changed": [ + "^docs/" + ], + "always_require_ci_on_changed": [ ] + } + ] + } diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index 6af7810..4797a2e 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -3,17 +3,10 @@ Set-Strictmode -version 3 $eligibleReleaseBranchesMajor = "^[8]" -if (-not (Test-Path env:MANIFEST_URL) -and (Test-Path env:BUILDKITE_PULL_REQUEST) -and ($env:BUILDKITE_PULL_REQUEST -ne "false")) { - # we are called via a PR - Write-Host "~~~ Running in pull request mode" - - $targetBranch = $env:BUILDKITE_PULL_REQUEST_BASE_BRANCH - if ( ($targetBranch -ne "main") -and -not ($targetBranch -like $eligibleReleaseBranchesMajor)) { - Write-Host "^^^ +++" - $errorMessage = "This PR is targetting the [$targetBranch] branch, but running tests is only supported against `main` and `8.x` branches. Exiting." - Write-Host $errorMessage - throw $errorMessage - } +function setManifestUrl { + param ( + [string]$targetBranch + ) # the snapshot API url expects master where we normally use main $snapshotsApiTargetBranch = if ($targetBranch -eq "main") { "master" } else { $targetBranch } @@ -30,12 +23,44 @@ if (-not (Test-Path env:MANIFEST_URL) -and (Test-Path env:BUILDKITE_PULL_REQUEST throw $errorMessage } } + +if (-not (Test-Path env:MANIFEST_URL) -and (Test-Path env:BUILDKITE_PULL_REQUEST) -and ($env:BUILDKITE_PULL_REQUEST -ne "false")) { + # we are called via a PR + Write-Host "~~~ Running in pull request mode" + + $targetBranch = $env:BUILDKITE_PULL_REQUEST_BASE_BRANCH + if ( ($targetBranch -ne "main") -and -not ($targetBranch -like $eligibleReleaseBranchesMajor)) { + Write-Host "^^^ +++" + $errorMessage = "This PR is targetting the [$targetBranch] branch, but running tests is only supported against `main` or $eligibleReleaseBranchesMajor major branches. Exiting." + Write-Host $errorMessage + throw $errorMessage + } + + setManifestUrl -targetBranch $targetBranch +} +elseif (-not (Test-Path env:MANIFEST_URL) -and -not ($env:BUILDKITE_SOURCE -ne "trigger_job") -and ($env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG -eq "")) { + # we got triggered by a branch push + Write-Host "~~~ Running in branch push mode" + + $targetBranch = $env:BUILDKITE_PIPELINE_DEFAULT_BRANCH + if ( ($targetBranch -ne "main") -and -not ($targetBranch -like $eligibleReleaseBranchesMajor)) { + Write-Host "^^^ +++" + $errorMessage = "Tests triggered by branch pushes but running tests is only supported against `main` or $eligibleReleaseBranchesMajor major branches. Exiting." + Write-Host $errorMessage + throw $errorMessage + } + + setManifestUrl -targetBranch $targetBranch +} elseif (-not (Test-Path env:MANIFEST_URL)) { # any other invocation of this script (e.g. from unified release) must supply MANIFEST_URL $errorMessage = "Error: Required environment variable [MANIFEST_URL] is missing." Write-Host $errorMessage throw $errorMessage } +else { + Write-Host "~~~ Running via a Buildkite trigger: [$env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG], MANIFEST_URL=[$env:MANIFEST_URL]" +} # workaround path limitation for max 248 characters # example: https://buildkite.com/elastic/elastic-stack-installers/builds/3104#018c5e1b-23a7-4330-ad5d-4acc69157822/74-180 diff --git a/catalog-info.yaml b/catalog-info.yaml index 6b3d3d8..30ecc00 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -47,9 +47,13 @@ spec: spec: pipeline_file: ".buildkite/pipeline.yml" provider_settings: - build_branches: true build_pull_request_forks: false - build_pull_requests: true + build_pull_requests: true # requires filter_enabled and filter_condition settings as below when used with buildkite-pr-bot + build_branches: false + build_tags: false + filter_enabled: true + filter_condition: >- + build.creator.name == 'elasticmachine' && build.pull_request.id != null publish_commit_status: true publish_commit_status_per_step: false repository: elastic/elastic-stack-installers From f6f00976e9393c50a20385828c658f50182399f0 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Tue, 30 Jan 2024 18:22:10 +0200 Subject: [PATCH 04/23] typo --- .buildkite/scripts/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index 4797a2e..7739664 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -38,7 +38,7 @@ if (-not (Test-Path env:MANIFEST_URL) -and (Test-Path env:BUILDKITE_PULL_REQUEST setManifestUrl -targetBranch $targetBranch } -elseif (-not (Test-Path env:MANIFEST_URL) -and -not ($env:BUILDKITE_SOURCE -ne "trigger_job") -and ($env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG -eq "")) { +elseif (-not (Test-Path env:MANIFEST_URL) -and ($env:BUILDKITE_SOURCE -ne "trigger_job") -and ($env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG -eq "")) { # we got triggered by a branch push Write-Host "~~~ Running in branch push mode" From ce3352c2499f1d6c30b718d92945f5fc4f00ddb2 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Tue, 30 Jan 2024 19:28:54 +0200 Subject: [PATCH 05/23] fix test for branch push --- .buildkite/scripts/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index 7739664..a159f19 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -38,7 +38,7 @@ if (-not (Test-Path env:MANIFEST_URL) -and (Test-Path env:BUILDKITE_PULL_REQUEST setManifestUrl -targetBranch $targetBranch } -elseif (-not (Test-Path env:MANIFEST_URL) -and ($env:BUILDKITE_SOURCE -ne "trigger_job") -and ($env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG -eq "")) { +elseif (-not (Test-Path env:MANIFEST_URL) -and ($env:BUILDKITE_SOURCE -ne "trigger_job") -and (-not $env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG)) { # we got triggered by a branch push Write-Host "~~~ Running in branch push mode" From ea4f937423f3dfd57ff51ff7f19b9f6b33c6bb2c Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Tue, 30 Jan 2024 19:45:57 +0200 Subject: [PATCH 06/23] revert --- .buildkite/pull-requests.json | 22 ---------------------- catalog-info.yaml | 8 ++------ 2 files changed, 2 insertions(+), 28 deletions(-) delete mode 100644 .buildkite/pull-requests.json diff --git a/.buildkite/pull-requests.json b/.buildkite/pull-requests.json deleted file mode 100644 index 9a8136b..0000000 --- a/.buildkite/pull-requests.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "jobs": [ - { - "enabled": true, - "pipeline_slug": "elastic-stack-installers", - "allow_org_users": true, - "allowed_repo_permissions": ["admin", "write"], - "allowed_list": ["github-actions[bot]"], - "set_commit_status": true, - "build_on_commit": true, - "build_on_comment": true, - "trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))", - "always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))", - "skip_ci_labels": [ ], - "skip_target_branches": [ ], - "skip_ci_on_only_changed": [ - "^docs/" - ], - "always_require_ci_on_changed": [ ] - } - ] - } diff --git a/catalog-info.yaml b/catalog-info.yaml index 30ecc00..6b3d3d8 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -47,13 +47,9 @@ spec: spec: pipeline_file: ".buildkite/pipeline.yml" provider_settings: + build_branches: true build_pull_request_forks: false - build_pull_requests: true # requires filter_enabled and filter_condition settings as below when used with buildkite-pr-bot - build_branches: false - build_tags: false - filter_enabled: true - filter_condition: >- - build.creator.name == 'elasticmachine' && build.pull_request.id != null + build_pull_requests: true publish_commit_status: true publish_commit_status_per_step: false repository: elastic/elastic-stack-installers From ac3944862017b1f2f105ed672bb252938e9ddc5d Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 17:59:15 +0200 Subject: [PATCH 07/23] Don't run tests when triggered by unified release We don't want to run tests when we are called from the unified release. This commit implemented the suggestion in https://github.com/elastic/elastic-stack-installers/pull/225#issuecomment-1917799498 --- .buildkite/scripts/build.ps1 | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index a159f19..a18a075 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -2,6 +2,7 @@ $ErrorActionPreference = "Stop" Set-Strictmode -version 3 $eligibleReleaseBranchesMajor = "^[8]" +$runTests = $true function setManifestUrl { param ( @@ -60,6 +61,7 @@ elseif (-not (Test-Path env:MANIFEST_URL)) { } else { Write-Host "~~~ Running via a Buildkite trigger: [$env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG], MANIFEST_URL=[$env:MANIFEST_URL]" + $runTests = $false } # workaround path limitation for max 248 characters @@ -181,12 +183,13 @@ if ($msiCount -ne $expected) { Write-Output "Success, found $msiCount artifacts in bin/out." } -# temporarily disabling tests; they'll be re added via https://github.com/elastic/elastic-stack-installers/pull/225 -# try { -# & (Join-Path $PSScriptRoot "test.ps1") -# write-host "Testing Completed" -# } catch { -# write-host "Testing Failed" -# write-error $_ -# exit 1 -# } \ No newline at end of file +if ($runTests) { + try { + & (Join-Path $PSScriptRoot "test.ps1") + write-host "Testing Completed" + } catch { + write-host "Testing Failed" + write-error $_ + exit 1 + } +} From ed214a7dbde6cb40ed16f135d6b0020c2c8b425f Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 17:58:15 +0200 Subject: [PATCH 08/23] Improvements --- .buildkite/pipeline.yml | 9 ++++----- .buildkite/scripts/build.ps1 | 23 +++++++++++++++-------- .buildkite/scripts/test.ps1 | 1 + catalog-info.yaml | 5 +++++ 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index dde4377..1db9641 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,7 +1,5 @@ ### ### The following environment variables can be set for testing purposes via the buildkite UI or CLI -### RUN_SNAPSHOT: "true" - will run the snapshot workflow -### RUN_STAGING: "true" - will run the staging workflow ### ONLY_AGENT: "true" - will build only the elastic-agent msi artifact ### @@ -19,7 +17,8 @@ steps: env: DRA_WORKFLOW: "snapshot" - label: ":package: DRA Publish Snapshot" - if: build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/ || build.env("RUN_SNAPSHOT") == "true" + # only allow when triggered from unified release or via PRs, but PRs run it in dry-run mode (see dra-publish.sh) + if: (BUILDKITE_PULL_REQUEST != "false") || ((build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-snapshot") command: ".buildkite/scripts/dra-publish.sh" key: "publish-snapshot" depends_on: "build-snapshot" @@ -31,7 +30,6 @@ steps: key: "dra-staging" steps: - label: ":construction_worker: Build stack installers / Staging" - if: build.branch =~ /^[0-9]+\.[0-9]+\$/ || build.env("RUN_STAGING") == "true" command: ".buildkite/scripts/build.ps1" key: "build-staging" artifact_paths: "c:/users/buildkite/esi/bin/out/**/*.msi" @@ -41,7 +39,8 @@ steps: env: DRA_WORKFLOW: "staging" - label: ":package: DRA Publish staging" - if: build.branch =~ /^[0-9]+\.[0-9]+\$/ || build.env("RUN_STAGING") == "true" + # only allow when triggered from unified release or via PRs, but PRs run it in dry-run mode (see dra-publish.sh) + if: (BUILDKITE_PULL_REQUEST != "false") || ((build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-staging") command: ".buildkite/scripts/dra-publish.sh" key: "publish-staging" depends_on: "build-staging" diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index a18a075..bf05efc 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -1,26 +1,33 @@ $ErrorActionPreference = "Stop" Set-Strictmode -version 3 -$eligibleReleaseBranchesMajor = "^[8]" +$eligibleReleaseBranchesMajor = "^[89]" $runTests = $true +$draWorkflow = $env:DRA_WORKFLOW + +if (-not (Test-Path env:DRA_WORKFLOW)) { + $errorMessage = "Error: Required environment variable [DRA_WORKFLOW] is missing." + Write-Host $errorMessage + throw $errorMessage +} function setManifestUrl { param ( [string]$targetBranch ) - # the snapshot API url expects master where we normally use main - $snapshotsApiTargetBranch = if ($targetBranch -eq "main") { "master" } else { $targetBranch } + # the API url (snapshot or staging) expects master where we normally use main + $ApiTargetBranch = if ($targetBranch -eq "main") { "master" } else { $targetBranch } - $snapshotsUrl = "https://snapshots.elastic.co/latest/$snapshotsApiTargetBranch.json" - Write-Host "snapshots url is $snapshotsUrl" + $artifactsUrl = "https://${draWorkflow}.elastic.co/latest/${ApiTargetBranch}.json" + Write-Host "snapshots url is $artifactsUrl" try { - $response = Invoke-WebRequest -UseBasicParsing -Uri $snapshotsUrl + $response = Invoke-WebRequest -UseBasicParsing -Uri $artifactsUrl $responseJson = $response.Content | ConvertFrom-Json $env:MANIFEST_URL = $responseJson.manifest_url Write-Host "Using MANIFEST_URL=$env:MANIFEST_URL" } catch { - $errorMessage = "There was an error parsing manifest_url from $snapshotsUrl. Exiting." + $errorMessage = "There was an error parsing manifest_url from $artifactsUrl. Exiting." throw $errorMessage } } @@ -39,7 +46,7 @@ if (-not (Test-Path env:MANIFEST_URL) -and (Test-Path env:BUILDKITE_PULL_REQUEST setManifestUrl -targetBranch $targetBranch } -elseif (-not (Test-Path env:MANIFEST_URL) -and ($env:BUILDKITE_SOURCE -ne "trigger_job") -and (-not $env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG)) { +elseif (-not (Test-Path env:MANIFEST_URL) -and ($env:BUILDKITE_SOURCE -ne "trigger_job") -and ($env:BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG -notlike "unified-release*")) { # we got triggered by a branch push Write-Host "~~~ Running in branch push mode" diff --git a/.buildkite/scripts/test.ps1 b/.buildkite/scripts/test.ps1 index a101aa2..f9163f8 100644 --- a/.buildkite/scripts/test.ps1 +++ b/.buildkite/scripts/test.ps1 @@ -1,6 +1,7 @@ $ErrorActionPreference = "Stop" Set-Strictmode -version 3 +Write-Host "--- Running Tests" write-host (ConvertTo-Json $PSVersiontable -Compress) write-host "Running as: $([Environment]::UserName)" diff --git a/catalog-info.yaml b/catalog-info.yaml index 6b3d3d8..f2783d5 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -58,6 +58,11 @@ spec: access_level: BUILD_AND_READ ingest-fp: {} release-eng: {} + env: + ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true' + SLACK_NOTIFICATIONS_CHANNEL: '#ingest-notifications' + SLACK_NOTIFICATIONS_ON_SUCCESS: 'false' + --- # yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json apiVersion: backstage.io/v1alpha1 From 779716c7a6a8cb6b57da3d9be7719ffdc4103c77 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:01:52 +0200 Subject: [PATCH 09/23] fix conditional --- .buildkite/pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 1db9641..cf91bf6 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -18,7 +18,7 @@ steps: DRA_WORKFLOW: "snapshot" - label: ":package: DRA Publish Snapshot" # only allow when triggered from unified release or via PRs, but PRs run it in dry-run mode (see dra-publish.sh) - if: (BUILDKITE_PULL_REQUEST != "false") || ((build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-snapshot") + if: (build.env("BUILDKITE_PULL_REQUEST") != "false") || ((build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-snapshot") command: ".buildkite/scripts/dra-publish.sh" key: "publish-snapshot" depends_on: "build-snapshot" @@ -40,7 +40,7 @@ steps: DRA_WORKFLOW: "staging" - label: ":package: DRA Publish staging" # only allow when triggered from unified release or via PRs, but PRs run it in dry-run mode (see dra-publish.sh) - if: (BUILDKITE_PULL_REQUEST != "false") || ((build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-staging") + if: (build.env("BUILDKITE_PULL_REQUEST") != "false") || ((build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-staging") command: ".buildkite/scripts/dra-publish.sh" key: "publish-staging" depends_on: "build-staging" From 3675bd17551870e7c35d454918ab731b0543d89c Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:11:37 +0200 Subject: [PATCH 10/23] debug --- .buildkite/pipeline.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index cf91bf6..90a765b 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -17,8 +17,10 @@ steps: env: DRA_WORKFLOW: "snapshot" - label: ":package: DRA Publish Snapshot" - # only allow when triggered from unified release or via PRs, but PRs run it in dry-run mode (see dra-publish.sh) - if: (build.env("BUILDKITE_PULL_REQUEST") != "false") || ((build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-snapshot") + if: | + // Only run when triggered from Unified Release or via PRs. Note that PRs run it in dry-run mode (see dra-publish.sh) + (build.env("BUILDKITE_PULL_REQUEST") != "false") || + ((build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-snapshot") command: ".buildkite/scripts/dra-publish.sh" key: "publish-snapshot" depends_on: "build-snapshot" @@ -40,7 +42,7 @@ steps: DRA_WORKFLOW: "staging" - label: ":package: DRA Publish staging" # only allow when triggered from unified release or via PRs, but PRs run it in dry-run mode (see dra-publish.sh) - if: (build.env("BUILDKITE_PULL_REQUEST") != "false") || ((build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-staging") + # if: (build.env("BUILDKITE_PULL_REQUEST") != "false") || ((build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-staging") command: ".buildkite/scripts/dra-publish.sh" key: "publish-staging" depends_on: "build-staging" From 2f88a5ae7bb886a5af5fc37206e679344245c156 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:12:51 +0200 Subject: [PATCH 11/23] tinkering with conditionals --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 90a765b..49df130 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -19,7 +19,7 @@ steps: - label: ":package: DRA Publish Snapshot" if: | // Only run when triggered from Unified Release or via PRs. Note that PRs run it in dry-run mode (see dra-publish.sh) - (build.env("BUILDKITE_PULL_REQUEST") != "false") || + build.env("BUILDKITE_PULL_REQUEST") != "false" || ((build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-snapshot") command: ".buildkite/scripts/dra-publish.sh" key: "publish-snapshot" From 5bfa2b94f24b4e83b3768d355e092f2b1650644c Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:14:01 +0200 Subject: [PATCH 12/23] conditionals #2 --- .buildkite/pipeline.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 49df130..5234c45 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -19,8 +19,7 @@ steps: - label: ":package: DRA Publish Snapshot" if: | // Only run when triggered from Unified Release or via PRs. Note that PRs run it in dry-run mode (see dra-publish.sh) - build.env("BUILDKITE_PULL_REQUEST") != "false" || - ((build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-snapshot") + build.env("BUILDKITE_PULL_REQUEST") != "false" command: ".buildkite/scripts/dra-publish.sh" key: "publish-snapshot" depends_on: "build-snapshot" From d9e2d3fd8d7a5d6d55280787715973f6cf830c43 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:18:08 +0200 Subject: [PATCH 13/23] more fixes --- .buildkite/pipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 5234c45..de95742 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -19,7 +19,8 @@ steps: - label: ":package: DRA Publish Snapshot" if: | // Only run when triggered from Unified Release or via PRs. Note that PRs run it in dry-run mode (see dra-publish.sh) - build.env("BUILDKITE_PULL_REQUEST") != "false" + build.env("BUILDKITE_PULL_REQUEST") != "false" || + ( (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-snapshot") command: ".buildkite/scripts/dra-publish.sh" key: "publish-snapshot" depends_on: "build-snapshot" From 8cf163ac0da1b7331b4e0b8b9a93fa71f92c2ca1 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:19:07 +0200 Subject: [PATCH 14/23] fixed conditionals --- .buildkite/pipeline.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index de95742..e216a45 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -20,7 +20,7 @@ steps: if: | // Only run when triggered from Unified Release or via PRs. Note that PRs run it in dry-run mode (see dra-publish.sh) build.env("BUILDKITE_PULL_REQUEST") != "false" || - ( (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-snapshot") + ( (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-snapshot" ) command: ".buildkite/scripts/dra-publish.sh" key: "publish-snapshot" depends_on: "build-snapshot" @@ -41,8 +41,9 @@ steps: env: DRA_WORKFLOW: "staging" - label: ":package: DRA Publish staging" - # only allow when triggered from unified release or via PRs, but PRs run it in dry-run mode (see dra-publish.sh) - # if: (build.env("BUILDKITE_PULL_REQUEST") != "false") || ((build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG" == "unified-release-staging") + // Only run when triggered from Unified Release or via PRs. Note that PRs run it in dry-run mode (see dra-publish.sh) + build.env("BUILDKITE_PULL_REQUEST") != "false" || + ( (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/dra-publish.sh" key: "publish-staging" depends_on: "build-staging" From 861564cc300efc11873c42f397425d46503c2573 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:21:05 +0200 Subject: [PATCH 15/23] one more fix for conditionals --- .buildkite/pipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index e216a45..336d7aa 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -41,6 +41,7 @@ steps: env: DRA_WORKFLOW: "staging" - label: ":package: DRA Publish staging" + if: | // Only run when triggered from Unified Release or via PRs. Note that PRs run it in dry-run mode (see dra-publish.sh) build.env("BUILDKITE_PULL_REQUEST") != "false" || ( (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) From d184e8705db0570d6982f24ae6b1a0984b4d5f3c Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:34:54 +0200 Subject: [PATCH 16/23] don't run staging when pull requests target non main --- .buildkite/pipeline.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 336d7aa..cb1358a 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -32,6 +32,10 @@ steps: key: "dra-staging" steps: - label: ":construction_worker: Build stack installers / Staging" + if: | + // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. + (build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH" =~ /^[0-9]+\.[0-9]+\$/) || + ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/build.ps1" key: "build-staging" artifact_paths: "c:/users/buildkite/esi/bin/out/**/*.msi" @@ -42,9 +46,9 @@ steps: DRA_WORKFLOW: "staging" - label: ":package: DRA Publish staging" if: | - // Only run when triggered from Unified Release or via PRs. Note that PRs run it in dry-run mode (see dra-publish.sh) - build.env("BUILDKITE_PULL_REQUEST") != "false" || - ( (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) + // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. + (build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH" =~ /^[0-9]+\.[0-9]+\$/) || + ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/dra-publish.sh" key: "publish-staging" depends_on: "build-staging" @@ -52,7 +56,3 @@ steps: provider: gcp env: DRA_WORKFLOW: "staging" - -notify: - - slack: "#ingest-notifications" - if: build.branch == 'main' From b3eff461b92a1814cd95c62a9591137175845c17 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:36:06 +0200 Subject: [PATCH 17/23] fix# Please enter the commit message for your changes. Lines starting --- .buildkite/pipeline.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index cb1358a..75a4d4d 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -34,7 +34,7 @@ steps: - label: ":construction_worker: Build stack installers / Staging" if: | // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. - (build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH" =~ /^[0-9]+\.[0-9]+\$/) || + (build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/) || ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/build.ps1" key: "build-staging" @@ -47,7 +47,8 @@ steps: - label: ":package: DRA Publish staging" if: | // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. - (build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH" =~ /^[0-9]+\.[0-9]+\$/) || + // Note that PRs run this step in dry-run mode (see dra-publish.sh) + (build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/) || ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/dra-publish.sh" key: "publish-staging" From 78daaffa99d63606b198f37a2e06871382ca94c8 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:39:27 +0200 Subject: [PATCH 18/23] debug --- .buildkite/pipeline.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 75a4d4d..8e5d57d 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -34,7 +34,7 @@ steps: - label: ":construction_worker: Build stack installers / Staging" if: | // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. - (build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/) || + ( build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/ ) || ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/build.ps1" key: "build-staging" @@ -45,11 +45,6 @@ steps: env: DRA_WORKFLOW: "staging" - label: ":package: DRA Publish staging" - if: | - // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. - // Note that PRs run this step in dry-run mode (see dra-publish.sh) - (build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/) || - ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/dra-publish.sh" key: "publish-staging" depends_on: "build-staging" From 57f2b828848756a352e2455a039a2271c34039fc Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:40:19 +0200 Subject: [PATCH 19/23] debug --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 8e5d57d..e7f74fb 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -34,7 +34,7 @@ steps: - label: ":construction_worker: Build stack installers / Staging" if: | // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. - ( build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/ ) || + build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/ || ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/build.ps1" key: "build-staging" From dd10979b39dc2dabac687aa44cd87c451f631ce4 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:41:29 +0200 Subject: [PATCH 20/23] back to working? --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index e7f74fb..a2a0c08 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -34,7 +34,7 @@ steps: - label: ":construction_worker: Build stack installers / Staging" if: | // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. - build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/ || + build.env("BUILDKITE_PULL_REQUEST") != "false" || ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/build.ps1" key: "build-staging" From 2677adbcf77ba980cc2effca6481e851e4618400 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 18:43:14 +0200 Subject: [PATCH 21/23] fixed? --- .buildkite/pipeline.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index a2a0c08..940fb14 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -34,8 +34,8 @@ steps: - label: ":construction_worker: Build stack installers / Staging" if: | // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. - build.env("BUILDKITE_PULL_REQUEST") != "false" || - ( build.branch =~ /^[0-9]+\.[0-9]+\$/) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) + ( build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/ ) || + ( build.branch =~ /^[0-9]+\.[0-9]+\$/ && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/build.ps1" key: "build-staging" artifact_paths: "c:/users/buildkite/esi/bin/out/**/*.msi" @@ -45,6 +45,11 @@ steps: env: DRA_WORKFLOW: "staging" - label: ":package: DRA Publish staging" + if: | + // Only run when triggered from Unified Release or via PRs targetting non-main, since there is no valid MANIFEST_URL for staging/main branch. + // Note that PRs run it in dry-run mode (see dra-publish.sh) + ( build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("BUILDKITE_PULL_REQUEST_BASE_BRANCH") =~ /^[0-9]+\.[0-9]+\$/ ) || + ( build.branch =~ /^[0-9]+\.[0-9]+\$/ && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" ) command: ".buildkite/scripts/dra-publish.sh" key: "publish-staging" depends_on: "build-staging" From 82f662d1ccf4ae6e78843fc0b749322c16d40ece Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 19:05:35 +0200 Subject: [PATCH 22/23] fixed2? --- .buildkite/scripts/build.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index bf05efc..604dbf5 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -3,7 +3,7 @@ Set-Strictmode -version 3 $eligibleReleaseBranchesMajor = "^[89]" $runTests = $true -$draWorkflow = $env:DRA_WORKFLOW + if (-not (Test-Path env:DRA_WORKFLOW)) { $errorMessage = "Error: Required environment variable [DRA_WORKFLOW] is missing." @@ -19,7 +19,17 @@ function setManifestUrl { # the API url (snapshot or staging) expects master where we normally use main $ApiTargetBranch = if ($targetBranch -eq "main") { "master" } else { $targetBranch } - $artifactsUrl = "https://${draWorkflow}.elastic.co/latest/${ApiTargetBranch}.json" + if ($env:DRA_WORKFLOW -like "*snapshot*") { + $artifactsUrl = "https://snapshots.elastic.co/latest/${ApiTargetBranch}.json" + } elseif ($env:DRA_WORKFLOW -like "*staging*") { + $artifactsUrl = "https://staging.elastic.co/latest/${ApiTargetBranch}.json" + } else { + $errorMessage = "Error: Required environment variable [DRA_WORKFLOW] must be snapshot or staging but it was [${env:DRA_WORKFLOW}]." + Write-Host $errorMessage + throw $errorMessage + } + + $artifactsUrl = "https://${urlPrefix}.elastic.co/latest/${ApiTargetBranch}.json" Write-Host "snapshots url is $artifactsUrl" try { $response = Invoke-WebRequest -UseBasicParsing -Uri $artifactsUrl From 8826b0df7ff643046b942d10ce600f84df531175 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Fri, 2 Feb 2024 19:09:33 +0200 Subject: [PATCH 23/23] bug --- .buildkite/scripts/build.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.buildkite/scripts/build.ps1 b/.buildkite/scripts/build.ps1 index 604dbf5..50b5624 100755 --- a/.buildkite/scripts/build.ps1 +++ b/.buildkite/scripts/build.ps1 @@ -29,8 +29,7 @@ function setManifestUrl { throw $errorMessage } - $artifactsUrl = "https://${urlPrefix}.elastic.co/latest/${ApiTargetBranch}.json" - Write-Host "snapshots url is $artifactsUrl" + Write-Host "Artifacts url is: $artifactsUrl" try { $response = Invoke-WebRequest -UseBasicParsing -Uri $artifactsUrl $responseJson = $response.Content | ConvertFrom-Json