Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eclipse-tractusx/item-relationship-service
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b962268288efb8ca4046da87bcb6406db53ecbf0
Choose a base ref
..
head repository: eclipse-tractusx/item-relationship-service
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bb5384c693b4bc259baf39bf57c79d706b1b4d11
Choose a head ref
Showing with 886 additions and 663 deletions.
  1. +1 −1 .github/workflows/cucumber-integration-test.yaml
  2. +0 −50 .github/workflows/publish-swagger-hub.yml
  3. +125 −39 .github/workflows/release.yaml
  4. +1 −1 .github/workflows/tavern-integration.yml
  5. +1 −1 .github/workflows/tavern.yml
  6. +0 −184 .github/workflows/update-docs-for-release.yml
  7. +5 −0 CHANGELOG.md
  8. +64 −41 CONTRIBUTING.md
  9. +4 −2 docs/src/api/irs-api.yaml
  10. +1 −1 ...cumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/E2ETestStepDefinitionsForJobApi.java
  11. +10 −0 irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/asset/model/EdcContext.java
  12. +10 −2 .../edc/client/contract/model/{EdcCreateContractDefinitionRequest.java → EdcContractDefinition.java}
  13. +6 −0 ...c/main/java/org/eclipse/tractusx/irs/edc/client/contract/model/EdcContractDefinitionCriteria.java
  14. +12 −13 .../main/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractDefinitionService.java
  15. +12 −1 ...edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/policy/ConstraintCheckerService.java
  16. +38 −11 ...t/java/org/eclipse/tractusx/irs/edc/client/contract/service/EdcContractDefinitionServiceTest.java
  17. +68 −37 ...client/src/test/java/org/eclipse/tractusx/irs/edc/client/policy/ConstraintCheckerServiceTest.java
  18. +236 −230 ...edc-client/src/test/java/org/eclipse/tractusx/irs/edc/client/policy/PolicyCheckerServiceTest.java
  19. +46 −0 ...test/java/org/eclipse/tractusx/irs/edc/client/testutil/CamelCaseToSpacesDisplayNameGenerator.java
  20. +6 −4 ...y-store/src/main/java/org/eclipse/tractusx/irs/policystore/controllers/PolicyStoreController.java
  21. +6 −2 irs-policy-store/src/main/java/org/eclipse/tractusx/irs/policystore/services/PolicyStoreService.java
  22. +19 −4 ...main/java/org/eclipse/tractusx/irs/policystore/validators/BusinessPartnerNumberListValidator.java
  23. +9 −0 .../main/java/org/eclipse/tractusx/irs/policystore/validators/ValidListOfBusinessPartnerNumbers.java
  24. +17 −16 ...icy-store/src/test/java/org/eclipse/tractusx/irs/policystore/services/PolicyStoreServiceTest.java
  25. +94 −9 .../java/org/eclipse/tractusx/irs/policystore/validators/BusinessPartnerNumberListValidatorTest.java
  26. +95 −14 local/testing/request-collection/IRS_Request_Collection.json
2 changes: 1 addition & 1 deletion .github/workflows/cucumber-integration-test.yaml
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ jobs:
mvn clean verify -P cucumber -Dgroups="$ISSUE_FILTER" -pl irs-cucumber-tests -am --batch-mode 2> irs-cucumber-tests/report-banner.txt
- name: Publish Cucumber Results
uses: EnricoMi/publish-unit-test-result-action@v2.16.1
uses: EnricoMi/publish-unit-test-result-action@v2.17.0
if: always()
with:
files: |
50 changes: 0 additions & 50 deletions .github/workflows/publish-swagger-hub.yml

This file was deleted.

164 changes: 125 additions & 39 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,72 +1,158 @@
name: Release IRS
name: Prepare Release documentation

on:
workflow_call:
workflow_dispatch:
inputs:
new-irs-version:
irs-version:
description: 'New IRS version'
required: true
type: string
previous-irs-version:
description: 'Previous IRS version'
required: true
type: string

helm-chart-version:
description: 'New Helm Chart version'
required: true
type: string

add-change-to-helm-changelog:
description: 'Add "Update IRS to ..." change to Helm Chart changelog'
required: true
type: boolean
default: true

env:
IRS_APPLICATION_PATH: 'irs-api/src/main/java/org/eclipse/tractusx/irs/IrsApplication.java'
CHANGELOG_PATH: 'CHANGELOG.md'
OPENAPI_SPEC_PATH: 'docs/src/api/irs-api.yaml'
HELM_CHART_PATH: 'charts/item-relationship-service'
SEMVER_PATTERN: '[0-9]+\.[0-9]+\.[0-9]+'
SEMVER_PATTERN_SED: '[0-9]\+\.[0-9]\+\.[0-9]\+'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Validate that workflow inputs are SemVer strings
run: |
matched_irs_semver_string=$(echo "${{ inputs.irs-version }}" | grep -Ex "${{ env.SEMVER_PATTERN }}" || echo "")
matched_helm_chart_semver_string=$(echo "${{ inputs.helm-chart-version }}" | grep -Ex "${{ env.SEMVER_PATTERN }}" || echo "")
if [[ -z "$matched_irs_semver_string" || -z "$matched_helm_chart_semver_string" ]]; then
echo "At least one of the version numbers ${{ inputs.irs-version }} or ${{ inputs.helm-chart-version }} is not a SemVer string."
exit 1
fi
continue-on-error: false

