Skip to content

Commit

Permalink
Add Find Supported OpenSearch Versions workflow
Browse files Browse the repository at this point in the history
Note; this workflow doesn't work properly when run on ubuntu, but it works on an AL2 machine.  Tailing the output of grep does not appear to limit the results as expected

```
C:\Users\petern\Documents\GitHub\opensearch-build [test-wf +0 ~2 -0 !]> act -j find-latest-versions
[Find Supported OpenSearch Versions/find-latest-versions] 🚀  Start image=catthehacker/ubuntu:act-latest
[Find Supported OpenSearch Versions/find-latest-versions]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Find Supported OpenSearch Versions/find-latest-versions]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Find Supported OpenSearch Versions/find-latest-versions] ⭐ Run Main actions/checkout@v2
[Find Supported OpenSearch Versions/find-latest-versions]   🐳  docker cp src=C:\Users\petern\Documents\GitHub\opensearch-build\. dst=/mnt/c/Users/petern/Documents/GitHub/opensearch-build
[Find Supported OpenSearch Versions/find-latest-versions]   ✅  Success - Main actions/checkout@v2
[Find Supported OpenSearch Versions/find-latest-versions] ⭐ Run Main export all=$(ls manifests/**/opensearch*.yml | cut -d'/' -f2 | sort | uniq | grep -vE ^1\.4\.0)
export majors=$(ls manifests/**/opensearch*.yml | cut -d'/' -f2 | sort | uniq | cut -c 1 | uniq)
export latest_versions=$(echo $major | while IFS=$"\n" read -r c; do echo $(echo $all | grep ^$c | tail -n 1); done)
echo Majors are $majors
echo Latest Versions are $latest_versions
echo "::set-output name=latest_versions::$(echo $latest_versions)"
[Find Supported OpenSearch Versions/find-latest-versions]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/echo-value] user= workdir=
| All is 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 2.0.0 2.0.0-rc1 2.0.1 2.0.2 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.4.0 3.0.0
| Majors are 1 2 3
| Latest Versions are 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 2.0.0 2.0.0-rc1 2.0.1 2.0.2 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.4.0 3.0.0
[Find Supported OpenSearch Versions/find-latest-versions]   ⚙  ::set-output:: latest_versions=1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 2.0.0 2.0.0-rc1 2.0.1 2.0.2 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.4.0 3.0.0
[Find Supported OpenSearch Versions/find-latest-versions]   ✅  Success - Main export all=$(ls manifests/**/opensearch*.yml | cut -d'/' -f2 | sort | uniq | grep -vE ^1\.4\.0)
export majors=$(ls manifests/**/opensearch*.yml | cut -d'/' -f2 | sort | uniq | cut -c 1 | uniq)
export latest_versions=$(echo $major | while IFS=$"\n" read -r c; do echo $(echo $all | grep ^$c | tail -n 1); done)
echo All is $all
echo Majors are $majors
echo Latest Versions are $latest_versions
echo "::set-output name=latest_versions::$(echo $latest_versions)"
[Find Supported OpenSearch Versions/find-latest-versions] ⭐ Run Main echo ${{ steps.echo-value.outputs.latest_versions}}
[Find Supported OpenSearch Versions/find-latest-versions]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/echo-done] user= workdir=
| 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 2.0.0 2.0.0-rc1 2.0.1 2.0.2 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.4.0 3.0.0
[Find Supported OpenSearch Versions/find-latest-versions]   ✅  Success - Main echo ${{ steps.echo-value.outputs.latest_versions}}
[Find Supported OpenSearch Versions/find-latest-versions] 🏁  Job succeeded
```

Signed-off-by: Peter Nied <petern@amazon.com>
  • Loading branch information
peternied committed Oct 20, 2022
1 parent b85f95e commit 51128d1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/test-wf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Find Supported OpenSearch Versions

on:
workflow_dispatch:

jobs:
find-latest-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: echo-value
run: |
export all=$(ls manifests/**/opensearch*.yml | cut -d'/' -f2 | sort | uniq | grep -vE ^1\.4\.0)
export majors=$(ls manifests/**/opensearch*.yml | cut -d'/' -f2 | sort | uniq | cut -c 1 | uniq)
export latest_versions=$(echo $major | while IFS=$"\n" read -r c; do echo $(echo $all | grep ^$c | tail -n 1); done)
echo All is $all
echo Majors are $majors
echo Latest Versions are $latest_versions

This comment has been minimized.

Copy link
@peternied

peternied Oct 20, 2022

Author Member

See this work unexpectedly in GitHub Actions [1] or run it locally with Act [2] which is way faster for testing/iterating.

[1] https://github.com/peternied/opensearch-build/actions/runs/3291889559/jobs/5426604254
[2] https://github.com/nektos/act

echo "::set-output name=latest_versions::$(echo $latest_versions)"
- id: echo-done
run: echo ${{ steps.echo-value.outputs.latest_versions}}

0 comments on commit 51128d1

Please sign in to comment.