Skip to content

Commit 943870a

Browse files
Sync GitHub workflows from main (#13790)
Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com>
1 parent 6447300 commit 943870a

8 files changed

+173
-54
lines changed

.github/workflows/assemble.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Gradle Assemble
2+
on: [pull_request]
3+
4+
jobs:
5+
assemble:
6+
if: github.repository == 'opensearch-project/OpenSearch'
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
java: [ 11 ]
11+
os: [ubuntu-latest, windows-latest, macos-13]
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up JDK ${{ matrix.java }}
15+
uses: actions/setup-java@v4
16+
with:
17+
java-version: ${{ matrix.java }}
18+
distribution: temurin
19+
- name: Setup docker (missing on MacOS)
20+
if: runner.os == 'macos'
21+
uses: douglascamata/setup-docker-macos-action@main
22+
- name: Run Gradle (assemble)
23+
if: ${{ runner.os == 'Windows' }}
24+
run: |
25+
./gradlew assemble -x :distribution:docker:buildArm64DockerImage -x :distribution:docker:buildDockerImage -x :distribution:docker:buildPpc64leDockerImage --parallel --no-build-cache -PDISABLE_BUILD_CACHE
26+
- name: Run Gradle (assemble)
27+
if: ${{ runner.os != 'Windows' }}
28+
run: |
29+
./gradlew assemble --parallel --no-build-cache -PDISABLE_BUILD_CACHE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Copy labels from linked issues
2+
on:
3+
pull_request_target:
4+
types: [opened, edited, review_requested, synchronize, reopened, ready_for_review]
5+
6+
jobs:
7+
copy-issue-labels:
8+
if: github.repository == 'opensearch-project/OpenSearch'
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: read
12+
contents: read
13+
pull-requests: write
14+
steps:
15+
- name: copy-issue-labels
16+
uses: michalvankodev/copy-issue-labels@v1.3.0
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
labels-to-exclude: |
20+
untriaged
21+
triaged

.github/workflows/dependabot_pr.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ jobs:
77
permissions:
88
pull-requests: write
99
contents: write
10-
if: ${{ github.actor == 'dependabot[bot]' }}
10+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
1111
steps:
1212
- name: GitHub App token
1313
id: github_app_token
14-
uses: tibdex/github-app-token@v1.5.0
14+
uses: tibdex/github-app-token@v2.1.0
1515
with:
1616
app_id: ${{ secrets.APP_ID }}
1717
private_key: ${{ secrets.APP_PRIVATE_KEY }}
1818
installation_id: 22958780
1919

2020
- name: Check out code
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2222
with:
2323
token: ${{ steps.github_app_token.outputs.token }}
2424

@@ -27,7 +27,7 @@ jobs:
2727
./gradlew updateSHAs
2828
2929
- name: Commit the changes
30-
uses: stefanzweifel/git-auto-commit-action@v4.7.2
30+
uses: stefanzweifel/git-auto-commit-action@v5
3131
with:
3232
commit_message: Updating SHAs
3333
branch: ${{ github.head_ref }}
@@ -40,7 +40,7 @@ jobs:
4040
./gradlew spotlessApply
4141
4242
- name: Commit the changes
43-
uses: stefanzweifel/git-auto-commit-action@v4.7.2
43+
uses: stefanzweifel/git-auto-commit-action@v5
4444
with:
4545
commit_message: Spotless formatting
4646
branch: ${{ github.head_ref }}
@@ -49,12 +49,12 @@ jobs:
4949
commit_options: '--signoff'
5050

5151
- name: Update the changelog
52-
uses: dangoslen/dependabot-changelog-helper@v1
52+
uses: dangoslen/dependabot-changelog-helper@v3
5353
with:
5454
version: 'Unreleased'
5555

5656
- name: Commit the changes
57-
uses: stefanzweifel/git-auto-commit-action@v4
57+
uses: stefanzweifel/git-auto-commit-action@v5
5858
with:
5959
commit_message: "Update changelog"
6060
branch: ${{ github.head_ref }}

.github/workflows/gradle-check.yml

+91-27
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,73 @@ on:
88
pull_request_target:
99
types: [opened, synchronize, reopened]
1010

11+
permissions:
12+
contents: read # to fetch code (actions/checkout)
13+
1114
jobs:
1215
gradle-check:
16+
if: github.repository == 'opensearch-project/OpenSearch'
17+
permissions:
18+
contents: read # to fetch code (actions/checkout)
19+
pull-requests: write # to create or update comment (peter-evans/create-or-update-comment)
20+
issues: write # To create an issue if check fails on push.
21+
1322
runs-on: ubuntu-latest
1423
timeout-minutes: 130
1524
steps:
1625
- name: Checkout OpenSearch repo
17-
uses: actions/checkout@v2
26+
uses: actions/checkout@v4
1827
with:
1928
ref: ${{ github.event.pull_request.head.sha }}
2029

2130
- name: Setup environment variables (PR)
2231
if: github.event_name == 'pull_request_target'
2332
run: |
24-
echo "pr_from_sha=$(jq --raw-output .pull_request.head.sha $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
25-
echo "pr_from_clone_url=$(jq --raw-output .pull_request.head.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
26-
echo "pr_to_clone_url=$(jq --raw-output .pull_request.base.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
27-
echo "pr_title=$(jq --raw-output .pull_request.title $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
28-
echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
33+
echo "event_name=pull_request_target" >> $GITHUB_ENV
34+
echo "branch_name=$(jq --raw-output .pull_request.base.ref $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
35+
echo "pr_from_sha=$(jq --raw-output .pull_request.head.sha $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
36+
echo "pr_from_clone_url=$(jq --raw-output .pull_request.head.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
37+
echo "pr_to_clone_url=$(jq --raw-output .pull_request.base.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
38+
echo "pr_title=$(jq --raw-output .pull_request.title $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
39+
echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
40+
echo "pr_owner=$(jq --raw-output .pull_request.user.login $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
41+
echo "pr_or_commit_description=$(jq --ascii-output .pull_request.body $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
42+
echo "post_merge_action=false" >> $GITHUB_ENV
43+
44+
# to get the PR data that can be used for post merge actions
45+
- uses: actions/github-script@v7
46+
if: github.event_name == 'push'
47+
id: get_pr_data
48+
with:
49+
github-token: ${{secrets.GITHUB_TOKEN}}
50+
script: |
51+
return (
52+
await github.rest.repos.listPullRequestsAssociatedWithCommit({
53+
commit_sha: context.sha,
54+
owner: context.repo.owner,
55+
repo: context.repo.repo,
56+
})
57+
).data[0];
2958
3059
- name: Setup environment variables (Push)
3160
if: github.event_name == 'push'
3261
run: |
33-
repo_url="https://github.com/opensearch-project/OpenSearch"
34-
ref_id=$(git rev-parse HEAD)
35-
branch_name=$(git rev-parse --abbrev-ref HEAD)
36-
echo "pr_from_sha=$ref_id" >> $GITHUB_ENV
37-
echo "pr_from_clone_url=$repo_url" >> $GITHUB_ENV
38-
echo "pr_to_clone_url=$repo_url" >> $GITHUB_ENV
39-
echo "pr_title=Push trigger $branch_name $ref_id $repo_url" >> $GITHUB_ENV
40-
echo "pr_number=Null" >> $GITHUB_ENV
62+
repo_url="https://github.com/opensearch-project/OpenSearch"
63+
ref_id=$(git rev-parse HEAD)
64+
branch_name=$(git rev-parse --abbrev-ref HEAD)
65+
echo "branch_name=$branch_name" >> $GITHUB_ENV
66+
echo "event_name=push" >> $GITHUB_ENV
67+
echo "pr_from_sha=$ref_id" >> $GITHUB_ENV
68+
echo "pr_from_clone_url=$repo_url" >> $GITHUB_ENV
69+
echo "pr_to_clone_url=$repo_url" >> $GITHUB_ENV
70+
echo "pr_title=Push trigger $branch_name $ref_id $repo_url" >> $GITHUB_ENV
71+
echo "pr_owner=$(jq --raw-output '.commits[0].author.username' $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
72+
echo 'pr_number=${{ fromJson(steps.get_pr_data.outputs.result).number }}' >> $GITHUB_ENV
73+
echo "pr_or_commit_description=$(jq --ascii-output .head_commit.message $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
74+
echo "post_merge_action=true" >> $GITHUB_ENV
4175
4276
- name: Checkout opensearch-build repo
43-
uses: actions/checkout@v2
77+
uses: actions/checkout@v4
4478
with:
4579
repository: opensearch-project/opensearch-build
4680
ref: main
@@ -62,28 +96,58 @@ jobs:
6296
6397
- name: Upload Coverage Report
6498
if: success()
65-
uses: codecov/codecov-action@v2
99+
uses: codecov/codecov-action@v4
66100
with:
67101
files: ./codeCoverage.xml
68102

69103
- name: Create Comment Success
70-
if: ${{ github.event_name == 'pull_request_target' && success() }}
71-
uses: peter-evans/create-or-update-comment@v2
104+
if: ${{ github.event_name == 'pull_request_target' && success() && env.result == 'SUCCESS' }}
105+
uses: peter-evans/create-or-update-comment@v4
72106
with:
73107
issue-number: ${{ env.pr_number }}
74108
body: |
75-
### Gradle Check (Jenkins) Run Completed with:
76-
* **RESULT:** ${{ env.result }} :white_check_mark:
77-
* **URL:** ${{ env.workflow_url }}
78-
* **CommitID:** ${{ env.pr_from_sha }}
109+
:white_check_mark: Gradle check result for ${{ env.pr_from_sha }}: [${{ env.result }}](${{ env.workflow_url }})
110+
111+
- name: Extract Test Failure
112+
if: ${{ github.event_name == 'pull_request_target' && env.result != 'SUCCESS' }}
113+
run: |
114+
TEST_FAILURES=`curl -s "${{ env.workflow_url }}/testReport/api/json?tree=suites\[cases\[status,className,name\]\]" | jq -r '.. | objects | select(.status=="FAILED",.status=="REGRESSION") | (.className + "." + .name)' | uniq -c | sort -n -r | head -n 10`
115+
if [[ "$TEST_FAILURES" != "" ]]
116+
then
117+
echo "test_failures<<EOF" >> $GITHUB_ENV
118+
echo "" >> $GITHUB_ENV
119+
echo "* **TEST FAILURES:**" >> $GITHUB_ENV
120+
echo '```' >> $GITHUB_ENV
121+
echo "$TEST_FAILURES" >> $GITHUB_ENV
122+
echo '```' >> $GITHUB_ENV
123+
echo "EOF" >> $GITHUB_ENV
124+
fi
125+
126+
- name: Create Comment Flaky
127+
if: ${{ github.event_name == 'pull_request_target' && success() && env.result != 'SUCCESS' }}
128+
uses: peter-evans/create-or-update-comment@v4
129+
with:
130+
issue-number: ${{ env.pr_number }}
131+
body: |
132+
:grey_exclamation: Gradle check result for ${{ env.pr_from_sha }}: [${{ env.result }}](${{ env.workflow_url }}) ${{ env.test_failures }}
133+
134+
Please review all [flaky tests](https://github.com/opensearch-project/OpenSearch/blob/1.x/DEVELOPER_GUIDE.md#flaky-tests) that succeeded after retry and create an issue if one does not already exist to track the flaky failure.
79135
80136
- name: Create Comment Failure
81137
if: ${{ github.event_name == 'pull_request_target' && failure() }}
82-
uses: peter-evans/create-or-update-comment@v2
138+
uses: peter-evans/create-or-update-comment@v4
83139
with:
84140
issue-number: ${{ env.pr_number }}
85141
body: |
86-
### Gradle Check (Jenkins) Run Completed with:
87-
* **RESULT:** ${{ env.result }} :x:
88-
* **URL:** ${{ env.workflow_url }}
89-
* **CommitID:** ${{ env.pr_from_sha }}
142+
:x: Gradle check result for ${{ env.pr_from_sha }}: [${{ env.result }}](${{ env.workflow_url }})
143+
144+
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure [a flaky test](https://github.com/opensearch-project/OpenSearch/blob/1.x/DEVELOPER_GUIDE.md#flaky-tests) unrelated to your change?
145+
146+
- name: Create Issue On Push Failure
147+
if: ${{ github.event_name == 'push' && failure() }}
148+
uses: dblock/create-a-github-issue@v3
149+
env:
150+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151+
with:
152+
assignees: ${{ github.event.head_commit.author.username }}, ${{ github.triggering_actor }}
153+
filename: .github/ISSUE_TEMPLATE/failed_check.md

.github/workflows/maintainer-approval.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ name: Maintainers approval
22

33
on:
44
pull_request_review:
5-
types: [submitted]
65

76
jobs:
87
maintainer-approved-check:
98
name: Minimum approval count
109
runs-on: ubuntu-latest
1110
steps:
1211
- id: find-maintainers
13-
uses: actions/github-script@v7
12+
uses: actions/github-script@v7.0.1
1413
with:
1514
github-token: ${{ secrets.GITHUB_TOKEN }}
1615
result-encoding: string
@@ -26,7 +25,7 @@ jobs:
2625
2726
return maintainersResponse.data.map(item => item.login).join(', ');
2827
29-
- uses: peternied/required-approval@v1.2
28+
- uses: peternied/required-approval@v1.3
3029
with:
3130
token: ${{ secrets.GITHUB_TOKEN }}
3231
min-required: 1

.github/workflows/precommit.yml

+14-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@ on: [pull_request]
33

44
jobs:
55
precommit:
6-
runs-on: ubuntu-latest
6+
if: github.repository == 'opensearch-project/OpenSearch'
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
java: [ 11 ]
11+
os: [ubuntu-latest, windows-latest, macos-13]
712
steps:
8-
- uses: actions/checkout@v2
9-
- name: Set up JDK 11
10-
uses: actions/setup-java@v2
13+
- uses: actions/checkout@v4
14+
- name: Set up JDK ${{ matrix.java }}
15+
uses: actions/setup-java@v4
1116
with:
12-
java-version: 11
13-
distribution: adopt
14-
- name: Run Gradle
17+
java-version: ${{ matrix.java }}
18+
distribution: temurin
19+
cache: gradle
20+
- name: Run Gradle (precommit)
1521
run: |
16-
./gradlew precommit --parallel
22+
./gradlew javadoc precommit --parallel

.github/workflows/version.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
private_key: ${{ secrets.APP_PRIVATE_KEY }}
1818
installation_id: 22958780
1919

20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2121
- name: Fetch Tag and Version Information
2222
run: |
2323
TAG=$(echo "${GITHUB_REF#refs/*/}")
@@ -42,7 +42,7 @@ jobs:
4242
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
4343
echo "NEXT_VERSION_UNDERSCORE=$NEXT_VERSION_UNDERSCORE" >> $GITHUB_ENV
4444
echo "NEXT_VERSION_ID=$NEXT_VERSION_ID" >> $GITHUB_ENV
45-
- uses: actions/checkout@v2
45+
- uses: actions/checkout@v4
4646
with:
4747
ref: ${{ env.BASE }}
4848
token: ${{ steps.github_app_token.outputs.token }}
@@ -57,7 +57,7 @@ jobs:
5757
sed -i "s/CURRENT = $CURRENT_VERSION_UNDERSCORE;/CURRENT = $NEXT_VERSION_UNDERSCORE;/g" server/src/main/java/org/opensearch/Version.java
5858
5959
- name: Create Pull Request
60-
uses: peter-evans/create-pull-request@v3
60+
uses: peter-evans/create-pull-request@v6
6161
with:
6262
token: ${{ steps.github_app_token.outputs.token }}
6363
base: ${{ env.BASE }}
@@ -71,7 +71,7 @@ jobs:
7171
body: |
7272
I've noticed that a new tag ${{ env.TAG }} was pushed, and incremented the version from ${{ env.CURRENT_VERSION }} to ${{ env.NEXT_VERSION }}.
7373
74-
- uses: actions/checkout@v2
74+
- uses: actions/checkout@v4
7575
with:
7676
ref: ${{ env.BASE_X }}
7777
token: ${{ steps.github_app_token.outputs.token }}
@@ -84,7 +84,7 @@ jobs:
8484
sed -i "s/public static final Version $CURRENT_VERSION_UNDERSCORE = new Version(\([[:digit:]]\+\)\(.*\));/\0\n public static final Version $NEXT_VERSION_UNDERSCORE = new Version($NEXT_VERSION_ID\2);/g" server/src/main/java/org/opensearch/Version.java
8585
8686
- name: Create Pull Request
87-
uses: peter-evans/create-pull-request@v3
87+
uses: peter-evans/create-pull-request@v6
8888
with:
8989
token: ${{ steps.github_app_token.outputs.token }}
9090
base: ${{ env.BASE_X }}
@@ -98,7 +98,7 @@ jobs:
9898
body: |
9999
I've noticed that a new tag ${{ env.TAG }} was pushed, and added a bwc version ${{ env.NEXT_VERSION }}.
100100
101-
- uses: actions/checkout@v2
101+
- uses: actions/checkout@v4
102102
with:
103103
ref: main
104104
token: ${{ steps.github_app_token.outputs.token }}
@@ -111,7 +111,7 @@ jobs:
111111
sed -i "s/public static final Version $CURRENT_VERSION_UNDERSCORE = new Version(\([[:digit:]]\+\)\(.*\));/\0\n public static final Version $NEXT_VERSION_UNDERSCORE = new Version($NEXT_VERSION_ID\2);/g" server/src/main/java/org/opensearch/Version.java
112112
113113
- name: Create Pull Request
114-
uses: peter-evans/create-pull-request@v3
114+
uses: peter-evans/create-pull-request@v6
115115
with:
116116
token: ${{ steps.github_app_token.outputs.token }}
117117
base: main

.github/workflows/wrapper.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ jobs:
66
name: Validate
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
10-
- uses: gradle/wrapper-validation-action@v1
9+
- uses: actions/checkout@v4
10+
- uses: gradle/wrapper-validation-action@v3

0 commit comments

Comments
 (0)