Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update Spring Boot to version 3.3.0 #708

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
42877ad
chore(deps): Performed Spring Boot Upgrade to v3.3.0
ds-pweick Jun 14, 2024
642e64b
fix(metrics): fixed minor logical error in CustomKeyValueProvider
ds-pweick Jun 17, 2024
370dcf6
refactor(metrics): Minuscule refactoring to CustomKeyValueProvider
ds-pweick Jun 18, 2024
bbe45f8
fix(spring): code now works with updated spring boot version
ds-pweick Jun 19, 2024
d26e843
test(metrics): add unit test to verify custom prometheus config logic
ds-pweick Jun 19, 2024
8b02665
Merge branch 'main' into test/update-spring-boot
ds-pweick Jun 19, 2024
28ca05e
chore(dependencies): updated DEPENDENCIES file
ds-pweick Jun 19, 2024
e3b7df4
Merge branch 'main' into helper
ds-pweick Jun 19, 2024
e539b1a
chore(dependencies): updated DEPENDENCIES file
ds-pweick Jun 19, 2024
a3eff2c
Merge branch 'main' into test/update-spring-boot
ds-pweick Jun 19, 2024
4ac169f
Merge branch 'helper' into test/update-spring-boot
ds-pweick Jun 19, 2024
918e168
Merge remote-tracking branch 'origin/test/update-spring-boot' into te…
ds-pweick Jun 19, 2024
7136ea3
Merge branch 'main' into test/update-spring-boot
ds-pweick Jun 20, 2024
a307077
Merge branch 'main' into test/update-spring-boot
ds-pweick Jun 20, 2024
7c43581
refactor(release): Release workflow now updates docs
ds-pweick Jun 25, 2024
b8a7ac9
refactor(release): made release workflow name more consistent
ds-pweick Jun 25, 2024
42b4a45
Merge pull request #116 from ds-pweick/refactor/release-workflow
ds-pweick Jun 25, 2024
97b58cc
feat(dummy): dummy changes helm changelog
ds-pweick Jun 25, 2024
0aa2da4
fix(release): fixed syntax error in release workflow
ds-pweick Jun 25, 2024
4db3c7e
fix(release): fixed syntax error in release workflow
ds-pweick Jun 25, 2024
880ebcf
fix(release): fixed syntax error in release workflow
ds-pweick Jun 25, 2024
fd29920
fix(release): fixed syntax error in release workflow
ds-pweick Jun 25, 2024
9b10e39
refactor(release): changed auto-generated pr title for consistency
ds-pweick Jun 25, 2024
615057e
refactor(release): changed auto-generated pr title for consistency
ds-pweick Jun 25, 2024
293821d
Merge remote-tracking branch 'origin/refactor/release-workflow' into …
ds-pweick Jun 25, 2024
62dc3b0
refactor(release): cleaned up leftover dummy text in Helm Chart chang…
ds-pweick Jun 25, 2024
3ea21da
fix(release): fix syntax error in release workflow step
ds-pweick Jun 26, 2024
11c1780
fix(release): fixed syntax error in release workflow step
ds-pweick Jun 26, 2024
c37b2a4
fix(release): fixed release workflow not generating release body again
ds-pweick Jun 26, 2024
704a71c
chore(docs): updated docs and Helm chart for IRS release 5.1.5
ds-pweick Jun 27, 2024
deab236
Merge pull request #126 from ds-pweick/action/update-for-release-5.1.5
ds-pweick Jun 27, 2024
e07608d
Update CHANGELOG.md
ds-pweick Jun 27, 2024
51b506c
refactor(release): removed superfluous step from release workflow again
ds-pweick Jun 27, 2024
0dff368
refactor(release): removed superfluous step from release workflow again
ds-pweick Jun 27, 2024
72dadc8
fix(release): release workflow makes sure to call other workflows
ds-pweick Jun 27, 2024
989c2ca
fix(release): release workflow makes sure to call other workflows
ds-pweick Jun 27, 2024
155f9fa
chore(docs): updated docs and Helm chart for IRS release 5.1.9
ds-pweick Jun 27, 2024
22caea8
Merge pull request #131 from ds-pweick/action/update-for-release-5.1.9
ds-pweick Jun 27, 2024
4f20c14
chore(docs): update CONTRIBUTING.md for new release workflow
ds-pweick Jun 27, 2024
be40ec4
chore(docs): update CONTRIBUTING.md for new release workflow
ds-pweick Jul 3, 2024
8817030
chore(docs): updated CONTRIBUTING.md for new release workflow
ds-pweick Jul 3, 2024
6814df4
Merge branch 'main' of https://github.com/eclipse-tractusx/item-relat…
ds-pweick Jul 3, 2024
7a274d3
Merge branch 'refs/heads/main' into refactor/release-workflow
ds-pweick Jul 3, 2024
8afb635
fix(release): release workflow executes subsequent workflows correctly
ds-pweick Jul 3, 2024
b83d697
refactor(docs): cleaned up dummy changes in CHANGELOG.md
ds-pweick Jul 3, 2024
66fae6b
fix(release): release workflow executes subsequent workflows correctly
ds-pweick Jul 3, 2024
663adfe
refactor(release): clean up dummy changes from various files
ds-pweick Jul 3, 2024
1d498d4
fix(release): release workflow executes subsequent workflows correctly
ds-pweick Jul 3, 2024
8cf228f
Merge pull request #154 from ds-pweick/refactor/release-workflow
ds-pweick Jul 3, 2024
536fe07
fix(release): cleanup dummy changes
ds-pweick Jul 3, 2024
f48d21d
Merge pull request #156 from ds-pweick/refactor/release-workflow
ds-pweick Jul 3, 2024
b770da3
chore(docs): updated docs and Helm chart for IRS release 5.1.6
ds-pweick Jul 3, 2024
5b4ef26
Merge pull request #158 from ds-pweick/action/update-for-release-5.1.6
ds-pweick Jul 3, 2024
c790156
chore(merge): Merge tractusx main
ds-pweick Jul 10, 2024
624f3bd
Merge branch 'refs/heads/main' into test/update-spring-boot
ds-pweick Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion .github/workflows/helm-chart-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,41 @@ name: Release Helm Charts

