Skip to content

Commit

Permalink
refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
JTaeuber committed Oct 22, 2024
1 parent 2dc1666 commit 63b65f8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 49 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 }}
appVersion: ${{ 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}'
2 changes: 1 addition & 1 deletion .github/workflows/create_dev_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
repository: caas-team/GoKubeDownscaler
event-type: create-dev-build
client-payload: '{"version": "${{ env.version }}-dev"}'
client-payload: '{"version": "${{ env.version }}-dev","appVersion": "dev", "setLatest": false}'
16 changes: 2 additions & 14 deletions .github/workflows/docker_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,9 @@ 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: Dev docker meta
id: dev-meta
if: github.event.action == 'create-dev-build'
uses: docker/metadata-action@v5
with:
images: |
mtr.devops.telekom.de/caas/go-kube-downscaler
ghcr.io/caas-team/gokubedownscaler
tags: dev

- name: Install Cosign
uses: sigstore/cosign-installer@main
with:
Expand Down Expand Up @@ -65,9 +55,7 @@ jobs:
context: .
platforms: linux/amd64
push: true
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.dev-meta.outputs.tags }}
tags: ${{ steps.meta.outputs.tags }}

- name: Sign Push
run: |
Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/helm_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,10 @@ jobs:
MTR: mtr.devops.telekom.de

- name: Helm Lint, Package, and Push
if: github.event.action == 'release-new-version'
run: |
cd deployments/chart
helm lint .
helm package .
helm push $(ls *.tgz | head -1) oci://ghcr.io/caas-team/charts
helm push $(ls *.tgz | head -1) oci://${MTR}/${REPO}/charts
env:
MTR: mtr.devops.telekom.de
REPO: caas

- name: Helm Lint, Package, and Push Dev Build
if: github.event.action == 'create-dev-build'
run: |
cd deployments/chart
helm lint .
helm package . --version ${{ github.event.client_payload.version }} --app-version dev
helm package . --version ${{ github.event.client_payload.version }} --app-version --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

0 comments on commit 63b65f8

Please sign in to comment.