elastic / elastic-stack-installers

Windows MSI packages for Elastic stack
Apache License 2.0
2 stars 16 forks source link

Selectively skip and fix tests after PR#212 #225

Closed dliappis closed 9 months ago

dliappis commented 10 months ago

PR #212 made some changes on main 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 skips tests when triggered from another pipeline (unified release), and allows running tests when triggered by PR creation, or branch pushed by picking up a suitable MANIFEST_URL.

dliappis commented 10 months ago

This is ready for review. Because of the multiple ways that this pipeline may run -- via unified release trigger, via branch commits or pr commits -- we need to support a different way of running depending on the occasion:

1) If we open the PR it (e.g. the latest commit here: https://buildkite.com/elastic/elastic-stack-installers/builds/3646) it looks like:

![image](https://github.com/elastic/elastic-stack-installers/assets/1754575/b1230220-a88e-4553-b85e-d256b6c41426)

2) If the pipeline gets triggered by the unified release it should run as before (and allow to go through the DRA publish).

3) Special handling is done for staging builds:

- Unified release may trigger the pipeline but only for non main branches and specifically if they target `[0-9]+.[0-9]+` matching branches. Tests are skipped.
- PRs are only allowed to run the steps (including tests) if they target non-main branch (the reason is that there is no https://staging.elastic.co/latest/main.json, so we can't deduce a valid `MANIFEST_URL`)

4) We've removed runs based on push events -- e.g. cutting a new branch from main -- (which used to be allowed before); this is because it complicates unnecessarily the conditionals. This use case (and more) will be covered in a follow up PR, through a scheduled job that runs at regular intervals.

Example run: https://buildkite.com/elastic/elastic-stack-installers/builds/3718#018d6acc-6f2e-43b8-b8ea-3514dd9f919e using this PR

dliappis commented 10 months ago

@strawgate to implement what we discussed in do you think it would it be enough to just present a variable here (which is the conditional that covers the case that our job/scripts gets triggered from the unified release) and conditionally run tests in https://github.com/elastic/elastic-stack-installers/blob/d1bdb21c8a0e159e079bda52186e5bed8b542187/.buildkite/scripts/build.ps1#L185 only if the var is present?

strawgate commented 10 months ago

@strawgate to implement what we discussed in do you think it would it be enough to just present a variable here (which is the conditional that covers the case that our job/scripts gets triggered from the unified release) and conditionally run tests in

https://github.com/elastic/elastic-stack-installers/blob/d1bdb21c8a0e159e079bda52186e5bed8b542187/.buildkite/scripts/build.ps1#L185

only if the var is present?

Yes!

dliappis commented 10 months ago

@strawgate to implement what we discussed in do you think it would it be enough to just present a variable here (which is the conditional that covers the case that our job/scripts gets triggered from the unified release) and conditionally run tests in https://github.com/elastic/elastic-stack-installers/blob/d1bdb21c8a0e159e079bda52186e5bed8b542187/.buildkite/scripts/build.ps1#L185

only if the var is present?

Yes!

@strawgate this has been implemented in b1c05bae4746870179483a0f75a16e8d54569a02 . Please take a look.

dliappis commented 9 months ago

close https://github.com/elastic/elastic-stack-installers/pull/225 in favor of https://github.com/elastic/elastic-stack-installers/pull/235