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

Develop -> Master #131

Draft
wants to merge 69 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
46dc9f5
Create docker-publish.yml
bio-boris Jun 13, 2024
cf6007b
Update docker-publish.yml
bio-boris Jun 13, 2024
838f96c
Merge pull request #130 from jgi-kbase/docker-publish
bio-boris Jun 21, 2024
fe5d09c
DEVOPS-1957 Update GHA (#132)
bio-boris Jun 25, 2024
8932815
Add github workflows (#129)
Xiangs18 Jul 2, 2024
b435e87
fix flake8 by black
Xiangs18 Jul 2, 2024
7fde579
enable flake8
Xiangs18 Jul 2, 2024
c12ccaa
mannual fix
Xiangs18 Jul 3, 2024
a2eac78
revert # noqa: E222 @IgnorePep8 && remove # @UnusedVariable
Xiangs18 Jul 3, 2024
28bfb54
Merge pull request #135 from jgi-kbase/dev-fix_flake_mypy_bandit
Xiangs18 Jul 3, 2024
32da86d
fix mypy
Xiangs18 Jul 8, 2024
5091d53
fix E261 at least two spaces before inline comment
Xiangs18 Jul 8, 2024
a890700
remove None
Xiangs18 Jul 8, 2024
589fda0
add # type: ignore[attr-defined]
Xiangs18 Jul 8, 2024
703fc40
Merge pull request #136 from jgi-kbase/dev-fix_mypy
Xiangs18 Jul 8, 2024
8777617
enable bandit
Xiangs18 Jul 8, 2024
7335adb
add annotations to fix B105:hardcoded_password_string
Xiangs18 Jul 9, 2024
3ac707e
ignore Requests call without timeout
Xiangs18 Jul 9, 2024
26dc563
Merge pull request #137 from jgi-kbase/dev-fix_bandit
Xiangs18 Jul 9, 2024
dc577f0
add Pipfile and Pipfile.lock
Xiangs18 Jul 10, 2024
838689e
delete requirements.txt files
Xiangs18 Jul 10, 2024
034b838
update test.yaml and Dockerfile
Xiangs18 Jul 10, 2024
ffa0b54
update docker-compose file
Xiangs18 Jul 11, 2024
d451122
fix mongo-host
Xiangs18 Jul 11, 2024
2305f70
add mongo_host env var in docker-compose
Xiangs18 Jul 12, 2024
3f2c293
Merge pull request #139 from jgi-kbase/dev-add_pipfile
Xiangs18 Jul 12, 2024
7d45abe
add mongo7 into GHA workflows
Xiangs18 Jul 12, 2024
7c2d9ee
update pymango version
Xiangs18 Jul 12, 2024
f33b193
add type annotation for client
Xiangs18 Jul 12, 2024
ae4ad11
use is for compare types
Xiangs18 Jul 12, 2024
470b98c
update mongo_controller.py
Xiangs18 Jul 12, 2024
a661bab
fix test_startup_and_check_config_doc
Xiangs18 Jul 12, 2024
ac3f4a3
add missing len()
Xiangs18 Jul 12, 2024
01c811d
fix count
Xiangs18 Jul 12, 2024
ff90d36
remove namespace from index info
Xiangs18 Jul 12, 2024
611d49e
remove ns in test_index_mappings
Xiangs18 Jul 12, 2024
5092f27
update remove_ns_from_index_info function
Xiangs18 Jul 12, 2024
7d4dceb
error message for mongo3
Xiangs18 Jul 12, 2024
2d3bcb8
update error message
Xiangs18 Jul 12, 2024
3f5ed90
fix mypy complaint
Xiangs18 Jul 12, 2024
bb420ef
add mypy ignore
Xiangs18 Jul 12, 2024
f1a70f4
fix log
Xiangs18 Jul 16, 2024
8bcccd5
fix regex and semver import
Xiangs18 Jul 17, 2024
116a87d
fix sver
Xiangs18 Jul 17, 2024
35bbd50
fix space
Xiangs18 Jul 17, 2024
2461d18
remove semver assignment
Xiangs18 Jul 17, 2024
b015560
update regex error message
Xiangs18 Jul 17, 2024
5b562e2
fix error message
Xiangs18 Jul 17, 2024
79d86a4
update error message
Xiangs18 Jul 17, 2024
dd9c574
fix semver parser
Xiangs18 Jul 17, 2024
594c60e
add test_log_formatter_with_no_test_request_context
Xiangs18 Jul 17, 2024
6d54b6e
Merge pull request #140 from jgi-kbase/dev-mongo7_upgrade
Xiangs18 Jul 17, 2024
af783e2
add retryWrites param in cfg
Xiangs18 Jul 17, 2024
11c44f8
Merge branch 'develop' into dev-retrywrites
Xiangs18 Jul 17, 2024
efcb026
add retrywrites into KbaseConfig and test
Xiangs18 Jul 18, 2024
021b390
fix flake8
Xiangs18 Jul 18, 2024
79afcbe
Merge pull request #141 from jgi-kbase/dev-retrywrites
Xiangs18 Jul 18, 2024
d90082f
add id mapping container test
Xiangs18 Jul 18, 2024
8c0a348
fix typo and add type hint
Xiangs18 Jul 18, 2024
160df47
fix comment
Xiangs18 Jul 18, 2024
bfa30e0
fix redirection unexpected
Xiangs18 Jul 18, 2024
03ce047
finish
Xiangs18 Jul 18, 2024
8f63408
fix service name
Xiangs18 Jul 18, 2024
88b0237
address comments
Xiangs18 Jul 18, 2024
2d9fa56
Merge pull request #142 from jgi-kbase/dev-container_test
Xiangs18 Jul 18, 2024
15165da
update readme && release notes
Xiangs18 Jul 18, 2024
dbb3483
fix python version and cmd in readme && update release notes
Xiangs18 Jul 19, 2024
8919de5
change python version to 3.9 in Pipfile
Xiangs18 Jul 19, 2024
ca9845b
Merge pull request #146 from jgi-kbase/dev-update_readme_release_notes
Xiangs18 Jul 19, 2024
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
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:

# Docker
- package-ecosystem: docker
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 25

# Python
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
open-pull-requests-limit: 25

# GitHub Actions
- package-ecosystem: "github-actions"
directory: ".github/workflows"
schedule:
interval: "monthly"
open-pull-requests-limit: 25
38 changes: 38 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "CodeQL"

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
# run workflow when merging to main or develop
branches:
- main
- master
- develop

jobs:
CodeQL-Build:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest

permissions:
# required for all workflows
security-events: write

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
# Override language selection by uncommenting this and choosing your languages
with:
languages: python

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
57 changes: 57 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docker

on:
workflow_dispatch:
push:
branches: [ "main", "master", "develop" ]
# Publish semver tags as releases.
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
pull_request:
branches: [ "main", "master", "develop" ]
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
100 changes: 100 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: ID Mapping Service test

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
# run workflow when merging to main or develop
branches:
- main
- master
- develop

jobs:
id_mapping_service_container_tests:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub repo
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9.19"

- name: Install dependencies and set up test config
shell: bash
run: |
# set up python dependencies
pip install pytest requests

# set up deploy.cfg
cp -n deploy.cfg.example deploy.cfg
sed -i "s#^mongo-host.*#mongo-host=mongo#" deploy.cfg
sed -i "s#^mongo-db.*#mongo-db=idmapping#" deploy.cfg

- name: Run tests
shell: bash
run: |
sh container_test/run_tests.sh

id_mapping_service_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python: '3.9.19'
mongo: 'mongodb-linux-x86_64-3.6.23'
wired_tiger: 'false'
- python: '3.9.19'
mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4'
wired_tiger: 'true'

steps:
- name: Check out GitHub repo
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}

- name: Install dependencies and set up test config
shell: bash
run: |

# install python libraries
python -m pip install --upgrade pip
pip install pipenv
pipenv sync --system --dev

# set up mongo
cd ..
wget -q http://fastdl.mongodb.org/linux/${{matrix.mongo}}.tgz
tar xfz ${{matrix.mongo}}.tgz
export MONGOD=`pwd`/${{matrix.mongo}}/bin/mongod
cd -

# set up test config
cp -n test.cfg.example test.cfg
sed -i "s#^test.temp.dir =.*#test.temp.dir=temp_test_dir#" test.cfg
sed -i "s#^test.mongo.exe.*#test.mongo.exe=$MONGOD#" test.cfg
sed -i "s#^test.mongo.wired_tiger.*#test.mongo.wired_tiger=${{matrix.wired_tiger}}#" test.cfg

- name: Run tests
shell: bash
run: |
HOMEDIR=`pwd`
PYTHONPATH=$HOMEDIR/src:$PYTHONPATH
make test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM kbase/kb_jre:latest as dockerize

FROM python:3.6-alpine
FROM python:3.9.19-alpine

# These ARGs values are passed in via the docker build command
ARG BUILD_DATE
Expand All @@ -10,13 +10,16 @@ ARG BRANCH=develop
RUN apk add gcc linux-headers libc-dev make git
COPY --from=dockerize /kb/deployment/bin/dockerize /usr/bin/

ADD requirements.txt /tmp/

RUN pip install -r /tmp/requirements.txt
# install pipenv
RUN pip install --upgrade pip && \
pip install pipenv

WORKDIR /kb
ADD . /kb

RUN cd /kb && make
# install deps
RUN pipenv sync --system
RUN make

# The BUILD_DATE value seem to bust the docker cache when the timestamp changes, move to
# the end
Expand All @@ -27,7 +30,6 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
us.kbase.vcs-branch=$BRANCH \
maintainer="Steve Chan [email protected]"

WORKDIR /kb/
ENV KB_DEPLOYMENT_CONFIG=/kb/deploy.cfg
ENV PYTHONPATH=$PYTHONPATH:/kb/src

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test: all
flake8 src
mypy src
IDMAP_TEST_FILE=$(TEST_CFG) pytest --verbose src --cov src/jgikbase/idmapping
bandit --recursive src --exclude src/jgikbase/test
bandit --configfile bandit.yaml --recursive src --exclude src/jgikbase/test

# Only test the MongoDB related code.
test-mongo:
Expand Down
28 changes: 28 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
cacheout = "==0.10.2"
flask = "==2.0.0"
gevent = "==24.2.1"
gunicorn = "==22.0.0"
pymongo = "==4.7.2"
requests = "==2.20.0"
types-requests = "==2.25.0"
werkzeug = "==2.0.3"

[dev-packages]
bandit = "==1.7.9"
coverage = "==7.5.3"
flake8 = "==7.1.0"
mypy = "==1.10.0"
pytest-cov = "==2.5.1"
requests-mock = "==1.5.2"
semver = "==2.8.1"
sphinx = "==1.7.4"
sphinx-autodoc-typehints = "==1.3.0"

[requires]
python_version = "3.9"
Loading
Loading