Skip to content

Commit

Permalink
Merge pull request #3580 from mercedes-benz/feature-3517-liveness-pro…
Browse files Browse the repository at this point in the history
…bes-web-ui-frontend

Feature 3517 liveness probes web UI frontend
  • Loading branch information
sven-dmlr authored Oct 31, 2024
2 parents 3e41436 + 3894578 commit efec380
Show file tree
Hide file tree
Showing 6 changed files with 317 additions and 68 deletions.
257 changes: 257 additions & 0 deletions .github/workflows/release-web-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
# SPDX-License-Identifier: MIT
name: Release Web UI

on:
workflow_dispatch:
inputs:
actor-email:
description: Insert your email address here. It will be used in the generated pull requests
required: true
web-ui-version:
description: Web-UI Version (e.g. 0.1.0)
required: true
web-ui-milestone-number:
description: Web-UI Milestone number (e.g. 70)
required: true

permissions:
contents: write
issues: write
packages: write
pull-requests: write

env:
ACTIONS_BASE_IMAGE_DEBIAN: debian:12-slim
ACTIONS_SECHUB_REGISTRY: ghcr.io/mercedes-benz/sechub
ACTIONS_HELM_REGISTRY: "oci://ghcr.io/mercedes-benz/sechub/helm-charts"

jobs:
release-version:
name: Create Web-UI release
runs-on: ubuntu-latest
steps:

- name: "Show Inputs"
run: |
echo "actor-email: '${{ inputs.actor-email }}'"
echo "Web-UI '${{ inputs.web-ui-version }}' - Milestone '${{ inputs.web-ui-milestone-number }}'"
# Check inputs:
- name: "Verify Input for Web-UI release"
if: (inputs.web-ui-version == '') || (inputs.web-ui-milestone-number == '')
run: |
echo "For Web-UI release, web-ui-version and web-ui-milestone-number must be provided!"
exit 1
- name: Checkout master
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
with:
ref: master

# Create temporary local tag, so we build for this tag...
# The final tag on git server side will be done automatically by the release when the draft is saved as "real" release
- name: "Temporary tag server version: v${{ inputs.web-ui-version }}-web-ui"
run: git tag v${{ inputs.web-ui-version }}-web-ui

# ----------------------
# Setup + Caching
# ----------------------
- name: Set up JDK 17
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73
with:
java-version: 17
distribution: temurin

- name: Set up Gradle
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808
with:
cache-read-only: false

- name: Docker login to ghcr.io
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# ----------------------
# Create pull request if license headers are missing
# ----------------------
- name: run apply-headers.sh
id: apply-headers
run: |
git config user.name "$GITHUB_TRIGGERING_ACTOR (via github-actions)"
git config user.email "${{ inputs.actor-email }}"
./apply-headers.sh
git commit -am "SPDX headers added by SecHub release job @github-actions" || true
COMMITS=`git log --oneline --branches --not --remotes`
echo "commits=$COMMITS" >> $GITHUB_OUTPUT
- name: Create pull request for SPDX license headers
id: pr_spdx_headers
if: steps.apply-headers.outputs.commits != ''
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
with:
branch: release-spdx-headers
branch-suffix: short-commit-hash
delete-branch: true
title: '0 - Before web-ui release: Add missing SPDX license headers [auto-generated]'
body: |
Auto-generated by Github Actions web-ui release job.
-> Please review and merge **before** publishing the web-ui release.
- name: Print PR infos
if: steps.apply-headers.outputs.commits != ''
run: |
echo "Pull Request Number - ${{ steps.pr_spdx_headers.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.pr_spdx_headers.outputs.pull-request-url }}"
# ----------------------
# Build SecHub Web-UI
# ----------------------
# tbd

- name: Collect GIT status
if: always()
run: |
# restore reduced-openapi3.json
git restore sechub-api-java/src/main/resources/reduced-openapi3.json
mkdir -p build/reports
git status > build/reports/git-status.txt
echo "--- git tags:" >> build/reports/git-status.txt
git tag --points-at HEAD >> build/reports/git-status.txt
- name: Archive GIT status
if: always()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: git-status.txt
path: build/reports/git-status.txt
retention-days: 14

- name: Archive Web-UI artifacts
if: always()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: sechub-web-ui
path: sechub-web-ui/build/libs
retention-days: 14