- name: Validate that IRS and Helm Chart versions don't exist yet
run: |
# IRS version can be checked via git tag since every release has a tag
matched_irs_version=$(git tag | grep -Eo "^${{ inputs.irs-version }}" || echo "")
# extract from Helm Chart changelog
matched_helm_chart_version=$(git tag | grep -Eo "^(irs-helm|item-relationship-service)-${{ inputs.irs-version }}" || echo "")
if [[ -n "$matched_irs_version" || -n "$matched_helm_chart_version" ]]; then
echo "At least one of the version numbers ${{ inputs.irs-version }} or ${{ inputs.helm-chart-version }} already exists."
exit 1
fi
continue-on-error: false

- name: Update changelog
id: main-changelog-update
run: |
date=$(date +"%Y-%m-%d")
# get line number of uppermost comparison url at bottom of changelog ("[Unreleased]: https://github.com/.../version...HEAD")
latest_comparison_url_line_number=$(cat -n ${{ env.CHANGELOG_PATH }} | grep -Eoi "[0-9]+.\[Unreleased\]" | grep -Eo "[0-9]+")
# previous version can be extracted from line below uppermost comparison
previous_irs_version=$(awk "NR==$((latest_comparison_url_line_number+1))" ${{ env.CHANGELOG_PATH }} | grep -Eo "\[${{ env.SEMVER_PATTERN }}\]" | tr -d "[]")
echo "previous-irs-version=$previous_irs_version" >> "$GITHUB_OUTPUT"
# correct uppermost comparison
sed -i "$latest_comparison_url_line_number s|${{ env.SEMVER_PATTERN_SED }}\.\.\.HEAD|${{ inputs.irs-version }}...HEAD|" ${{ env.CHANGELOG_PATH }}
# insert new comparison below uppermost one
sed -i "$((latest_comparison_url_line_number+1)) s|^|[${{ inputs.irs-version }}]: \
https://github.com/eclipse-tractusx/item-relationship-service/compare/$previous_irs_version...${{ inputs.irs-version }}\n|" ${{ env.CHANGELOG_PATH }}
# replace placeholder
placeholder_line_number=$(cat -n ${{ env.CHANGELOG_PATH }} | grep -Eoi "[0-9]+.## \[Unreleased\]" | grep -Eo "[0-9]+")
sed -i "$((placeholder_line_number+1)) s|^|\n## [${{ inputs.irs-version }}] - $date\n|" ${{ env.CHANGELOG_PATH }}
- name: Update Helm changelog
run: |
date=$(date +"%Y-%m-%d")
### update Helm Chart directory's CHANGELOG.md ###
helm_changelog_placeholder_line_number=$(cat -n ${{ env.HELM_CHART_PATH }}/CHANGELOG.md | grep -Eoi "[0-9]+.## \[Unreleased\]" | grep -Eo "[0-9]+")
if [[ "${{ inputs.add-change-to-helm-changelog }}" == "true" ]]; then
# get line number of first header which is not placeholder
next_header_line_number=$(cat -n ${{ env.HELM_CHART_PATH }}/CHANGELOG.md | grep -Eo -m 1 "[0-9]+.## \[${{ env.SEMVER_PATTERN }}\]" | grep -Eo "^[0-9]+")
# get line number of first "### Changed" section
first_changed_section_line_number=$(cat -n ${{ env.HELM_CHART_PATH }}/CHANGELOG.md | grep -Eo -m 1 "[0-9]+.### Changed" | grep -Eo "[0-9]+")
# "### Changed" is already present for current changelog if it comes before next header -> just insert line below
if [[ $first_changed_section_line_number -lt $next_header_line_number ]]; then
# check if markdown was properly formatted (with blank line between "### Changed" and first change)
line_after=$(awk "NR==$((first_changed_section_line_number+1))" ${{ env.HELM_CHART_PATH }}/CHANGELOG.md)
if [[ "$line_after" == "" ]]; then
sed -i "$((first_changed_section_line_number+1)) s|^|\n- Update IRS version to ${{ inputs.irs-version }}|" ${{ env.HELM_CHART_PATH }}/CHANGELOG.md
else # format properly with blank line
sed -i "$((first_changed_section_line_number+1)) s|^|\n- Update IRS version to ${{ inputs.irs-version }}\n|" ${{ env.HELM_CHART_PATH }}/CHANGELOG.md
fi
else
sed -i "$((helm_changelog_placeholder_line_number+1)) s|^|\n### Changed\n\n- Update IRS version to ${{ inputs.irs-version }}\n|" ${{ env.HELM_CHART_PATH }}/CHANGELOG.md
fi
fi
# replace placeholder
helm_changelog_placeholder_line_number=$(cat -n ${{ env.HELM_CHART_PATH }}/CHANGELOG.md | grep -Eoi "[0-9]+.## \[Unreleased\]" | grep -Eo "[0-9]+")
sed -i "$((helm_changelog_placeholder_line_number+1)) s|^|\n## [${{ inputs.helm-chart-version }}] - $date\n|" ${{ env.HELM_CHART_PATH }}/CHANGELOG.md
- name: Update IrsApplication.java
run: sed -i "s|${{ steps.main-changelog-update.outputs.previous-irs-version }}|${{ inputs.irs-version }}|" ${{ env.IRS_APPLICATION_PATH }}

