Skip to content

feat: bump ui to latest #12422

feat: bump ui to latest

feat: bump ui to latest #12422

name: "Create Kommander Branch"
on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
workflow_dispatch: {}
permissions:
pull-requests: write
contents: write
jobs:
get-kapps-branch-name:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'open-kommander-pr')
outputs:
branch_name: ${{ steps.branch-name.outputs.branch_name }}
escaped_branch_name: ${{ steps.escaped-branch-name.outputs.escaped_branch_name }}
base_branch_name: ${{ steps.base-branch-name.outputs.base_branch_name }}
steps:
- id: branch-name
run: echo "branch_name=${{ github.head_ref }}" >> $GITHUB_OUTPUT
- id: escaped-branch-name
run: echo "escaped_branch_name=$(echo ${{ github.head_ref }} | sed -e 's/\//\\\//g')" >> $GITHUB_OUTPUT
- id: base-branch-name
run: echo "base_branch_name=${{ github.base_ref }}" >> $GITHUB_OUTPUT
- name: Check output branch-name
run: echo ${{ steps.branch-name.outputs.branch_name }}
- name: Check output escaped-branch-name
run: echo ${{ steps.escaped-branch-name.outputs.escaped_branch_name }}
- name: Check output base-branch-name
run: echo ${{ steps.base-branch-name.outputs.base_branch_name }}
create-kommander-branch:
runs-on: ubuntu-latest
needs: get-kapps-branch-name
if: contains(github.event.pull_request.labels.*.name, 'open-kommander-pr')
steps:
- uses: actions/checkout@v4
with:
repository: 'mesosphere/kommander'
token: ${{ secrets.MESOSPHERECI_USER_TOKEN }}
path: 'kommander'
fetch-depth: '0'
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
workdir: 'kommander'
- name: Make test branch pointing to kommander-applications ref
id: make-test-branch
env:
PULL_REQUEST_BODY: ${{ github.event.pull_request.body }}
run: |
set -x
cd kommander
git config user.name d2iq-mergebot
git config user.email ci-mergebot@d2iq.com
git config user.signingKey ${{ secrets.GPG_KEY_ID }}
# Use same base as k-apps (main or release branch)
git checkout ${{ needs.get-kapps-branch-name.outputs.base_branch_name }}
# If branch already exists, do nothing
git show-ref --quiet --verify -- refs/remotes/origin/kapps/${{ needs.get-kapps-branch-name.outputs.base_branch_name }}/${{ needs.get-kapps-branch-name.outputs.branch_name }} || {
git checkout -b kapps/${{ needs.get-kapps-branch-name.outputs.base_branch_name }}/${{ needs.get-kapps-branch-name.outputs.branch_name }}
# Point the kommander-applications ref to the k-apps branch
sed -i 's|KOMMANDER_APPLICATIONS_REF ?= ${{ needs.get-kapps-branch-name.outputs.base_branch_name }}|KOMMANDER_APPLICATIONS_REF ?= ${{ needs.get-kapps-branch-name.outputs.escaped_branch_name }}|' Makefile
git add Makefile
# Only automatically bump versions in kommander branch is k-apps branch is an automated chartbump PR
if [[ ${{ needs.get-kapps-branch-name.outputs.escaped_branch_name }} == chartbump/* ]] ;
then
# Update kuttl tests that reference the app being bumped
kapps=$(echo "$PULL_REQUEST_BODY" | grep -oP '(?<=kapps:)[^ ]+')
kapps=${kapps#"kapps:"}
semver="(0|[1-9]+[0-9]*)\.(0|[1-9]+[0-9]*)\.(0|[1-9]+[0-9]*)"
for appversion in $kapps; do
appname=$(echo $appversion | sed -r 's/(.*)(-.*)/\1/')
IFS='-' read -r new_appname new_version <<< "$appversion"
for file in $(find ./tests ./docs -type f -print); do
case $file in
*".yaml" | *".yaml.tmpl" | *".md") sed -r -i "s/$appname-$semver/$appversion/g" $file;;
esac
done
# For loop to find and replace the version in a path based on appname and semver
for file in $(find ./tests ./docs -type f -print); do
case $file in
*".yaml" | *".yaml.tmpl" | *".md") sed -r -i "s#($new_appname)/$semver#\1/$new_version#g" $file;;
esac
done
done
git add ./tests
fi
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit -v -m "build: Update kommander-applications ref for testing"
git push --force-with-lease --set-upstream origin kapps/${{ needs.get-kapps-branch-name.outputs.base_branch_name }}/${{ needs.get-kapps-branch-name.outputs.branch_name }}
echo "created_new_branch=true" >> $GITHUB_OUTPUT
fi
cd -
}
- name: checkout local directory for script
if: contains(needs.get-kapps-branch-name.outputs.branch_name, 'gpu-operator')
uses: actions/checkout@v4
with:
path: 'main'
- name: Create comment
if: steps.make-test-branch.outputs.created_new_branch == 'true'
uses: peter-evans/create-or-update-comment@v4
env:
GH_TOKEN: ${{ secrets.MERGEBOT_TOKEN }}
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
✅ Created Kommander branch to test kommander-applications changes: https://github.com/mesosphere/kommander/tree/kapps/${{ needs.get-kapps-branch-name.outputs.base_branch_name }}/${{ needs.get-kapps-branch-name.outputs.branch_name }}