# -----------------------------------------
# Assert releaseable: Check for uncommitted changes
# -----------------------------------------
- name: Assert releasable
run: |
git status
./gradlew assertReleaseable
- name: Create Web-UI release
id: create_web-ui_release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: v${{ inputs.web-ui-version }}-web-ui
commitish: master
release_name: web-ui Version ${{ inputs.web-ui-version }}
body: |
Changes in this Release
- Some minor changes on Web-UI implementation
For more details please look at [Milestone ${{inputs.web-ui-milestone-number}}]( https://github.com/mercedes-benz/sechub/milestone/${{inputs.web-ui-milestone-number}}?closed=1)
draft: true
prerelease: false

- name: Create sha256 checksum file for Web-UI jar
run: |
cd sechub-web-ui/build/libs
sha256sum sechub-web-ui-${{ inputs.web-ui-version }}.jar > sechub-web-ui-${{ inputs.web-ui-version }}.jar.sha256sum
- name: Upload Web-UI release asset sechub-web-ui-${{ inputs.web-ui-version }}.jar
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_web-ui_release.outputs.upload_url }}
asset_path: sechub-web-ui/build/libs/sechub-web-ui-${{ inputs.web-ui-version }}.jar
asset_name: sechub-web-ui-${{ inputs.web-ui-version }}.jar
asset_content_type: application/zip

- name: Upload Web-UI release asset sechub-web-ui-${{ inputs.web-ui-version }}.jar.sha256sum
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_web-ui_release.outputs.upload_url }}
asset_path: sechub-web-ui/build/libs/sechub-web-ui-${{ inputs.web-ui-version }}.jar.sha256sum
asset_name: sechub-web-ui-${{ inputs.web-ui-version }}.jar.sha256sum
asset_content_type: text/plain

# -----------------------------------------
# Create release issue
# -----------------------------------------
- name: Create SecHub Web-UI ${{ inputs.web-ui-version }} release issue
uses: dacbd/create-issue-action@main
with:
token: ${{ github.token }}
title: Release SecHub Web-UI ${{ inputs.web-ui-version }}
body: |
See [Milestone ${{inputs.web-ui-milestone-number}}]( https://github.com/mercedes-benz/sechub/milestone/${{inputs.web-ui-milestone-number}}?closed=1) for details.
Please close this issue after the release.
milestone: ${{ inputs.web-ui-milestone-number }}

# Build SecHub Web-UI container image + push to ghcr
- name: Build sechub-web-ui ${{ inputs.web-ui-version }} container image + push to ghcr
run: |
WEB_SERVER_VERSION="${{ inputs.web-ui-version }}"
DOCKER_REGISTRY="$ACTIONS_SECHUB_REGISTRY/sechub-web-ui"
VERSION_TAG="${WEB_SERVER_VERSION}"
cp sechub-web-ui/build/libs/sechub-web-ui-${WEB_SERVER_VERSION}.jar sechub-web-ui-solution/docker/copy/
cd sechub-web-ui-solution
echo "# Building image $DOCKER_REGISTRY:$VERSION_TAG"
echo " from $ACTIONS_BASE_IMAGE_DEBIAN"
./10-create-image.sh "$DOCKER_REGISTRY" "$VERSION_TAG" "WEB_SERVER_VERSION" "$ACTIONS_BASE_IMAGE_DEBIAN" copy
echo "# Pushing image $DOCKER_REGISTRY:$VERSION_TAG (latest)"
./20-push-image.sh "$DOCKER_REGISTRY" "$VERSION_TAG" yes
- name: Build sechub-web-ui Helm chart + push to ghcr
shell: bash
run: |
cd sechub-web-ui-solution/helm
echo "# Building Helm chart for SecHub Web-UI"
helm package sechub-web-ui
helm push sechub-web-ui-*.tgz $ACTIONS_HELM_REGISTRY
# -----------------------------------------
# Create a pull request for merging back `master` into `develop`
# -----------------------------------------
- name: pull-request master to develop
id: pr_master_to_develop
continue-on-error: true
uses: repo-sync/pull-request@7e79a9f5dc3ad0ce53138f01df2fad14a04831c5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: "master"
destination_branch: "develop"
pr_allow_empty: true # should allow an empty PR, but seems not to work
pr_title: '2 - After web-ui release: Merge master back into develop [auto-generated]'
pr_body: |
After SecHub Web-UI release
- Web-UI '${{ inputs.web-ui-version }}'
Merge master branch back into develop
-> Please merge **after** the release has been published.
- name: Print PR infos if PR was created
if: steps.pr_master_to_develop.outcome == 'success'
run: |
echo "Pull Request Number - ${{ steps.pr_master_to_develop.outputs.pr_number }}"
echo "Pull Request URL - ${{ steps.pr_master_to_develop.outputs.pr_url }}"
- name: Print info if no PR was created
if: steps.pr_master_to_develop.outcome != 'success'
run: |
echo "Nothing to merge - no pull request necessary."
Loading

0 comments on commit efec380

Please sign in to comment.