Skip to content

Commit

Permalink
Merge branch 'master' into UICIRCLOG-149
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh-kalyanasundaram authored Dec 14, 2023
2 parents bca2c8d + 9b5875f commit f42400f
Show file tree
Hide file tree
Showing 72 changed files with 1,840 additions and 387 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/api-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: api-doc

# https://dev.folio.org/guides/api-doc/

# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''

env:
API_TYPES: 'RAML'
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''
OUTPUT_DIR: 'folio-api-docs'
AWS_S3_BUCKET: 'foliodocs'
AWS_S3_FOLDER: 'api'
AWS_S3_REGION: 'us-east-1'
AWS_S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_S3_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}

on:
push:
branches: [ main, master ]
paths:
- 'ramls/**'
tags: '[vV][0-9]+.[0-9]+.[0-9]+*'

jobs:
api-doc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.REF }}
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-doc \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Obtain version if release tag
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
version=$(echo ${GITHUB_REF#refs/tags/[vV]} | awk -F'.' '{ printf("%d.%d", $1, $2) }')
echo "VERSION_MAJ_MIN=${version}" >> $GITHUB_ENV
- name: Set some vars
run: |
echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Report some info
run: |
echo "REPO_NAME=${{ env.REPO_NAME }}"
- name: Do api-doc
run: |
if test -n "${{ env.VERSION_MAJ_MIN }}"; then
echo "Docs for release version ${{ env.VERSION_MAJ_MIN }}"
option_release=$(echo "--version ${{ env.VERSION_MAJ_MIN }}")
else
option_release=""
fi
python3 folio-tools/api-doc/api_doc.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
--output ${{ env.OUTPUT_DIR }} $option_release
- name: Show generated files
working-directory: ${{ env.OUTPUT_DIR }}
run: ls -R
- name: Publish to AWS S3
uses: sai-sharan/[email protected]
with:
access_key: ${{ env.AWS_S3_ACCESS_KEY_ID }}
secret_access_key: ${{ env.AWS_S3_ACCESS_KEY }}
region: ${{ env.AWS_S3_REGION }}
source: ${{ env.OUTPUT_DIR }}
destination_bucket: ${{ env.AWS_S3_BUCKET }}
destination_prefix: ${{ env.AWS_S3_FOLDER }}
delete: false
quiet: false

65 changes: 65 additions & 0 deletions .github/workflows/api-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: api-lint

# https://dev.folio.org/guides/api-lint/

# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''
#
# API_WARNINGS: boolean: Whether to cause Warnings to be displayed,
# and to fail the workflow.
# e.g. false

env:
API_TYPES: 'RAML'
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''
API_WARNINGS: false

on:
push:
paths:
- 'ramls/**'
pull_request:
paths:
- 'ramls/**'

jobs:
api-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-lint \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Configure default options
run: |
echo "OPTION_WARNINGS=''" >> $GITHUB_ENV
- name: Configure option warnings
if: ${{ env.API_WARNINGS == 'true' }}
run: |
echo "OPTION_WARNINGS=--warnings" >> $GITHUB_ENV
- name: Do api-lint
run: |
python3 folio-tools/api-lint/api_lint.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
${{ env.OPTION_WARNINGS }}
46 changes: 46 additions & 0 deletions .github/workflows/api-schema-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: api-schema-lint

# https://dev.folio.org/guides/describe-schema/

# API_DIRECTORIES: string: The space-separated list of directories to search
# for JSON Schema files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''

env:
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''

on:
push:
paths:
- 'ramls/**'
pull_request:
paths:
- 'ramls/**'

jobs:
api-schema-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-schema-lint \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Do api-schema-lint
run: |
python3 folio-tools/api-schema-lint/api_schema_lint.py \
--loglevel info \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ nbproject/
.settings/
.classpath
/bin/
/src/main/resources/postgres-conf.json
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM folioci/alpine-jre-openjdk11:latest
FROM folioci/alpine-jre-openjdk17:latest

# Install latest patch versions of packages: https://pythonspeed.com/articles/security-updates-in-docker/
USER root
RUN apk upgrade --no-cache
USER folio

ENV VERTICLE_FILE mod-audit-server-fat.jar

Expand Down
7 changes: 1 addition & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
buildMvn {
publishModDescriptor = 'yes'
mvnDeploy = 'yes'
buildNode = 'jenkins-agent-java11'

doApiLint = true
doApiDoc = true
apiTypes = 'RAML'
apiDirectories = 'ramls'
buildNode = 'jenkins-agent-java17'

doDocker = {
buildJavaDocker {
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 2.8.0 2023-10-11

* [MODAUD-110](https://issues.folio.org/browse/MODAUD-110) - Logging improvement
* [MODAUD-161](https://issues.folio.org/browse/MODAUD-161) - Use GitHub Workflows api-lint and api-schema-lint and api-doc
* [MODAUD-164](https://issues.folio.org/browse/MODAUD-164) - Allow action types for loan info
* [MODAUD-166](https://issues.folio.org/browse/MODAUD-166) - Update to Java 17
* [MODAUD-167](https://issues.folio.org/browse/MODAUD-167) - Upgrade folio-kafka-wrapper to 3.0.0 version
* [MODAUD-168](https://issues.folio.org/browse/MODAUD-168) - Incorrect Patron name shown in Circulation log as source for Change Due Date

## 2.7.0 2023-02-23

* [MODAUD-137](https://issues.folio.org/browse/MODAUD-137) - Logging improvement - Configuration
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mod-audit

Copyright (C) 2017-2022 The Open Library Foundation
Copyright (C) 2017-2023 The Open Library Foundation

This software is distributed under the terms of the Apache License,
Version 2.0. See the file "[LICENSE](LICENSE)" for more information.
Expand Down
40 changes: 35 additions & 5 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@
},
{
"id": "users",
"version": "15.2 16.0"
"version": "16.0"
},
{
"id": "template-engine",
"version": "2.2"
},
{
"id": "inventory",
"version": "12.0 13.0"
"version": "13.0"
},
{
"id": "holdings-storage",
"version": "4.4 5.0 6.0"
"version": "6.0"
},
{
"id": "cancellation-reason-storage",
"version": "1.1"
"version": "1.2"
}
],
"optional": [
Expand Down Expand Up @@ -127,6 +127,30 @@
}
]
},
{
"id": "acquisition-piece-events",
"version": "1.0",
"handlers": [
{
"methods": [
"GET"
],
"pathPattern": "/audit-data/acquisition/piece/{id}",
"permissionsRequired": [
"acquisition.piece.events.get"
]
},
{
"methods": [
"GET"
],
"pathPattern": "/audit-data/acquisition/piece/{id}/status-change-history",
"permissionsRequired": [
"acquisition.piece.events.get"
]
}
]
},
{
"id": "circulation-logs",
"version": "1.2",
Expand Down Expand Up @@ -230,6 +254,11 @@
"displayName": "Acquisition order-line events - get order-line change events",
"description": "Get order-line change events"
},
{
"permissionName": "acquisition.piece.events.get",
"displayName": "Acquisition piece events - get piece change events",
"description": "Get piece change events"
},
{
"permissionName": "audit.all",
"displayName": "Audit - all permissions",
Expand All @@ -242,7 +271,8 @@
"audit.item.delete",
"circulation-logs.collection.get",
"acquisition.order.events.get",
"acquisition.order-line.events.get"
"acquisition.order-line.events.get",
"acquisition.piece.events.get"
]
}
],
Expand Down
14 changes: 7 additions & 7 deletions mod-audit-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mod-audit-server</artifactId>
<version>2.7.1-SNAPSHOT</version>
<version>2.9.0-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<artifactId>mod-audit</artifactId>
<groupId>org.folio</groupId>
<version>2.7.1-SNAPSHOT</version>
<version>2.9.0-SNAPSHOT</version>
</parent>

<licenses>
Expand Down Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>org.folio</groupId>
<artifactId>folio-kafka-wrapper</artifactId>
<version>2.6.2</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
Expand Down Expand Up @@ -155,7 +155,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
<release>17</release>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
Expand Down Expand Up @@ -219,13 +219,13 @@
</plugin>

<plugin>
<groupId>com.nickwongdev</groupId>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.12.6</version>
<version>1.13.1</version>
<configuration>
<verbose>true</verbose>
<showWeaveInfo>false</showWeaveInfo>
<complianceLevel>11</complianceLevel>
<release>17</release>
<includes>
<include>**/impl/*.java</include>
<include>**/*.aj</include>
Expand Down
Loading

0 comments on commit f42400f

Please sign in to comment.