Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Create CD.yml

* Create CI.yml
  • Loading branch information
rishabh6788 authored Mar 18, 2020
1 parent 11d836d commit fa1d4a0
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/CD.yml
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/*"
63 changes: 63 additions & 0 deletions .github/workflows/CI.yml
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

0 comments on commit fa1d4a0

Please sign in to comment.