9
9
- " *"
10
10
11
11
jobs :
12
+ Get-CI-Image-Tag :
13
+ uses : opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
14
+ with :
15
+ product : opensearch
16
+
12
17
linux-build :
18
+ needs : Get-CI-Image-Tag
13
19
strategy :
14
20
matrix :
15
21
java :
18
24
# Job name
19
25
name : Build Asynchronous Search
20
26
# This job runs on Linux.
27
+ outputs :
28
+ build-test-linux : ${{ steps.step-build-test-linux.outputs.build-test-linux }}
21
29
runs-on : ubuntu-latest
30
+ container :
31
+ # using the same image which is used by opensearch-build team to build the OpenSearch Distribution
32
+ # this image tag is subject to change as more dependencies and updates will arrive over time
33
+ image : ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
34
+ # need to switch to root so that github actions can install runner binary on container without permission issues.
35
+ options : --user root
36
+
22
37
steps :
23
38
# This step uses the setup-java Github action: https://github.com/actions/setup-java
24
39
- name : Set Up JDK ${{ matrix.java }}
@@ -29,33 +44,68 @@ jobs:
29
44
- name : Checkout Branch
30
45
uses : actions/checkout@v2
31
46
- name : Build with Gradle
32
- run : ./gradlew build
47
+ id : step-build-test-linux
48
+ run : |
49
+ chown -R 1000:1000 `pwd`
50
+ su `id -un 1000` -c "./gradlew build"
51
+ plugin=`basename $(ls build/distributions/*.zip)`
52
+ echo plugin $plugin
53
+ mv -v build/distributions/$plugin ./
54
+ echo "build-test-linux=$plugin" >> $GITHUB_OUTPUT
55
+ - name : Uploads coverage
56
+ uses : codecov/codecov-action@v1.2.1
57
+ with :
58
+ token : ${{ secrets.CODECOV_TOKEN }}
59
+ - uses : actions/upload-artifact@v3
60
+ with :
61
+ name : async-plugin-linux-${{ matrix.java }}
62
+ path : ${{ steps.step-build-test-linux.outputs.build-test-linux }}
63
+ if-no-files-found : error
64
+
65
+ linux-test-docker :
66
+ needs : linux-build
67
+ strategy :
68
+ matrix :
69
+ java :
70
+ - 11
71
+ - 17
72
+ # Job name
73
+ name : Test Asynchronous Search with opensearchstaging docker
74
+ # This job runs on Linux.
75
+ runs-on : ubuntu-latest
76
+ steps :
77
+ - name : Checkout Branch
78
+ uses : actions/checkout@v2
79
+ - uses : actions/download-artifact@v3
80
+ with :
81
+ name : async-plugin-linux-${{ matrix.java }}
33
82
- name : Pull and Run Docker for security tests
34
83
run : |
35
- version=`./gradlew properties -q | grep "opensearch_version:" | awk '{print $2}'`
36
- IFS='-' read -r -a version_array <<< "$version"
37
- plugin_version="${version_array[0]}.0"; for entry in ${version_array[@]:1}; do plugin_version+="-$entry"; done
38
- docker_version="${version_array[0]}-${version_array[1]}"
84
+ plugin=${{ needs.linux-build.outputs.build-test-linux }}
85
+ version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-3`
86
+ plugin_version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-4`
87
+ qualifier=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-1`
39
88
40
- echo version $version
41
- echo plugin_version $plugin_version
42
- echo docker_version $docker_version
89
+ if [ -n "$qualifier" ] && [ "$qualifier" != "SNAPSHOT" ]; then
90
+ qualifier=-${qualifier}
91
+ else
92
+ qualifier=""
93
+ fi
43
94
44
- pwd=`pwd`
45
- echo $pwd
46
- cd ..
47
- pwd1=`pwd`
48
- echo $pwd1
49
- list_of_all_files=`ls asynchronous-search/build/distributions/`
50
- echo "listing distributions"
51
- echo $list_of_all_files
95
+ docker_version=$version$qualifier
96
+
97
+
98
+ echo plugin version plugin_version qualifier docker_version
99
+ echo "($plugin) ($version) ($plugin_version) ($qualifier) ($docker_version)"
100
+
101
+ pwd && ls -l ./$plugin
52
102
53
103
if docker pull opensearchstaging/opensearch:$docker_version
54
104
then
55
105
echo "FROM opensearchstaging/opensearch:$docker_version" >> Dockerfile
56
106
echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-asynchronous-search ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-asynchronous-search; fi" >> Dockerfile
57
- echo "ADD asynchronous-search/build/distributions/opensearch-asynchronous-search-$plugin_version.zip /tmp/" >> Dockerfile
58
- echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/opensearch-asynchronous-search-$plugin_version.zip " >> Dockerfile
107
+ echo "ADD $plugin /tmp/" >> Dockerfile
108
+ echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/$plugin " >> Dockerfile
59
109
docker build -t opensearch-asynchronous-search:test .
60
110
echo "imagePresent=true" >> $GITHUB_ENV
61
111
else
@@ -85,20 +135,7 @@ jobs:
85
135
with :
86
136
name : logs
87
137
path : build/testclusters/integTest-*/logs/*
88
- - name : Create Artifact Path
89
- run : |
90
- mkdir -p asynchronous-search-artifacts
91
- cp ./build/distributions/*.zip asynchronous-search-artifacts
92
- - name : Uploads coverage
93
- uses : codecov/codecov-action@v1.2.1
94
- with :
95
- token : ${{ secrets.CODECOV_TOKEN }}
96
- # This step uses the upload-artifact Github action: https://github.com/actions/upload-artifact
97
- - name : Upload Artifacts
98
- uses : actions/upload-artifact@v1
99
- with :
100
- name : asynchronous-search-plugin-ubuntu
101
- path : asynchronous-search-artifacts
138
+
102
139
windows-build :
103
140
# Job name
104
141
name : Build Asynchronous Search
@@ -127,6 +164,7 @@ jobs:
127
164
with :
128
165
name : asynchronous-search-plugin-windows
129
166
path : asynchronous-search-artifacts
167
+
130
168
mac-os-build :
131
169
# Job name
132
170
name : Build Asynchronous Search
0 commit comments