Skip to content

Commit

Permalink
feat!: Polarion 2410 support (#127)
Browse files Browse the repository at this point in the history
Refs: #126
  • Loading branch information
grigoriev authored Jan 10, 2025
1 parent 3d71043 commit 5891523
Show file tree
Hide file tree
Showing 10 changed files with 320 additions and 518 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
name: maven-build
on:
push:
branches: ['**/**']
branches: ['**']
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -20,11 +21,11 @@ jobs:
MARKDOWN2HTML_MAVEN_PLUGIN_FAIL_ON_ERROR: true
steps:
- name: 📄 Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: adopt
java-version: 17
Expand All @@ -37,7 +38,7 @@ jobs:
run: echo "cache_key=${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}-${{ github.sha }}" >> $GITHUB_OUTPUT
- name: 💾 Prepare cache using cache key
id: prepare-cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
/home/runner/.m2
Expand Down Expand Up @@ -115,14 +116,14 @@ jobs:
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }}
steps:
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: adopt
java-version: 17
gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }}
- name: 💾 Restore cache using cache key
id: restore-cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
/home/runner/.m2
Expand All @@ -131,11 +132,11 @@ jobs:
- name: 📦 Deploy artifacts to Maven Central
run: mvn --batch-mode -Dmaven.test.skip=true deploy -P gpg-sign -P nexus-staging

# Deploy release to GitHub Packages
# Deploy releases and snapshots for main branch to GitHub Packages
deploy-github-packages:
needs: build
runs-on: ubuntu-latest
if: ${{ !endsWith(needs.build.outputs.project_version, '-SNAPSHOT') && github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
contents: write
packages: write
Expand All @@ -145,13 +146,13 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
steps:
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: adopt
java-version: 17
- name: 💾 Restore cache using cache key
id: restore-cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
/home/runner/.m2
Expand All @@ -160,5 +161,6 @@ jobs:
- name: 📦 Deploy artifacts to GitHub Packages
run: mvn --batch-mode -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true deploy -P deploy-github-packages
- name: 📦 Upload assets to GitHub Release
if: ${{ !endsWith(needs.build.outputs.project_version, '-SNAPSHOT') }}
run: |-
gh release upload v${{ needs.build.outputs.project_version }} target/*-${{ needs.build.outputs.project_version }}.jar
8 changes: 5 additions & 3 deletions .github/workflows/openapi-validation.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
name: openapi-validate
on: [push]
on:
push:
workflow_dispatch:
jobs:
check-openapi-definition:
runs-on: ubuntu-latest
name: Swagger Editor Validator Remote
steps:
- name: 📄 Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: 🧪 Validate OpenAPI definition
uses: char0n/swagger-editor-validate@fe35d650e9fc674505607519d0d12ab4de5d415d # v1
uses: swaggerexpert/swagger-editor-validate@e8e51dbc8c18e87f96b082b18a6a7cbd3c44abd8 # v1.4.2
with:
definition-file: docs/openapi.json
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
name: Check commit messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.x
- run: pip install commitizen
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: release-please
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
Expand All @@ -12,7 +13,7 @@ jobs:
steps:
- name: release-please
id: release
uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4
uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3
with:
release-type: maven
target-branch: main
1 change: 1 addition & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-P polarion2410
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

This Polarion extension provides possibility to run custom Java code (via hooks), before Polarion saves/deletes a Work Item, Document, Plan or Test Run.

> [!IMPORTANT]
> Starting from version 4.0.0 only latest version of Polarion is supported.
> Right now it is Polarion 2410.
## Build

This extension can be produced using maven:

```bash
mvn clean package
```
Expand All @@ -14,27 +19,34 @@ mvn clean package
To install extension to Polarion `ch.sbb.polarion.extension.interceptor-manager-<version>.jar`
should be copied to `<polarion_home>/polarion/extensions/ch.sbb.polarion.extension.interceptor-manager/eclipse/plugins`.
It can be done manually or automated using maven build:

```bash
mvn clean install -P install-to-local-polarion
```

For automated installation with maven env variable `POLARION_HOME` should be defined and point to folder where Polarion is installed.

Changes only take effect after restart of Polarion.

## Polarion configuration

### Interceptor Manager settings/customization
Use Administration -> Interceptor Manager -> Settings page to enable/disable or set specific properties for each existing hook.

Use Administration -> Interceptor Manager -> Settings page to enable/disable or set specific properties for each existing hook.

### Hooks installation

#### Standalone jar hooks

Copy hook jar to hooks folder (`<polarion_home>/polarion/extensions/ch.sbb.polarion.extension.interceptor-manager/eclipse/plugins/hooks`) and enforce hooks reloading from the settings page or restart Polarion.
By default, newly added hooks are disabled and must be enabled manually.

#### Hooks from Different Polarion Extension

Hooks can be located in another Polarion extension. In this case, the following two approaches to register the hooks are supported:
- OSGi Services, illustrated in example: [Delete Non-resolved Module Comments as OSGi Service](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.interceptor-manager.hook-samples/tree/main/hook-samples-osgi)
- Google Guice, illustrated in example: [Delete Non-resolved Module Comments as Guice Module](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.interceptor-manager.hook-samples/tree/main/hook-samples-guice)

- OSGi Services, illustrated in example: [Delete Non-resolved Module Comments as OSGi Service](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.interceptor-manager.hook-samples/tree/main/hook-samples-osgi)
- Google Guice, illustrated in example: [Delete Non-resolved Module Comments as Guice Module](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.interceptor-manager.hook-samples/tree/main/hook-samples-guice)

### REST API

Expand All @@ -43,9 +55,13 @@ This extension provides REST API. OpenAPI Specification can be obtained [here](d
## Upgrade

### Upgrade from version 2.x.x to 3.0.0

Version 3.0.0 has received significant change - project+package rename. Verify you're using the new subfolder name in the `extensions` folder.
Also, this change prevents previous hooks versions from working. They must be replaced with the new ones built especially for v.3.0.0+. Note that doing this will reset hooks settings tho their default values, so do not forget to backup your actual settings to restore them after update.
Also, this change prevents previous hooks versions from working. They must be replaced with the new ones built especially for v.3.0.0+. Note that doing this will reset hooks settings tho their default values, so do not forget to backup your
actual settings to restore them after update.

### Upgrade from version 1.x.x to 2.0.0

Version 2.0.0 requires the new hooks model therefore hooks built for 1.x.x will stop working. They must be replaced with the new ones built especially for v.2.0.0+.
Also the new version introduced some significant internal settings model changes/improvements which have made old settings data incompatible. This means that during the first run all settings will be reset to their default values (unfortunately revisions history will be lost too).
Also the new version introduced some significant internal settings model changes/improvements which have made old settings data incompatible. This means that during the first run all settings will be reset to their default values (
unfortunately revisions history will be lost too).
Loading

0 comments on commit 5891523

Please sign in to comment.