Skip to content

Commit

Permalink
Fix/serviceaccount creation (#65)
Browse files Browse the repository at this point in the history
* fix: corrected serviceaccount creation

* chore: automatically push pre-commit changes

* chore: changed urls

* revert to 1.1.1

* feat: add dev build workflow

* refactored code

* fix: typo

* fix errors

* add option for latest tag to be empty

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
JTaeuber and github-actions authored Oct 22, 2024
1 parent 4fcf4ec commit f2e95b5
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 26 deletions.
File renamed without changes.
36 changes: 16 additions & 20 deletions .github/workflows/check_version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
outputs:
version_change: ${{ steps.check_for_version_change.outputs.version_change }}
app_version_change: ${{ steps.check_for_appVersion_change.outputs.app_version_change }}
version: ${{ steps.chart_version.outputs.version }}
app_version: ${{ steps.app_version.outputs.app_version }}

steps:
- name: Checkout code
Expand All @@ -32,6 +34,18 @@ jobs:
version_change=$(git diff main HEAD~1 -- deployments/chart/Chart.yaml | grep -qe "^[+-]version: " && echo "version changed" || echo "version didn't change")
echo "version_change=$version_change" >> $GITHUB_OUTPUT
- name: Extract Chart Version
id: chart_version
run: |
version=$(yq e '.version' ./deployments/chart/Chart.yaml)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Extract App Version
id: app_version
run: |
app_version=$(yq e '.appVersion' ./deployments/chart/Chart.yaml)
echo "app_version=$app_version" >> $GITHUB_OUTPUT
build_new_chart:
runs-on: ubuntu-latest
needs: check_versions
Expand All @@ -40,22 +54,13 @@ jobs:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract Chart Version
id: chart_version
run: |
version=$(yq e '.version' ./deployments/chart/Chart.yaml)
echo "version=$version" >> $GITHUB_ENV
- name: Dispatch Event to build new helm chart
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: caas-team/GoKubeDownscaler
event-type: build-new-chart
client-payload: '{"version": "${{ env.version }}"}'
client-payload: '{"version": "${{ needs.check_versions.outputs.version }}", "appVersion": "${{ needs.check_versions.outputs.app_version }}"}'

release_new_version:
runs-on: ubuntu-latest
Expand All @@ -65,19 +70,10 @@ jobs:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract App Version
id: app_version
run: |
app_version=$(yq e '.appVersion' ./deployments/chart/Chart.yaml)
echo "app_version=$app_version" >> $GITHUB_ENV
- name: Dispatch Event to create new release
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: caas-team/GoKubeDownscaler
event-type: release-new-version
client-payload: '{"appVersion": "${{ env.app_version }}"}'
client-payload: '{"appVersion": "${{ needs.check_versions.outputs.app_version }}", "setLatest": true}'
28 changes: 28 additions & 0 deletions .github/workflows/create_dev_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Create dev build

on:
workflow_dispatch:

jobs:
create_dev_build:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract Chart Version
id: chart_version
run: |
version=$(yq e '.version' ./test-chart/Chart.yaml)
echo "version=$version" >> $GITHUB_ENV
- name: Dispatch event to create dev build
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: caas-team/GoKubeDownscaler
event-type: create-dev-build
client-payload: '{"version": "${{ env.version }}-dev","appVersion": "dev", "setLatest": false}'
4 changes: 2 additions & 2 deletions .github/workflows/docker_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and push Image

on:
repository_dispatch:
types: [release-new-version]
types: [release-new-version, create-dev-build]

jobs:
build:
Expand All @@ -19,7 +19,7 @@ jobs:
mtr.devops.telekom.de/caas/go-kube-downscaler
ghcr.io/caas-team/gokubedownscaler
tags: |
latest
${{ github.event.client_payload.setLatest && 'latest' || '' }}
${{ github.event.client_payload.appVersion }}
- name: Install Cosign
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/helm_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and push helm chart

on:
repository_dispatch:
types: [build-new-chart]
types: [build-new-chart, create-dev-build]

jobs:
build_and_push:
Expand All @@ -29,7 +29,7 @@ jobs:
run: |
cd deployments/chart
helm lint .
helm package .
helm package . --version ${{ github.event.client_payload.version }} --app-version ${{ github.event.client_payload.appVersion }}
helm push $(ls *.tgz | head -1) oci://ghcr.io/caas-team/charts
helm push $(ls *.tgz | head -1) oci://${MTR}/${REPO}/charts
env:
Expand Down
4 changes: 2 additions & 2 deletions deployments/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sources:
maintainers:
- name: jonathan-mayer
email: [email protected]
url: https://www.telekom.com
url: https://github.com/jonathan-mayer
- name: JTaeuber
email: [email protected]
url: https://www.telekom.com
url: https://github.com/JTaeuber
2 changes: 2 additions & 0 deletions deployments/chart/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "go-kube-downscaler.serviceAccountName" . }}
{{- end }}

0 comments on commit f2e95b5

Please sign in to comment.