Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize GitHub workflows. #837

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
backport:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about that, do we have any known issue regarding to ubuntu-latest. Any reason change to 20.04?
I think opensearch-project use ubuntu-latest by default.

Copy link
Collaborator Author

@Yury-Fridlyand Yury-Fridlyand Sep 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, follow these 2 links or see TLDR section
Bit-Quill#118 (comment)
https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
TL;DR
ubuntu-latest = ubuntu-20.04 now, but subject to change

permissions:
contents: write
pull-requests: write
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/bi-connectors.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build connectors for BI tools

on:
pull_request:
types: [opened, reopened]
push:
paths:
- 'bi-connectors/PowerBIConnector/**'
Expand All @@ -9,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Pack Tableau JDBC connector
Expand Down
64 changes: 17 additions & 47 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,40 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
# ******** NOTE ********

name: "CodeQL"

on:
pull_request:
branches:
- master
- opendistro-*
- 'main'
- '[1-9]+.[0-9x]+'
- '[1-9]+.[0-9x]+.[0-9x]+'
types: [opened, reopened]
push:
branches:
- master
- opendistro-*

branches-ignore:
- 'dependabot/**'
paths:
- '**/*.java'
- '.github/workflows/codeql-analysis.yml'

jobs:
analyze:
name: CodeQL-Scan
runs-on: ubuntu-18.04

runs-on: ubuntu-20.04
permissions:
security-events: write
actions: read
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
4 changes: 2 additions & 2 deletions .github/workflows/dco.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]

jobs:
check:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: Get PR Commits
Expand All @@ -15,4 +15,4 @@ jobs:
- name: DCO Check
uses: tim-actions/[email protected]
with:
commits: ${{ steps.get-pr-commits.outputs.commits }}
commits: ${{ steps.get-pr-commits.outputs.commits }}
2 changes: 1 addition & 1 deletion .github/workflows/delete_backport_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
delete-branch:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: startsWith(github.event.pull_request.head.ref,'backport/')
steps:
- name: Delete merged branch
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/draft-release-notes-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
name: Release Drafter

on:
pull_request:
types: [opened, reopened]
push:
branches:
- main
- 'main'
- '[1-9]+.[0-9x]+'
- '[1-9]+.[0-9x]+.[0-9x]+'
dai-chen marked this conversation as resolved.
Show resolved Hide resolved

jobs:
update_release_draft:
name: Update draft release notes
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
# Drafts your next Release notes as Pull Requests are merged into "develop"
- name: Update draft release notes
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/link-checker.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
name: Link Checker

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [opened, reopened]
push:
branches:
- 'main'
- '[1-9]+.[0-9x]+'
- '[1-9]+.[0-9x]+.[0-9x]+'
paths:
- '**/*.pdf'
- '**/*.png'
- '**/*.jpg'
- '**/*.json'
- '**/*.md'
- '**/*.txt'
- '**/*.rst'
dai-chen marked this conversation as resolved.
Show resolved Hide resolved

jobs:
linkchecker:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand Down
71 changes: 0 additions & 71 deletions .github/workflows/sql-cli-release-workflow.yml

This file was deleted.

52 changes: 31 additions & 21 deletions .github/workflows/sql-cli-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
name: SQL CLI Test and Build

on: [pull_request, push]
on:
pull_request:
types: [opened, reopened]
push:
branches-ignore:
- 'dependabot/**'
paths:
- 'sql-cli/**'
- '.github/workflows/sql-cli-test-and-build-workflow.yml'

jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
defaults:
run:
working-directory: sql-cli
strategy:
matrix:
python-version: [3.8]
opensearch-version: [ 2.2.1, latest ]
dai-chen marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: Checkout SQL CLI
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -28,26 +37,21 @@ jobs:
pip install -r requirements-dev.txt
pip install setuptools wheel

#TODO: will setup CI for IT once we have OpenSearch and sql plugin release. Not it only runs UT
# It can also be refactored by launching OpenSearch instance with plugin installed from gradle.

# - name: Set up ES and install SQL plugin
# run: |
# sudo add-apt-repository ppa:openjdk-r/ppa
# sudo apt update
# sudo apt install openjdk-14-jdk
# sudo apt install unzip
# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.10.0-amd64.deb
# sudo dpkg -i elasticsearch-oss-7.10.0-amd64.deb
# sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opensearch-sql/opensearch_sql-1.12.0.0.zip
# sudo systemctl start elasticsearch.service
# tests are designed to run against http://localhost:9200, so we have to disable/remove security plugin
- name: Download and run OpenSearch
run: |
docker run -p 9200:9200 -e "discovery.type=single-node" -e "DISABLE_SECURITY_PLUGIN=true" --name test -d opensearchproject/opensearch:${{ matrix.opensearch-version }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may not work. e.g, currently, SQL plugin depend on OpenSearch 2.4. But OpenSearch 2.4 Docker Images is not released yet.

Copy link
Collaborator Author

@Yury-Fridlyand Yury-Fridlyand Sep 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, there are only 2.2.1 and latest in the test matrix. latest grabs the latest released version.
I can create another sub-job to download and build OpenSearch. So tests would run on the current version, e.g. 2.4 for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worthwhile the next time someone has a chance.
Another side-effect, is that we would have an artefact to download for our own local development usage... instead of having to download and setup the latest OpenSearch.


- name: Wait for cluster to start
uses: nick-fields/retry@v2
with:
timeout_seconds: 1
max_attempts: 30
command: curl -q localhost:9200

- name: Run Tox Testing
run: tox

# - name: Stop ES
# run: sudo systemctl stop elasticsearch.service

- name: Build Artifact
run: python setup.py sdist bdist_wheel

Expand All @@ -57,7 +61,13 @@ jobs:
cp -r ./dist/*.tar.gz ./dist/*.whl opensearchsql-builds/

- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: opensearchsql
path: sql-cli/opensearchsql-builds

- name: Clean up container
if: always()
run: |
docker container stop test
docker container rm test
Loading