Skip to content

Commit

Permalink
All our tweaks should go here
Browse files Browse the repository at this point in the history
If there is another thing to add to our fork, pls add it here.

Example:

```
echo -e "#foo?\n\n bar?" > foo-bar.md # Pls keep adding the changes to standalone files that are not present in the upstream to mitigate the risk of conflict
add foo-bar.md
git commit -s --ammend
yada yada
```

Signed-off-by: Jirka Kremser <[email protected]>
  • Loading branch information
jkremser committed Apr 29, 2024
1 parent d15f6fd commit 34673b3
Show file tree
Hide file tree
Showing 4 changed files with 1,783 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/gh-release-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Helm Publish

on:
release:
types:
- published
workflow_dispatch:
permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add the -kedifyN suffix to chart's version
run: |
sed -i keda/Chart.yaml -e 's;^version:.*;version: ${{ github.ref_name }};'
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.PAT_TOKEN }}
charts_dir: "."
- name: Create k3s cluster
uses: AbsaOSS/k3d-action@v2
with:
cluster-name: "test-cluster"
k3d-version: v5.6.0
args: >-
--no-lb
--k3s-arg "--disable=traefik,servicelb,local-storage@server:*"
- name: Smoke test helm installation
run: |
# exp-backoff - we wait for pages to become available here
for i in $(seq 16)
do
_sec=$(echo "1.5^$i" | bc)
echo "Waiting ${_sec} seconds.."
sleep ${_sec}
helm repo add kedify https://kedify.github.io/charts || continue
helm repo update
set -x
helm upgrade -i keda kedify/keda \
-n keda \
--create-namespace \
--timeout 300s \
--wait \
--version ${{ github.ref_name }} \
--set customManagedBy=kedify && break
set +x
[ "$i" = "16" ] && exit 1
done
echo -e "\n\n\n pods:\n\n"
kubectl get pods -A
echo "::group::values.yaml"
helm get values -n keda keda
echo "::endgroup::"
echo "::group::resulting YAML manifests"
helm get manifest -n keda keda
echo "::endgroup::"
echo -e "\n\nthe following command is supposed to fail:\n\n"
helm template keda kedify/keda \
--version ${{ github.ref_name }} \
--set crds.install=f4lse || true
101 changes: 101 additions & 0 deletions .github/workflows/gh-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Sync with upstream
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: "* 7 * * *"
workflow_dispatch:
inputs:
upstreamRepo:
description: "Upstream Repo - Where we should get the changes from. If not specified, it's 'kedacore/charts'"
default: "kedacore/charts"
required: false
type: string
downstreamRepo:
description: "Downstream Repo - To what repo we are syncying. If not specified, it's 'kedify/charts' (this repo)"
default: "kedify/charts"
required: false
type: string

env:
UPSTREAM_REPO: ${{ github.event.inputs.upstreamRepo || 'kedacore/charts' }}
DOWNSTREAM_REPO: ${{ github.event.inputs.downstreamRepo || 'kedify/charts' }}

jobs:
repo-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
- run: |
git config --global user.email "[email protected]"
git config --global user.name "Kedify Bot"
git remote add upstream https://github.com/${{ env.UPSTREAM_REPO }}.git
# delete the branch if it exists
git branch -D upstream-sync 2> /dev/null || echo "local branch 'upstream-sync' has been deleted"
git push origin :upstream-sync 2> /dev/null || echo "remote branch 'upstream-sync' has been deleted on '${{ env.DOWNSTREAM_REPO }}' repo"
# git checkout -b upstream-sync-workspace
git pull -s recursive --rebase -X ours upstream main
git merge -X ours main -m "merge"
- name: Open Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PAT_TOKEN }}
push-to-fork: ${{ env.DOWNSTREAM_REPO }}
commit-message: Syncing upstream helm charts
title: Syncing upstream helm charts
body: |
:package: Syncing upstream helm chart :package:
### :shipit: Release?
The sync mechanism doesn't deal with releases.
### :thinking: Rebase or merge?
Although merging is obviously better :trollface:, let's use rebasing for this sync.
This way we will see our custom tweaks nicely on the tip of the `main`.
### :hospital: Conflict?
This could have happened only if the PR was opened for a long time and meanwhile there
was a change to this repo. :adhesive_bandage: Just close this PR and wait for the next one.
#### :bulb: Tip
Ideally, this repo has only one commits with all the necessary tweaks in it (like this gh action for instance).
So that we can keep adding the changes to this commit by `g commit --ammend` and ideally the changes should be in
new files so that the risk of conflict with the upstream repo is minimal.
### :wrench: Important
Once this is merged, please don't forget to run this command if our 'All our tweaks should go here' commit is not on
top:
```
GIT_SEQUENCE_EDITOR=\"sed -i -n 'h;1n;2p;g;p'\" git rebase -i HEAD~2
```
To reorder last two commits.
This automated PR was created by [this action][1].
[1]: https://github.com/kedify/charts/actions/runs/${{ github.run_id }}
branch: upstream-sync
delete-branch: true
signoff: true

- name: Check PR
run: |
echo ":rocket:"
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | tee -a "${GITHUB_STEP_SUMMARY}"
5 changes: 5 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Teams:
* @kedify/all

# Individuals:

Loading

0 comments on commit 34673b3

Please sign in to comment.