Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4a5e1e3
Add GHA and simplify test setup
MrCreosote Apr 24, 2024
9c4a73d
Fix Docker build
MrCreosote Apr 24, 2024
98cfe2f
Merge pull request #12 from kbase/dev-gradle
MrCreosote Apr 26, 2024
6b3b9f3
Switch to gradle
MrCreosote Apr 24, 2024
bcc6352
Move source to standard Gradle locations
MrCreosote Apr 24, 2024
5a91b7d
Remove lookup_globus_user method
MrCreosote Apr 24, 2024
8986759
Update dockerfile w/ gradle build & add compose file
MrCreosote Apr 25, 2024
223a916
Switch to jitpacked jars
MrCreosote Apr 25, 2024
8d04983
Merge pull request #13 from kbase/dev-gradle
MrCreosote Apr 29, 2024
a4225d8
Merge pull request #14 from kbase/dev-gradle
MrCreosote Apr 30, 2024
d41a348
Merge pull request #15 from kbase/dev-gradle
MrCreosote May 1, 2024
5842f5b
Merge pull request #16 from kbase/dev-gradle
MrCreosote May 3, 2024
748832d
Merge pull request #17 from kbase/dev-gradle
MrCreosote May 6, 2024
27c33a5
mongo7 upgrade
Xiangs18 Sep 18, 2024
03d4512
fix JsonParseException: Unrecognized token
Xiangs18 Sep 20, 2024
4b2ae15
switch to BsonDocument.parse
Xiangs18 Sep 20, 2024
ecea370
check jsonString
Xiangs18 Sep 23, 2024
fd3d525
change toString() to toJson()
Xiangs18 Sep 25, 2024
bd65c01
fix updateProfile logic
Xiangs18 Sep 26, 2024
f91177b
fix inline code
Xiangs18 Sep 27, 2024
629a71c
add test coverage for getProfile function
Xiangs18 Sep 30, 2024
a551db4
cover filterUsers missing lines
Xiangs18 Sep 30, 2024
1457a88
Test the updateProfile function on a non-existent user
Xiangs18 Sep 30, 2024
a3f1109
set admin update nonExistProfile
Xiangs18 Sep 30, 2024
b90d710
simplify if else statement
Xiangs18 Oct 1, 2024
48e5aa0
update release notes
Xiangs18 Oct 2, 2024
053b474
refactor code and remove old comments
Xiangs18 Oct 3, 2024
bc602a2
Update Specific Fields in profile
Xiangs18 Oct 3, 2024
973557d
fix bug
Xiangs18 Oct 3, 2024
4fa6c34
remove print statements
Xiangs18 Oct 4, 2024
3e40a1d
test no username in filterUsers functions
Xiangs18 Oct 4, 2024
9734e19
set username to null and retest
Xiangs18 Oct 4, 2024
9977098
remove test no username code
Xiangs18 Oct 4, 2024
8cd565b
add TODO for the missing lines
Xiangs18 Oct 4, 2024
c82bfc7
remove TODO library
Xiangs18 Oct 4, 2024
e8b3abb
correct todo comments
Xiangs18 Oct 4, 2024
897e0f1
add logic for nested fields in updateProfile function && test
Xiangs18 Oct 7, 2024
064ae3f
convert the JsonNode to an object
Xiangs18 Oct 8, 2024
a2aefad
use UObject.transformJacksonToObject and remove mapper
Xiangs18 Oct 8, 2024
6a77d26
remove findProfileByUsername func && clean up
Xiangs18 Oct 9, 2024
f182149
Merge pull request #18 from kbase/dev-mongo7_upgrade
Xiangs18 Oct 9, 2024
d51c664
Merge branch 'develop' into dev-add_retryWrites
Xiangs18 Oct 9, 2024
a161722
update release notes && add retryWrites param
Xiangs18 Oct 9, 2024
972e12a
add missing retryWrites param into the test config
Xiangs18 Oct 9, 2024
1cb58fd
Merge pull request #21 from kbase/dev-add_retryWrites
Xiangs18 Oct 10, 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
29 changes: 0 additions & 29 deletions .classpath

This file was deleted.

9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

52 changes: 52 additions & 0 deletions .github/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Code scanning - action"

on:
push:
pull_request:
schedule:
- cron: '0 19 * * 0'

jobs:
CodeQL-Build:

# CodeQL runs on ubuntu-latest and windows-latest
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java