on:
workflow_dispatch: # Trigger manually
workflow_call:
inputs:
checkout-tag:
description: 'Whether to check out a tag'
required: false
type: boolean
default: false

ref-to-checkout:
description: 'Ref of branch/tag from which to execute workflow'
required: true
type: string
push:
branches:
- main
paths:
- 'charts/**'

jobs:
determine-ref:
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.determine-ref.outputs.ref }}
steps:
- name: Determine ref to check out
id: determine-ref
run: |
if [[ "${{ inputs.checkout-tag }}" == "false" ]]; then
echo "ref=${{ github.ref }}" >> "$GITHUB_OUTPUT"
else
echo "ref=${{ inputs.ref-to-checkout }}" >> "$GITHUB_OUTPUT"
fi

get-helm-charts-versions-irs:
needs: determine-ref
outputs:
latest_version: ${{ steps.step1.outputs.latest_version }}
current_version: ${{ steps.step2.outputs.current_version }}
Expand All @@ -21,6 +48,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: 'true'
ref: ${{ needs.determine-ref.outputs.ref }}

- name: Get helm charts latest tag version
id: step1
Expand All @@ -36,7 +65,7 @@ jobs:
echo "Exported $chartVersion helm charts version"

release:
needs: "get-helm-charts-versions-irs"
needs: [get-helm-charts-versions-irs, determine-ref]
if: needs.get-helm-charts-versions-irs.outputs.latest_version != needs.get-helm-charts-versions-irs.outputs.current_version
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
Expand All @@ -48,6 +77,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: 'true'
ref: ${{ needs.determine-ref.outputs.ref }}

- name: Configure Git
run: |
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/publish-swagger-hub.yml

This file was deleted.

231 changes: 204 additions & 27 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,72 +1,249 @@
name: Release IRS

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]\+\'
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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=$(grep -Eo "## \[${{ inputs.helm-chart-version }}\]" ${{ env.HELM_CHART_PATH }}/CHANGELOG.md || 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
uses: mikefarah/[email protected]

Check notice

Code scanning / KICS

Unpinned Actions Full Length Commit SHA Note

Action is not pinned to a full length commit SHA.
with:
cmd: yq -i eval '.info.version = "${{ inputs.irs-version }}"' ${{ env.OPENAPI_SPEC_PATH }}

- name: Update Chart.yaml appVersion
uses: mikefarah/[email protected]
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/[email protected]
with:
cmd: yq -i eval '.version = "${{ inputs.helm-chart-version }}"' charts/item-relationship-service/Chart.yaml
cmd: yq -i eval '.version = "${{ inputs.helm-chart-version }}"' ${{ env.HELM_CHART_PATH }}/Chart.yaml

- name: Prepare Helm release
- name: Update docs and Helm chart for release
id: cpr
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
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: 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.
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, 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=5 # seconds
timeout_in_minutes=15

echo "Waiting for merge of PR #$pull_request_number."

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"
echo "PR #$pull_request_number merged, continuing the workflow."
;;

OPEN)
seconds_waited_for_merge=$((seconds_waited_for_merge+sleep_interval_length))

# abort workflow when having waited for more than allowed time
if [[ $seconds_waited_for_merge -gt $((timeout_in_minutes*60)) ]]; then
echo "Timeout waiting for merge of PR #$pull_request_number, aborting the workflow."
exit 1
fi
;;

CLOSED)
echo "PR #$pull_request_number was closed, aborting the workflow."
exit 1
;;

esac

done
continue-on-error: false

- name: Create and push new Git tag for release and pull latest changes
run: git tag ${{ inputs.irs-version }} && git push origin ${{ inputs.irs-version }} && git pull

- 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
with:
body: ${{ env.CHANGELOG }}
tag_name: ${{ inputs.new-irs-version }}
tag_name: ${{ inputs.irs-version }}

release-helm-chart:
name: "Release Helm chart"
needs:
- release
uses: ./.github/workflows/helm-chart-release.yaml
with:
checkout-tag: true
ref-to-checkout: 'refs/tags/${{ inputs.irs-version }}'

build-irs:
name: "Build IRS"
needs:
- release
uses: ./.github/workflows/irs-build.yml
secrets: inherit
with:
checkout-tag: true
ref-to-checkout: 'refs/tags/${{ inputs.irs-version }}'

trivy-image-scan:
name: "Scan image in local registry with Trivy"
needs:
- release
uses: ./.github/workflows/trivy-image-scan.yml
secrets: inherit
with:
checkout-tag: true
ref-to-checkout: 'refs/tags/${{ inputs.irs-version }}'

publish-to-swaggerhub:
name: "Publish OpenAPI spec to Swaggerhub"
permissions:
contents: read
validate-openapi-definition:
needs:
- release
uses: ./.github/workflows/publish-swagger-hub.yml
name: "Validate OpenAPI definition"
uses: ./.github/workflows/swagger-editor-validate.yml
secrets: inherit
with:
version: ${{ inputs.new-irs-version }}
secrets: inherit
checkout-tag: true
ref-to-checkout: 'refs/tags/${{ inputs.irs-version }}'
Loading
Loading