Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smoke-test: sort latest versions using the semver format #12229

Merged
merged 3 commits into from
Dec 17, 2023

Conversation

v1v
Copy link
Member

@v1v v1v commented Dec 15, 2023

Motivation/summary

sort in jq does not sort by number.

sort_by is the alternative but to do so it's required to do some transformation when sorting SNAPSHOTS.

This should help with running the smoke tests against the latest versions rather than the latest non-semver which points to 8.9.2

image

Checklist

For functional changes, consider:

  • Is it observable through the addition of either logging or metrics?
  • Is its use being published in telemetry to enable product improvement?
  • Have system tests been added to avoid regression?

How to test these changes

You can run it locally by downloading the JSON file with all the versions:

$  curl -H "Authorization: ApiKey ${EC_API_KEY}" \
  "https://cloud.elastic.co/api/v1/regions/gcp-us-west2/stack/versions?show_deleted=false&show_unusable=false" > f.json

Then

$ cat f.json \
  | jq -r -c '[.stacks[].version | select(. | contains("-SNAPSHOT"))] | sort' | sed 's#-SNAPSHOT#.0#g' \
  | jq -r -c ' sort_by(.| split(".") | map(tonumber))' \
  | sed 's#.0"#-SNAPSHOT"#g' \
  | jq -r -c .
["6.8.19-SNAPSHOT","6.8.20-SNAPSHOT", ..."8.11.3-SNAPSHOT","8.12.0-SNAPSHOT","8.13.0-SNAPSHOT"]

and

$ cat f.json | jq -r -c '[.stacks[].version | select(. | contains("-")) |= gsub("-.*"; "")] | sort_by(.| split(".") | map(tonumber))'
["5.5.1","5.5.2"," ...."8.11.3","8.11.3","8.12.0","8.12.0","8.13.0"]

Then, in the CI itself, I ran the workflow using a Test branch called test/latest-version-smoke-tests - the one that contains these changes plus some minor changes in the GitHub workflow.

This build is the one running against the above-mentioned branch.

This GH job is using the latest snapshot:

image

This GH job is using the latest release:

image

Related issues

@v1v v1v added automation backport-skip Skip notification from the automated backport with mergify labels Dec 15, 2023
@v1v v1v requested a review from a team December 15, 2023 08:51
@v1v v1v self-assigned this Dec 15, 2023
@v1v v1v requested a review from a team as a code owner December 15, 2023 08:51
@kruskall kruskall enabled auto-merge (squash) December 15, 2023 17:55
@kruskall kruskall disabled auto-merge December 15, 2023 17:55
@v1v v1v merged commit 5158fea into main Dec 17, 2023
7 checks passed
@v1v v1v deleted the fix/get-latest-versions branch December 17, 2023 16:34
v1v added a commit to v1v/apm-server that referenced this pull request Dec 21, 2023
…r-elastic

* upstream/main:
  [updatecli] Bump elastic stack version to 8.13.0-yufkxnwm (elastic#12246)
  Remove Nassim Kammah from list of maintainers (elastic#12269)
  docs: Add tagged regions to changelog (elastic#12251)
  Update apm data (elastic#12242)
  Revert "Revise wait_for_integration ES implementation (elastic#12150)" (elastic#12240)
  ci(release): automate release steps (elastic#12234)
  build(deps): bump the github-actions group with 1 update (elastic#12232)
  [updatecli] Update to elastic/beats@a633696068ed (elastic#12164)
  [updatecli] Bump elastic stack version to 8.13.0-h30gube9 (elastic#12235)
  smoke-test: semver sort latest versions (elastic#12229)
  [updatecli] Bump Golang version to 1.21.5 (elastic#12191)
  fix: always try to remap both span and error stacktraces (elastic#12221)
  [updatecli] Bump elastic stack version to 8.13.0-6av99u5d (elastic#12169)
  docs: Update changelogs for 8.12 release (elastic#12172)
amannocci pushed a commit that referenced this pull request Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation backport-skip Skip notification from the automated backport with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants