diff --git a/.github/workflows/publish-swagger-hub.yml b/.github/workflows/publish-swagger-hub.yml deleted file mode 100644 index 1fef7d935..000000000 --- a/.github/workflows/publish-swagger-hub.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "Publish OpenAPI to Swaggerhub" - -on: - workflow_call: - inputs: - version: - required: true - description: Version that will be published to Swaggerhub - type: string - -jobs: - swagger-api: - runs-on: ubuntu-latest - env: - SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }} - SWAGGERHUB_USER: ${{ secrets.SWAGGERHUB_USER }} - DOWNSTREAM_VERSION: ${{ inputs.version }} - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Setup node - uses: actions/setup-node@v4 - - - name: Install Swagger CLI - run: | - npm i -g swaggerhub-cli - - # create API, will fail if exists - - name: Create API - continue-on-error: true - run: | - swaggerhub api:create ${{ env.SWAGGERHUB_USER }}/item-relationship-service/${{ env.DOWNSTREAM_VERSION }} -f docs/src/api/irs-api.yaml --visibility=public --published=unpublish - - # Post the API to SwaggerHub as "unpublished", because published APIs cannot be overwritten - - name: Publish API Specs to SwaggerHub - run: | - if [[ ${{ env.DOWNSTREAM_VERSION }} != *-SNAPSHOT ]]; then - echo "[INFO] - no snapshot, will set the API to 'published'"; - swaggerhub api:update ${{ env.SWAGGERHUB_USER }}/item-relationship-service/${{ env.DOWNSTREAM_VERSION }} -f docs/src/api/irs-api.yaml --visibility=public --published=publish - swaggerhub api:setdefault ${{ env.SWAGGERHUB_USER }}/item-relationship-service/${{ env.DOWNSTREAM_VERSION }} - else - echo "[INFO] - snapshot, will set the API to 'unpublished'"; - swaggerhub api:update ${{ env.SWAGGERHUB_USER }}/item-relationship-service/${{ env.DOWNSTREAM_VERSION }} -f docs/src/api/irs-api.yaml --visibility=public --published=unpublish - fi diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 010c312c8..23c2b91e4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 \ No newline at end of file + 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 }} + + ``` diff --git a/.github/workflows/update-docs-for-release.yml b/.github/workflows/update-docs-for-release.yml deleted file mode 100644 index 70fdf27f7..000000000 --- a/.github/workflows/update-docs-for-release.yml +++ /dev/null @@ -1,184 +0,0 @@ -name: Update docs for IRS release - -env: - IRS_APPLICATION_PATH: 'irs-api/src/main/java/org/eclipse/tractusx/irs/IrsApplication.java' - TOP_LEVEL_CHANGELOG_PATH: 'CHANGELOG.md' - IRS_OPENAPI_SPEC_PATH: 'docs/src/api/irs-api.yaml' - IRS_HELM_CHANGELOG_PATH: 'charts/item-relationship-service/CHANGELOG.md' - SEMVER_PATTERN: '[0-9]+\.[0-9]+\.[0-9]+' - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -on: - workflow_dispatch: - inputs: - irs-version: - description: 'New IRS version' - required: true - type: string - helm-chart-version: - description: 'New Helm Chart version' - required: true - type: string - helm-changelog-irs-added: - description: '"Update IRS version to ..." change already present in charts/irs-helm/CHANGELOG.md for this release?' - required: true - type: choice - options: - - 'Yes' - - 'No' - default: 'No' -jobs: - update-docs-for-release: - runs-on: ubuntu-latest - outputs: - previous-irs-version: ${{ steps.update-docs.outputs.previous-irs-version }} - - 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 - 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=$(grep -Eo "## \[${{ inputs.helm-chart-version }}\]" ${{ env.IRS_HELM_CHANGELOG_PATH }} || echo "") - - if [[ -n "$matched_irs_version" || -n "$matched_helm_chart_version" ]]; then - echo "IRS or Helm Chart release version already exists, aborting..." - exit 1 - fi - continue-on-error: false - - - name: Update top level changelog, IRS Helm changelog, Helm repository's yaml file and IrsApplication.java - id: update-docs - run: | - new_irs_version="${{ inputs.irs-version }}" - new_helm_chart_version="${{ inputs.helm-chart-version }}" - irs_change_present_in_helm_changelog="${{ inputs.helm-changelog-irs-added }}" - date=$(date +"%Y-%m-%d") - - semver_pattern="${{ env.SEMVER_PATTERN }}" - semver_pattern_sed="[0-9]\+\.[0-9]\+\.[0-9]\+" - - # get line numbers of "Unreleased" or "UNRELEASED" placeholders in changelogs to use them with sed - top_lvl_changelog_placeholder_line_number=$(cat -n ${{ env.TOP_LEVEL_CHANGELOG_PATH }} | grep -Eoi "[0-9]+.## \[Unreleased\]" | grep -Eo "[0-9]+") - irs_helm_changelog_placeholder_line_number=$(cat -n ${{ env.IRS_HELM_CHANGELOG_PATH }} | grep -Eoi "[0-9]+.## \[Unreleased\]" | grep -Eo "[0-9]+") - - ### update CHANGELOG.md ### - # get line number of uppermost comparison url ("[Unreleased]: https://github.com/.../version...HEAD") - latest_comparison_url_line_number=$(cat -n ${{ env.TOP_LEVEL_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.TOP_LEVEL_CHANGELOG_PATH }} | grep -Eo "\[$semver_pattern\]" | tr -d "[]") - echo "previous-irs-version=$previous_irs_version" >> "$GITHUB_OUTPUT" - - # correct uppermost comparison - sed -i "$latest_comparison_url_line_number s|$semver_pattern_sed\.\.\.HEAD|$new_irs_version...HEAD|" ${{ env.TOP_LEVEL_CHANGELOG_PATH }} - - # insert new comparison below uppermost one - sed -i "$((latest_comparison_url_line_number+1)) s|^|[$new_irs_version]: https://github.com/eclipse-tractusx/item-relationship-service/compare/$previous_irs_version...$new_irs_version\n|" ${{ env.TOP_LEVEL_CHANGELOG_PATH }} - - # replace placeholder - # get line numbers of "Unreleased" placeholder in changelogs to use them with sed - top_lvl_changelog_placeholder_line_number=$(cat -n ${{ env.TOP_LEVEL_CHANGELOG_PATH }} | grep -Eoi "[0-9]+.## \[Unreleased\]" | grep -Eo "[0-9]+") - sed -i "$((top_lvl_changelog_placeholder_line_number+1)) s|^|\n## [$new_irs_version] - $date\n|" ${{ env.TOP_LEVEL_CHANGELOG_PATH }} - - ### update irs-helm directory's CHANGELOG.md ### - if [[ "$irs_change_present_in_helm_changelog" == "No" ]]; then - # get line number of first header which is not placeholder - next_header_line_number=$(cat -n ${{ env.IRS_HELM_CHANGELOG_PATH }} | grep -Eo -m 1 "[0-9]+.## \[$semver_pattern\]" | grep -Eo "^[0-9]+") - # get line number of first "### Changed" section - first_changed_section_line_number=$(cat -n ${{ env.IRS_HELM_CHANGELOG_PATH }} | 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 - sed -i "$((first_changed_section_line_number+1)) s|^|- Update IRS version to $new_irs_version\n|" ${{ env.IRS_HELM_CHANGELOG_PATH }} - # not present, insert before beginning of next header - else - sed -i "$(($next_header_line_number-1)) s|^|\n### Changed\n- Update IRS version to $new_irs_version\n|" ${{ env.IRS_HELM_CHANGELOG_PATH }} - fi - fi - - # replace placeholder - irs_helm_changelog_placeholder_line_number=$(cat -n ${{ env.IRS_HELM_CHANGELOG_PATH }} | grep -Eoi "[0-9]+.## \[Unreleased\]" | grep -Eo "[0-9]+") - sed -i "$((irs_helm_changelog_placeholder_line_number+1)) s|^|\n## [$new_helm_chart_version] - $date\n|" ${{ env.IRS_HELM_CHANGELOG_PATH }} - - ### update irs-api.yaml ### - irs_openapi_spec_irs_version_line_number=$(cat -n ${{ env.IRS_OPENAPI_SPEC_PATH }} | grep -Eo -m 1 "[0-9]+.+version: $semver_pattern" | grep -Eo "^[0-9]+") - sed -i "$irs_openapi_spec_irs_version_line_number s|$semver_pattern_sed|$new_irs_version|" ${{ env.IRS_OPENAPI_SPEC_PATH }} - - ### update IrsApplication.java ### - sed -i "s|API_VERSION = \"$semver_pattern_sed\"|API_VERSION = \"$new_irs_version\"|" ${{ env.IRS_APPLICATION_PATH }} - - - name: Create pull request - id: cpr - uses: peter-evans/create-pull-request@v6 - with: - commit-message: 'chore(docs): Update docs for release ${{ inputs.irs-version }}' - branch: chore/update-docs-for-irs-release-${{ inputs.irs-version }} - base: main - delete-branch: true - title: Updated docs for next release - body: This PR prepares the docs for IRS release version ${{ inputs.irs-version }}. - Please check whether the docs were updated correctly. Once this PR is merged, the release process will continue automatically. - - - name: Wait for pull request merge - run: | - pull_request_number=${{ steps.cpr.outputs.pull-request-number }} - pull_request_merged="False" - seconds_waited_for_merge=0 - # set duration between api requests - sleep_interval_length=30 # seconds - timeout_in_minutes=10 - - while [[ "$pull_request_merged" == "False" ]] - do - # give some time to merge pull request - sleep "$sleep_interval_length"s - - # retrieve pr status using GH API's pull requests endpoint with GH CLI - pr_status=$(gh pr view $pull_request_number --json state --jq ".state") - - case $pr_status in - - MERGED) - pull_request_merged="True" - ;; - - OPEN) - seconds_waited_for_merge=$((seconds_waited_for_merge+sleep_interval_length)) - # abort workflow when having waited for more than specified time - if [[ $seconds_waited_for_merge -gt $((timeout_in_minutes*60)) ]]; then - exit 1 - fi - ;; - - CLOSED) - exit 1 - ;; - - esac - - done - continue-on-error: false - - - name: Create and push new Git tag for release - run: git tag ${{ inputs.irs-version }} && git push origin ${{ inputs.irs-version }} - - call-release-workflow: - needs: - - update-docs-for-release - uses: ./.github/workflows/release.yaml - with: - new-irs-version: ${{ inputs.irs-version }} - previous-irs-version: ${{ needs.update-docs-for-release.outputs.previous-irs-version }} - helm-chart-version: ${{ inputs.helm-chart-version }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64994e7a0..297234ee6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,6 +3,7 @@ Thanks for your interest in this project. # Table of Contents + 1. [Project description](#project-description) 2. [Project licenses](#project-licenses) 3. [Terms of Use](#terms-of-use) @@ -88,7 +89,9 @@ See [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md). ## Eclipse Dependency License Check -In case of new dependencies or version updates, it might be necessary to have the new library checked and accepted by the Eclipse foundation. Do create new tickets for this, you can use this command: +In case of new dependencies or version updates, it might be necessary to have the new library checked and accepted by +the Eclipse foundation. Do create new tickets for this, you can use this command: + ``` mvn org.eclipse.dash:license-tool-plugin:license-check -Ddash.iplab.token=$ECLIPSE_DASH_TOKEN -Ddash.projectId=automotive.tractusx --batch-mode -DskipTests -P dash ``` @@ -99,30 +102,37 @@ For more information on the tool and how to acquire the token, check https://git General contributions e.g. contributions to improve documentation are welcome. If you need ideas for contributions, you can check the following links: + - [open documentation stories](https://github.com/orgs/eclipse-tractusx/projects/8/views/4?filterQuery=label%3Adocumentation++status%3Ainbox%2Cbacklog) - [discussion page concerning documentation improvements](https://github.com/eclipse-tractusx/item-relationship-service/discussions/407) -### Maintaining [CHANGELOG.md](CHANGELOG.md) +### Maintaining [CHANGELOG.md](CHANGELOG.md) + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres -to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). _**For better traceability add the corresponding GitHub issue number in each changelog entry, please.**_ ## Contributing as a Consultant ### Conceptual work and specification guidelines -1. The prerequisite for a concept is always a GitHub issue that defines the business value and the acceptance criteria that are to be implemented with the concept + +1. The prerequisite for a concept is always a GitHub issue that defines the business value and the acceptance criteria + that are to be implemented with the concept 2. Copy and rename directory /docs/#000-concept-name-template /docs/#- -3. Copy the template file [/docs/concept/TEMPLATE_Concept.md](docs/concept/TEMPLATE_Concept.md) into new directory `/docs/#-`. +3. Copy the template file [/docs/concept/TEMPLATE_Concept.md](docs/concept/TEMPLATE_Concept.md) into new + directory `/docs/#-`. ### Diagrams + [PlantUML](https://plantuml.com/) and [Mermaid](https://mermaid.js.org/) is used for conceptual work. +#### PlantUML + +default skinparam for plantUml diagrams -#### PlantUML -default skinparam for plantUml diagrams ```` @startuml skinparam monochrome true @@ -134,8 +144,10 @@ autonumber "[000]" @enduml ```` -#### Mermaid +#### Mermaid + Default header for mermaid sequence diagrams + ```` sequenceDiagram %%{init: {'theme': 'dark', 'themeVariables': { 'fontSize': '15px'}}}%% @@ -157,6 +169,7 @@ Example: Detailed pattern can be found here: [commit-msg](local/development/commit-msg) #### How to Use + ```shell cp local/development/commit-msg .git/hooks/commit-msg && chmod 500 .git/hooks/commit-msg ``` @@ -166,11 +179,15 @@ For further information please see https://github.com/hazcod/semantic-commit-hoo ### Code Formatting #### Deprecated soon: + Please use the following code formatter: [.idea/codeStyles](.idea/codeStyles) -#### Upcoming change (not available until whole project base will be formatted to new standard): +#### Upcoming change (not available until whole project base will be formatted to new standard): + Google Java Format will be used as code format standard. -Please install `google-java-format` plugin and edit customer VM options (for IntelliJ `Help → Edit Custom VM Options...`) and paste following configuration: +Please install `google-java-format` plugin and edit customer VM options (for +IntelliJ `Help → Edit Custom VM Options...`) and paste following configuration: + ``` -Xmx4096m --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED @@ -180,54 +197,60 @@ Please install `google-java-format` plugin and edit customer VM options (for Int --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED ``` -The plugin will be disabled by default. To enable it in the current project, go to `File→Settings...→google-java-format` Settings (or `IntelliJ IDEA→Preferences...→Other Settings→google-java-format` Settings on macOS) and check the Enable google-java-format checkbox. (A notification will be presented when you first open a project offering to do this for you.) + +The plugin will be disabled by default. To enable it in the current project, go to `File→Settings...→google-java-format` +Settings (or `IntelliJ IDEA→Preferences...→Other Settings→google-java-format` Settings on macOS) and check the Enable +google-java-format checkbox. (A notification will be presented when you first open a project offering to do this for +you.) More info: https://github.com/google/google-java-format/blob/master/README.md#intellij-jre-config ### Create a Release -#### Full release +### Full release 1. Choose a release version using [semantic versioning](https://semver.org/spec/v2.0.0.html) and create a corresponding branch according to the template: `chore/prepare-release-x.x.x`. -2. Add release notes for new version in [CHANGELOG.md](CHANGELOG.md) - and [charts/item-relationship-service/CHANGELOG.md](charts/item-relationship-service/CHANGELOG.md) - (for an example [see here](https://github.com/eclipse-tractusx/item-relationship-service/pull/429)) - - Check if the changelog entries for the release are complete. - - Add the corresponding GitHub issue numbers to each entry if missing. +2. Make sure the changelog entries [CHANGELOG.md](CHANGELOG.md) + and [charts/item-relationship-service/CHANGELOG.md](charts/item-relationship-service/CHANGELOG.md) are up-to-date + - Check if the changelog entries for the release are complete. + - Add the corresponding GitHub issue numbers to each entry if missing. 3. Update [COMPATIBILITY_MATRIX.md](COMPATIBILITY_MATRIX.md). -4. Update IRS API version in IrsApplication class and irs-api.yaml -5. Create pull request from [release preparation branch to main](https://github.com/eclipse-tractusx/item-relationship-service/compare/chore/prepare-release-x.x.x) -6. Merge this pull request to main. -7. Create Git tag for the desired release version `git tag x.x.x` - (note: the _item-relationship-service_ tag will be created automatically by the GitHub workflow based on the version in the [helm chart changelog](charts/item-relationship-service/CHANGELOG.md)). -8. Push Git tag to repository `git push origin x.x.x` (this will trigger the GitHub release workflow). -9. Wait for release workflow to complete. -10. Merge the pull request that was automatically opened by GitHub actions bot. -11. Notify about the release in IRS Matrix Chat using the following template: - - > **IRS Release x.x.x** - > - > IRS version x.x.x is released. - > - > https://github.com/eclipse-tractusx/item-relationship-service/releases/tag/x.x.x
- > https://github.com/eclipse-tractusx/item-relationship-service/releases/tag/item-relationship-service-y.y.y
- > **Full Changelog:** https://github.com/eclipse-tractusx/item-relationship-service/compare/w.w.w...x.x.x - - _(replace x.x.x with IRS version to release, y.y.y with IRS helm version to release and w.w.w with previous IRS version)_ - -#### Release chart only +4. Execute the workflow named _"Prepare Release documentation"_. The workflow takes three inputs. These are: + - IRS release version - type: semantic version string + - Helm Chart release version - type: semantic version string + - Whether to automatically update the Helm Chart changelog with the change + _"- Update IRS version to x.x.x"_. This is a checkbox which is ticked by default. +5. The workflow updates the necessary documentation and creates a pull request right away. + Review the changes and merge the PR. +6. Once the pull request has been merged, the helm chart will be release automatically. +7. To create the IRS release, [draft a new release](https://github.com/eclipse-tractusx/item-relationship-service/releases/new). As a tag and title, choose the IRS version provided to the release workflow. (If the release is created from a hotfix branch, make sure to choose this hotfix branch as the target of the tag) +8. Paste the release notes from the PR into the release description. +9. Notify about the release in IRS Matrix Chat using the following template: + +> **IRS Release x.x.x** +> +> IRS version x.x.x is released. +> +> https://github.com/eclipse-tractusx/item-relationship-service/releases/tag/x.x.x
+> https://github.com/eclipse-tractusx/item-relationship-service/releases/tag/item-relationship-service-y.y.y
+> **Full Changelog:** https://github.com/eclipse-tractusx/item-relationship-service/compare/w.w.w...x.x.x + +_(replace x.x.x with IRS version to release, y.y.y with Helm Chart version to release and w.w.w with previous IRS +version)_ + +### Release Helm chart only 1. Choose a release version using [semantic versioning](https://semver.org/spec/v2.0.0.html) and create a corresponding branch according to the template: `chore/release-chart-x.x.x`. 2. Add new version to [charts/item-relationship-service/CHANGELOG.md](charts/item-relationship-service/CHANGELOG.md) -3. Change chart version in [Chart.yaml](charts/item-relationship-service/Chart.yaml) -4. Create pull request from [release preparation branch to main](https://github.com/eclipse-tractusx/item-relationship-service/compare/chore/release-chart-x.x.x) +3. Change chart version in [Chart.yaml](charts/item-relationship-service/Chart.yaml) +4. Create pull request + from [release preparation branch to main](https://github.com/eclipse-tractusx/item-relationship-service/compare/chore/release-chart-x.x.x) 5. Merge this pull request to main. 6. Wait for release workflow to complete. - ## Contact See [CONTACT](CONTACT.md)