- name: Update irs-api.yaml
run: |
sed -i '0,/version: ${{ env.SEMVER_PATTERN_SED }}/s//version: ${{ inputs.irs-version }}/' ${{ env.OPENAPI_SPEC_PATH }}
- name: Update Chart.yaml appVersion
uses: mikefarah/yq@v4.44.2
with:
cmd: yq -i eval '.appVersion = "${{ inputs.new-irs-version }}"' charts/item-relationship-service/Chart.yaml
cmd: yq -i eval '.appVersion = "${{ inputs.irs-version }}"' ${{ env.HELM_CHART_PATH }}/Chart.yaml

- name: Update Chart.yaml version
uses: mikefarah/yq@v4.44.2
with:
cmd: yq -i eval '.version = "${{ inputs.helm-chart-version }}"' charts/item-relationship-service/Chart.yaml

- name: Prepare Helm release
uses: peter-evans/create-pull-request@v6
with:
commit-message: "chore(release): Prepare release for Helm version ${{ inputs.helm-chart-version }}"
branch: chore/prepare-helm-release-${{ inputs.helm-chart-version }}
base: main
delete-branch: true
title: Prepare Helm release for next version
body: |
This PR prepares the Helm chart release for version ${{ inputs.helm-chart-version }}.
Please check whether the Chart was updated correctly and that the CHANGELOG contains the relevant information
for this release. Also, make sure that the values.yaml is correct before merging this PR.
cmd: yq -i eval '.version = "${{ inputs.helm-chart-version }}"' ${{ env.HELM_CHART_PATH }}/Chart.yaml

- name: Extract changelog text
# See: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "CHANGELOG<<$EOF" >> $GITHUB_ENV
sed -n -e '/## \[${{ inputs.new-irs-version }}\]/,/## \[/ p' CHANGELOG.md | head -n -1 | tail -n +2 >> $GITHUB_ENV
echo **Full Changelog**: ${{ github.server_url }}/${{ github.repository }}/compare/${{ inputs.previous-irs-version }}...${{ inputs.new-irs-version }} >> $GITHUB_ENV
sed -n -e '/## \[${{ inputs.irs-version }}\]/,/## \[/ p' ${{ env.CHANGELOG_PATH }} | head -n -1 | tail -n +2 >> $GITHUB_ENV
echo **Full Changelog**: ${{ github.server_url }}/${{ github.repository }}/compare\
/${{ steps.main-changelog-update.outputs.previous-irs-version }}...${{ inputs.irs-version }} >> $GITHUB_ENV
echo "$EOF" >> "$GITHUB_ENV"
- name: Create IRS release
uses: softprops/action-gh-release@v2
- name: Update docs and Helm chart for release
uses: peter-evans/create-pull-request@v6
with:
body: ${{ env.CHANGELOG }}
tag_name: ${{ inputs.new-irs-version }}

publish-to-swaggerhub:
name: "Publish OpenAPI spec to Swaggerhub"
permissions:
contents: read
needs:
- release
uses: ./.github/workflows/publish-swagger-hub.yml
with:
version: ${{ inputs.new-irs-version }}
secrets: inherit
commit-message: 'chore(docs): updated docs and Helm chart for IRS release ${{ inputs.irs-version }}'
branch: action/update-for-release-${{ inputs.irs-version }}
delete-branch: true
title: "chore: updated docs and Helm chart for release"
body: This PR prepares the docs and the Helm chart for IRS release ${{ inputs.irs-version }}.
Please check whether everything was updated correctly. Once this PR is merged, you can draft a new release
with the following Releasenotes.

```
${{ env.CHANGELOG }}
```
2 changes: 1 addition & 1 deletion .github/workflows/tavern-integration.yml
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ jobs:
sed "s/access_tok.*:s = '.*'//g" tavern-results.xml | sed "s/Authorization: Bearer .*/Authorization:/g" | uniq > result.xml
- name: Publish Tavern Results
uses: EnricoMi/publish-unit-test-result-action@v2.16.1
uses: EnricoMi/publish-unit-test-result-action@v2.17.0
if: always()
with:
files: |
2 changes: 1 addition & 1 deletion .github/workflows/tavern.yml
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ jobs:
sed "s/access_tok.*:s = '.*'//g" tavern-results.xml | sed "s/Authorization: Bearer .*/Authorization:/g" | uniq > result.xml
- name: Publish Tavern Results
uses: EnricoMi/publish-unit-test-result-action@v2.16.1
uses: EnricoMi/publish-unit-test-result-action@v2.17.0
if: always()
with:
files: |
Loading