forked from opendistro-for-elasticsearch/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sql CI/CD (opendistro-for-elasticsearch#384)
* Create CD.yml * Create CI.yml (cherry picked from commit fa1d4a0)
- Loading branch information
1 parent
470ee0a
commit 667debb
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Release SQL Artifacts | ||
on: | ||
push: | ||
branches: | ||
- opendistro-* | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
java: [12] | ||
|
||
name: Build and Release SQL Plugin | ||
runs-on: [ubuntu-16.04] | ||
|
||
steps: | ||
- name: Checkout SQL | ||
uses: actions/checkout@v1 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Setup Java ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: Run build | ||
run: | | ||
./gradlew buildPackages --refresh-dependencies --console=plain -Dbuild.snapshot=false | ||
artifact=`ls build/distributions/*.zip` | ||
rpm_artifact=`ls build/distributions/*.rpm` | ||
deb_artifact=`ls build/distributions/*.deb` | ||
aws s3 cp $artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-plugins/opendistro-sql/ | ||
aws s3 cp $rpm_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/rpms/opendistro-sql/ | ||
aws s3 cp $deb_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/debs/opendistro-sql/ | ||
aws cloudfront create-invalidation --distribution-id E1VG5HMIWI4SA2 --paths "/downloads/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build and Test SQL | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- opendistro-* | ||
|
||
jobs: | ||
Build-SQL: | ||
strategy: | ||
matrix: | ||
java: [12] | ||
|
||
name: Build and Test SQL Plugin | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout SQL | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup Java ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: Run build | ||
run: | | ||
./gradlew build | ||
ls -ltr | ||
- name: Build Packages to Test | ||
run: | | ||
./gradlew buildPackages --refresh-dependencies --console=plain -Dbuild.snapshot=false | ||
- name: Pull and Run Docker | ||
run: | | ||
plugin=`ls build/distributions/*.zip` | ||
version=`echo $plugin|awk -F- '{print $2}'| cut -d. -f 1-3` | ||
plugin_version=`echo $plugin|awk -F- '{print $2}'| cut -d. -f 1-4` | ||
echo $version | ||
cd .. | ||
if docker pull opendistroforelasticsearch/opendistroforelasticsearch:$version | ||
then | ||
echo "FROM opendistroforelasticsearch/opendistroforelasticsearch:$version" >> Dockerfile | ||
echo "RUN if [ -d /usr/share/elasticsearch/plugins/opendistro_security ]; then /usr/share/elasticsearch/bin/elasticsearch-plugin remove opendistro_security; fi" >> Dockerfile | ||
echo "RUN if [ -d /usr/share/elasticsearch/plugins/opendistro_sql ]; then /usr/share/elasticsearch/bin/elasticsearch-plugin remove opendistro_sql; fi" >> Dockerfile | ||
echo "ADD sql/build/distributions/opendistro_sql-$plugin_version.zip /tmp/" >> Dockerfile | ||
echo "RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch file:/tmp/opendistro_sql-$plugin_version.zip" >> Dockerfile | ||
docker build -t odfe-sql:test . | ||
fi | ||
- name: Run Docker Image | ||
run: | | ||
cd .. | ||
docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" odfe-sql:test | ||
sleep 15 | ||
curl -XGET http://localhost:9200/_cat/plugins | ||
- name: Run SQL Test | ||
run: | | ||
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 |