# 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

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: docker
directory: "/"
schedule:
interval: weekly
time: '11:00'
open-pull-requests-limit: 10
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: '11:00'
open-pull-requests-limit: 10
11 changes: 11 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Manual Build & Push
on:
workflow_dispatch:
jobs:
build-push:
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
with:
name: '${{ github.event.repository.name }}-develop'
tags: br-${{ github.ref_name }}
secrets: inherit
43 changes: 43 additions & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Pull Request Build, Tag, & Push
on:
pull_request:
branches:
- develop
- main
- master
types:
- opened
- reopened
- synchronize
- closed
jobs:
build-develop-open:
if: github.base_ref == 'develop' && github.event.pull_request.merged == false
uses: kbase/.github/.github/workflows/reusable_build.yml@main
secrets: inherit
build-develop-merge:
if: github.base_ref == 'develop' && github.event.pull_request.merged == true
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
with:
name: '${{ github.event.repository.name }}-develop'
tags: pr-${{ github.event.number }},latest
secrets: inherit
build-main-open:
if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == false
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
with:
name: '${{ github.event.repository.name }}'
tags: pr-${{ github.event.number }}
secrets: inherit
build-main-merge:
if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == true
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
with:
name: '${{ github.event.repository.name }}'
tags: pr-${{ github.event.number }},latest-rc
secrets: inherit
trivy-scans:
if: (github.base_ref == 'develop' || github.base_ref == 'main' || github.base_ref == 'master' ) && github.event.pull_request.merged == false
uses: kbase/.github/.github/workflows/reusable_trivy-scans.yml@main
secrets: inherit
25 changes: 25 additions & 0 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Release - Build & Push Image
on:
release:
branches:
- main
- master
types: [ published ]
jobs:
check-source-branch:
uses: kbase/.github/.github/workflows/reusable_validate-branch.yml@main
with:
build_branch: '${{ github.event.release.target_commitish }}'
validate-release-tag:
needs: check-source-branch
uses: kbase/.github/.github/workflows/reusable_validate-release-tag.yml@main
with:
release_tag: '${{ github.event.release.tag_name }}'
build-push:
needs: validate-release-tag
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
with:
name: '${{ github.event.repository.name }}'
tags: '${{ github.event.release.tag_name }},latest'
secrets: inherit
70 changes: 70 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: KBase User Profile tests

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

jobs:

user_profile_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- java: '8'
mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4'
- java: '11'
mongo: 'mongodb-linux-x86_64-3.6.23'
steps:
- uses: actions/checkout@v3

- name: Set up java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{matrix.java}}

- name: Install dependencies and set up test config
env:
KBASE_CI_TOKEN: ${{ secrets.KBASE_CI_TOKEN }}
KBASE_CI_TOKEN2: ${{ secrets.KBASE_CI_TOKEN2 }}
shell: bash
run: |
export HOMEDIR=`pwd`

# move to parent dir of homedir to install binaries etc
cd ..

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

# set up test config
cd $HOMEDIR
cp -n test.cfg.example test.cfg
sed -i "s#^test.mongo-exe-path.*#test.mongo-exe-path=$MONGOD#" test.cfg
sed -i "s#^test.admin-token.*#test.admin-token = $KBASE_CI_TOKEN#" test.cfg
sed -i "s#^test.usr1-token.*#test.usr1-token = $KBASE_CI_TOKEN2#" test.cfg
echo "\ntest.mongo-exe-path=$MONGOD\n" >> test.cfg

- name: Run tests
shell: bash
run: ./gradlew test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ classes
dist
/build/
/bin/
/.settings/
/test.cfg
/.pydevproject

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
/.classpath
22 changes: 22 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,30 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.python.pydev.pythonNature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion DEPENDENCIES

This file was deleted.

41 changes: 25 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
FROM kbase/kb_jre:latest AS build
# Multistage Build Setup
RUN apt-get -y update && apt-get -y install ant git openjdk-8-jdk
RUN cd /tmp && \
git clone https://github.com/kbase/jars

COPY . /tmp/user_profile

# Bypass the makefile, which has perl dependencies, and just use
# the underlying ant compile and ant buildwar
RUN cd /tmp/user_profile && \
ant compile && \
ant buildwar
FROM kbase/sdkbase2:latest AS build

WORKDIR /tmp/up

# dependencies take a while to D/L, so D/L & cache before the build so code changes don't cause
# a new D/L
# can't glob *gradle because of the .gradle dir
COPY build.gradle gradlew settings.gradle /tmp/up/
COPY gradle/ /tmp/up/gradle/
RUN ./gradlew dependencies

# Now build the code
# copy the deployment dir first since it's unlikely to change often
COPY deployment/ /kb/deployment
COPY jettybase /kb/deployment/jettybase
COPY src /tmp/up/src/
COPY war /tmp/up/war/
RUN ./gradlew war

# Build the deployment directory
ENV DEPL=/kb/deployment/jettybase
RUN mkdir -p $DEPL/webapps
RUN cp /tmp/up/build/libs/user_profile.war $DEPL/webapps/ROOT.war

FROM kbase/kb_jre:latest

# These ARGs values are passed in via the docker build command
ARG BUILD_DATE
ARG VCS_REF
ARG BRANCH=develop

COPY deployment/ /kb/deployment/
COPY jettybase/ /kb/deployment/jettybase/
COPY --from=build /tmp/user_profile/dist/UserProfileService.war /kb/deployment/jettybase/webapps/ROOT.war
COPY --from=build /kb/deployment/ /kb/deployment/

# The BUILD_DATE value seem to bust the docker cache when the timestamp changes, move to
# the end
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 The KBase Project and its Contributors
Copyright (c) 2014-present The KBase Project and its Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
Loading
Loading