diff --git a/CODEOWNERS b/.github/CODEOWNERS similarity index 100% rename from CODEOWNERS rename to .github/CODEOWNERS diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/.github/prompts/review.prompt.md b/.github/prompts/review.prompt.md new file mode 100644 index 00000000..bc115bb7 --- /dev/null +++ b/.github/prompts/review.prompt.md @@ -0,0 +1,108 @@ +--- +description: "Perform a code review" +--- + +## Code Review Expert: Detailed Analysis and Best Practices + +As a senior software engineer with expertise in code quality, security, and performance optimization, perform a code review of the provided git diff. + +Focus on delivering actionable feedback in the following areas: + +Critical Issues: +- Security vulnerabilities and potential exploits +- Runtime errors and logic bugs +- Performance bottlenecks and optimization opportunities +- Memory management and resource utilization +- Threading and concurrency issues +- Input validation and error handling + +Code Quality: +- Adherence to language-specific conventions and best practices +- Design patterns and architectural considerations +- Code organization and modularity +- Naming conventions and code readability +- Documentation completeness and clarity +- Test coverage and testing approach + +Maintainability: +- Code duplication and reusability +- Complexity metrics (cyclomatic complexity, cognitive complexity) +- Dependencies and coupling +- Extensibility and future-proofing +- Technical debt implications + +Provide specific recommendations with: +- Code examples for suggested improvements +- References to relevant documentation or standards +- Rationale for suggested changes +- Impact assessment of proposed modifications + +Format your review using clear sections and bullet points. Include inline code references where applicable. Output should be in markdown format. + +Note: This review should comply with the project's established coding standards and architectural guidelines. + +Create a .md file with your findings. + +## Constraints + +* **VERY IMPORTANT**: Use `git --no-pager diff --name-only master` to get changed files to be reviewed. +* **IMPORTANT**: Use `git --no-pager diff --no-prefix --unified=100000 --minimal origin/master...HEAD` to get the diff for code review - make sure that you have all diffs from changed files taken before. +* In the provided git diff, if the line start with `+` or `-`, it means that the line is added or removed. If the line starts with a space, it means that the line is unchanged. If the line starts with `@@`, it means that the line is a hunk header. + +* Avoid overwhelming the developer with too many suggestions at once. +* Use clear and concise language to ensure understanding. + +* Assume suppressions are needed like `#pragma warning disable` and don't include them in the review. +* If there are any TODO comments, make sure to address them in the review. + +* Use markdown for each suggestion, like + ``` + # Code Review for ${feature_description} + + Overview of the code changes, including the purpose of the feature, any relevant context, and the files involved. + + # Suggestions + + ## ${code_review_emoji} ${Summary of the suggestion, include necessary context to understand suggestion} + * **Priority**: ${priority: (πŸ”₯/⚠️/🟑/🟒)} + * **File**: ${relative/path/to/file} + * **Details**: ... + * **Example** (if applicable): ... + * **Suggested Change** (if applicable): (code snippet...) + ## (other suggestions...) + ... + + # Summary + ``` +* Use the following emojis to indicate the priority of the suggestions: + * πŸ”₯ Critical + * ⚠️ High + * 🟑 Medium + * 🟒 Low +* Each suggestion should be prefixed with an emoji to indicate the type of suggestion: + * πŸ”§ Change request + * ❓ Question + * ⛏️ Nitpick + * ♻️ Refactor suggestion + * πŸ’­ Thought process or concern + * πŸ‘ Positive feedback + * πŸ“ Explanatory note or fun fact + * 🌱 Observation for future consideration +* Always use file paths + +### Use Code Review Emojis + +Use code review emojis. Give the reviewee added context and clarity to follow up on code review. For example, knowing whether something really requires action (πŸ”§), highlighting nit-picky comments (⛏), flagging out of scope items for follow-up (πŸ“Œ) and clarifying items that don’t necessarily require action but are worth saying ( πŸ‘, πŸ“, πŸ€” ) + +#### Emoji Legend + +| | `:code:` | Meaning | +|:--:|:-------------------:|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| πŸ”§ | `:wrench:` | Use when this needs to be changed. This is a concern or suggested change/refactor that I feel is worth addressing. | +| ❓ | `:question:` | Use when you have a question. This should be a fully formed question with sufficient information and context that requires a response. | +| ⛏ | `:pick:` | This is a nitpick. This does not require any changes and is often better left unsaid. This may include stylistic, formatting, or organization suggestions and should likely be prevented/enforced by linting if they really matter | +| ♻️ | `:recycle:` | Suggestion for refactoring. Should include enough context to be actionable and not be considered a nitpick. | +| πŸ’­ | `:thought_balloon:` | Express concern, suggest an alternative solution, or walk through the code in my own words to make sure I understand. | +| πŸ‘ | `:+1:` | Let the author know that you really liked something! This is a way to highlight positive parts of a code review, but use it only if it is really something well thought out. | +| πŸ“ | `:memo:` | This is an explanatory note, fun fact, or relevant commentary that does not require any action. | +| 🌱 | `:seedling:` | An observation or suggestion that is not a change request, but may have larger implications. Generally something to keep in mind for the future. | \ No newline at end of file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 00000000..443c9cb1 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,19 @@ +name: Maven central workflow + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + maven: + uses: folio-org/.github/.github/workflows/maven.yml@v1 + # Only handle push events from the main branch or tags, to decrease PR noise + if: github.ref_name == github.event.repository.default_branch || github.event_name != 'push' || github.ref_type == 'tag' + secrets: inherit + with: + java-version: '21' + publish-module-descriptor: true + allow-snapshots-release: false + do-sonar-scan: true + do-docker: true diff --git a/.github/workflows/spectral-lint.yml b/.github/workflows/spectral-lint.yml new file mode 100644 index 00000000..fecd44cf --- /dev/null +++ b/.github/workflows/spectral-lint.yml @@ -0,0 +1,22 @@ +name: Run Spectral on Pull Requests + +on: + push: + paths: + - 'src/main/resources/swagger.api/**' + pull_request: + paths: + - 'src/main/resources/swagger.api/**' + +jobs: + build: + name: Run Spectral + runs-on: ubuntu-latest + steps: + # Check out the repository + - uses: actions/checkout@v3 + + # Run Spectral + - uses: stoplightio/spectral-action@latest + with: + file_glob: 'src/main/resources/swagger.api/*.yaml' diff --git a/.rancher-pipeline.yml b/.rancher-pipeline.yml deleted file mode 100644 index 37485cb5..00000000 --- a/.rancher-pipeline.yml +++ /dev/null @@ -1,27 +0,0 @@ -stages: -- name: Build - steps: - - runScriptConfig: - image: maven:3-openjdk-17 - shellScript: mvn package -DskipTests -- name: Build Docker with DIND - steps: - - publishImageConfig: - dockerfilePath: ./Dockerfile - buildContext: . - tag: docker.dev.folio.org/mod-remote-storage:firebird-latest - pushRemote: true - registry: docker.dev.folio.org -- name: Deploy - steps: - - applyAppConfig: - catalogTemplate: p-ngvqv:firebird-helmcharts-mod-remote-storage - version: 0.1.30 - answers: - image.repository: docker.dev.folio.org/mod-remote-storage - image.tag: firebird-latest - postJob.enabled: true - targetNamespace: firebird - name: mod-remote-storage -timeout: 60 -notification: {} diff --git a/Dockerfile b/Dockerfile index 596e8a67..1aaa1767 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,22 +4,14 @@ USER root # Install latest patch versions of packages: https://pythonspeed.com/articles/security-updates-in-docker/ RUN apk upgrade --no-cache +USER folio # Copy your fat jar to the container -ENV APP_FILE mod-remote-storage-fat.jar - +ENV APP_FILE=mod-remote-storage-fat.jar # - should be a single jar file ARG JAR_FILE=./target/*.jar # - copy COPY ${JAR_FILE} ${JAVA_APP_DIR}/${APP_FILE} -ARG RUN_ENV_FILE=run.sh - -COPY ${RUN_ENV_FILE} ${JAVA_APP_DIR}/ -RUN chmod 755 ${JAVA_APP_DIR}/${RUN_ENV_FILE} - -# Run as this user -USER folio - # Expose this port locally in the container. EXPOSE 8081 diff --git a/Jenkinsfile b/Jenkinsfile-disabled similarity index 100% rename from Jenkinsfile rename to Jenkinsfile-disabled diff --git a/NEWS.md b/NEWS.md index a0dc8470..34acbdd0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ ## 3.5.0 2025-XX-XX * [MODRS-243](https://folio-org.atlassian.net/browse/MODRS-243) - Item Storage API version update from 10.1 to 11.0 * [MODRS-250](https://folio-org.atlassian.net/browse/MODRS-250) - Adjust module to be compatible with Tenant API 2.0 +* [MODRS-253](https://folio-org.atlassian.net/browse/MODRS-253) - Use GitHub Workflows for Maven ## 3.4.3 2025-05-19 diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index d8551688..00000000 --- a/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,83 +0,0 @@ - - -## Purpose - - -## Approach - - -### TODOS and Open Questions - - -## Learning - - -## Pre-Merge Checklist: - Before merging this PR, please go through the following list and take appropriate actions. - - - Does this PR meet or exceed the expected quality standards? - - [ ] Code coverage on new code is 80% or greater - - [ ] Duplications on new code is 3% or less - - [ ] There are no major code smells or security issues - - Does this introduce breaking changes? - - [ ] Were any API paths or methods changed, added or removed? - - [ ] Were there any schema changes? - - [ ] Did any of the interface versions change? - - [ ] Were permissions changed, added, or removed? - - [ ] Are there new interface dependencies? - - [ ] There are no breaking changes in this PR. - - [ ] Check logging - - If there are breaking changes, please **STOP** and consider the following: - - - What other modules will these changes impact? - - Do JIRAs exist to update the impacted modules? - - [ ] If not, please create them - - [ ] Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc. - - [ ] Do they have all they appropriate links to blocked/related issues? - - Are the JIRAs under active development? - - [ ] If not, contact the project's PO and make sure they're aware of the urgency. - - Do PRs exist for these changes? - - [ ] If so, have they been approved? - - Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase. - - While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee. diff --git a/run.sh b/run.sh deleted file mode 100644 index 15713ac2..00000000 --- a/run.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# -#DB_PROPS_FILE=/usr/verticles/1.txt -#touch ${DB_PROPS_FILE} -#echo "spring.datasource.username=${DB_USERNAME} spring.datasource.password=${DB_PASSWORD} spring.datasource.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_DATABASE}" | sed 's/\s\+/\n/g' | tee ${DB_PROPS_FILE} -# - -############################################################################ -# Assign fake values to variables (like DB_HOST/DB_PORT etc) if not provided -# This way DB connection won't be established but the application boots up -############################################################################ - -DB_URL="jdbc:postgresql://${DB_HOST:-localhost}:${DB_PORT:-5432}/${DB_DATABASE:-db}" -# -DB_OPTS="-Dspring.datasource.username=${DB_USERNAME:-user} -Dspring.datasource.password=${DB_PASSWORD:-pass} -Dspring.datasource.url=${DB_URL}" -# -export JAVA_OPTIONS="${JAVA_OPTIONS:-} ${DB_OPTS}"