Skip to content

Commit

Permalink
fix github ci linux build
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Jan 15, 2025
1 parent 9aecfce commit f4255de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 34 deletions.
47 changes: 14 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,31 @@ on:

jobs:
Get-CI-Image-Tag:
runs-on: ubuntu-latest
outputs:
ci-image-version-linux: ${{ steps.step-ci-image-version-linux.outputs.ci-image-version-linux }}
steps:
- name: Install crane
uses: iarekylew00t/crane-installer@v1
with:
crane-release: v0.15.2
- name: Checkout opensearch-build repository
uses: actions/checkout@v3
with:
repository: 'opensearch-project/opensearch-build'
ref: 'main'
path: 'opensearch-build'
- name: Get ci image version from opensearch-build repository scripts
id: step-ci-image-version-linux
run: |
crane version
CI_IMAGE_VERSION=`opensearch-build/docker/ci/get-ci-images.sh -p centos7 -u opensearch -t build | head -1`
echo $CI_IMAGE_VERSION
echo "ci-image-version-linux=$CI_IMAGE_VERSION" >> $GITHUB_OUTPUT
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
with:
product: opensearch

build-linux:
needs: Get-CI-Image-Tag
strategy:
matrix:
java: [21]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
name: Build and Test skills plugin on Linux
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
Expand All @@ -64,7 +45,7 @@ jobs:
./gradlew publishToMavenLocal"
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -79,9 +60,9 @@ jobs:

steps:
- name: Checkout skills
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
Expand All @@ -103,10 +84,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
Expand All @@ -120,7 +101,7 @@ jobs:
./gradlew publishToMavenLocal
- name: Upload Coverage Report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

5 changes: 4 additions & 1 deletion src/test/java/org/opensearch/integTest/BaseAgentToolsIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

import lombok.SneakyThrows;


public abstract class BaseAgentToolsIT extends OpenSearchSecureRestTestCase {
public static final Gson gson = new Gson();
private static final int MAX_TASK_RESULT_QUERY_TIME_IN_SECOND = 60 * 5;
Expand Down Expand Up @@ -90,8 +91,10 @@ protected void updateClusterSettings(String settingKey, Object value) {

@SneakyThrows
private Map<String, Object> parseResponseToMap(Response response) {
String responseBody= EntityUtils.toString(response.getEntity());
logger.info("responseBody: {}", responseBody);
Map<String, Object> responseInMap = XContentHelper
.convertToMap(XContentType.JSON.xContent(), EntityUtils.toString(response.getEntity()), false);
.convertToMap(XContentType.JSON.xContent(), responseBody, false);
return responseInMap;
}

Expand Down

0 comments on commit f4255de

Please sign in to comment.