Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 54 additions & 2 deletions .github/workflows/release-pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,66 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Extract and Store Trimmed Repository Name
run: |
REPO_CHART_NAME="${{ github.repository }}"
REPO_APP_NAME=$(echo "$REPO_CHART_NAME" | sed 's/-chart$//') # Remove "-chart" suffix if present

# Check if the trimmed repo exists
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$REPO_APP_NAME")

if [[ "$HTTP_STATUS" -eq 200 ]]; then
echo "Using trimmed repository name: $REPO_APP_NAME"
echo "REPO_APP_NAME=$REPO_APP_NAME" >> $GITHUB_ENV
else
echo "Trimmed repository not found. Falling back to original repository name."
echo "REPO_APP_NAME=$REPO_CHART_NAME" >> $GITHUB_ENV
fi

- name: Use the Stored Variable
run: |
echo "Trimmed Repository Name: ${{ env.REPO_APP_NAME }}"

- name: Authenticate with GitHub App
id: authenticate
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Extract latest App Version
uses: tdemin/find-latest-tag@v1
id: app_version
with:
repo: https://${{ steps.authenticate.outputs.token }}@github.com/${{ env.REPO_APP_NAME }}.git

- name: Extract latest Chart Version
uses: tdemin/find-latest-tag@v1
id: chart_version
with:
repo: https://${{ steps.authenticate.outputs.token }}@github.com/${{ github.repository }}.git

- name: Checkout
uses: actions/checkout@v3

- name: Print Version
run: |
echo APP_VERSION:${{steps.app_version.outputs.tag}}
echo CHART_VERSION:${{steps.chart_version.outputs.tag}}

- name: Replace Version in Chart.yaml
run: sed -i 's/CHART_VERSION/0.0.1/g' ./chart/Chart.yaml
run: sed -i 's/CHART_VERSION/${{ steps.chart_version.outputs.tag }}/g' ./chart/Chart.yaml

- name: Print latest App Version
run: echo ${{ steps.app_version.outputs.tag }}

- name: Replace App Version in Chart.yaml
run: sed -i 's/APP_VERSION/${{ steps.app_version.outputs.tag }}/g' ./chart/Chart.yaml

- name: Set up Helm
uses: azure/setup-helm@v4.1.0

- name: Helm lint
run: helm lint ./chart
run: helm lint ./chart
61 changes: 52 additions & 9 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,70 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Extract and Store Trimmed Repository Name
run: |
REPO_CHART_NAME="${{ github.repository }}"
REPO_APP_NAME=$(echo "$REPO_CHART_NAME" | sed 's/-chart$//') # Remove "-chart" suffix if present

# Check if the trimmed repo exists
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$REPO_APP_NAME")

if [[ "$HTTP_STATUS" -eq 200 ]]; then
echo "Using trimmed repository name: $REPO_APP_NAME"
echo "REPO_APP_NAME=$REPO_APP_NAME" >> $GITHUB_ENV
else
echo "Trimmed repository not found. Falling back to original repository name."
echo "REPO_APP_NAME=$REPO_CHART_NAME" >> $GITHUB_ENV
fi

- name: Use the Stored Variable
run: |
echo "Trimmed Repository Name: ${{ env.REPO_APP_NAME }}"

- name: Authenticate with GitHub App
id: authenticate
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Extract latest App Version
uses: tdemin/find-latest-tag@v1
id: app_version
with:
repo: https://${{ steps.authenticate.outputs.token }}@github.com/${{ env.REPO_APP_NAME }}.git

- name: Extract latest Chart Version
uses: tdemin/find-latest-tag@v1
id: chart_version
with:
repo: https://${{ steps.authenticate.outputs.token }}@github.com/${{ github.repository }}.git

- name: Checkout
uses: actions/checkout@v3

- name: Extract Version
id: tagger
uses: battila7/get-version-action@v2

- name: Print Version
run: |
echo ${{steps.tagger.outputs.version}}
echo ${{steps.tagger.outputs.version-without-v}}
echo APP_VERSION:${{steps.app_version.outputs.tag}}
echo CHART_VERSION:${{steps.chart_version.outputs.tag}}

- name: Replace Version in Chart.yaml
run: sed -i 's/CHART_VERSION/${{ steps.tagger.outputs.version-without-v }}/g' ./chart/Chart.yaml
run: sed -i 's/CHART_VERSION/${{ steps.chart_version.outputs.tag }}/g' ./chart/Chart.yaml

- name: Print latest App Version
run: echo ${{ steps.app_version.outputs.tag }}

- name: Replace App Version in Chart.yaml
run: sed -i 's/APP_VERSION/${{ steps.app_version.outputs.tag }}/g' ./chart/Chart.yaml

- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.HELM_CHARTS_BOT }}
token: ${{ steps.authenticate.outputs.token }}
charts_dir: ./
charts_url: https://charts.krateo.io
owner: krateoplatformops
repository: helm-charts
branch: gh-pages
branch: gh-pages
15 changes: 9 additions & 6 deletions chart/templates/widgets.composition-card.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
namespace: {{ .Release.Namespace }}
data:
panel: "false"
route: /compositions/{{ .Release.Namespace }}/{{ .Release.Name }}
---
apiVersion: templates.krateo.io/v1alpha1
kind: Widget
Expand All @@ -32,16 +33,18 @@ spec:
verb: DELETE
app:
template:
tags: {{ .Release.Namespace }}
tags: {{ .Release.Namespace }},{{.Chart.Version}}
title: {{ .Release.Name }}
content: This is a card for {{ .Release.Name }} composition
{{- if and .Values.card .Values.card.icon }}
icon: {{ .Values.card.icon }}
{{- else }}
icon: fa-circle-question
{{- end }}
{{- if and .Values.card .Values.card.color }}
color: {{ .Values.card.color }}
{{- else }}
color: grey
{{- end }}
color: ${ .getComposition.status.conditions[] | select(.type == "Ready") | if .status == "False" then "orange" elif .status == "True" then "green" else "grey" end }
status: ${ .getComposition.status.conditions[] | select(.type == "Ready") | "Ready:" + .status }
date: ${ .getComposition.metadata.creationTimestamp }
api:
- name: getComposition
path: "/apis/{{ .Values.global.compositionApiVersion }}/namespaces/{{ .Release.Namespace }}/{{ .Values.global.compositionResource }}/{{ .Release.Name }}"
verb: GET
18 changes: 18 additions & 0 deletions chart/templates/widgets.composition-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: templates.krateo.io/v1alpha1
kind: Widget
metadata:
name: composition-{{ .Release.Name }}-route
namespace: {{ .Release.Namespace }}
spec:
actions:
- template:
apiVersion: templates.krateo.io/v1alpha1
name: composition-{{ .Release.Name }}-tablist
namespace: {{ .Release.Namespace }}
resource: collections
verb: GET
app:
template:
menu: "false"
path: /compositions/{{ .Release.Namespace }}/{{ .Release.Name }}
type: route
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ spec:
type: paragraph
app:
template:
yaml: {{ .getCompositionYaml }}
json: ${ .getCompositionJSON }
api:
- name: getCompositionYaml
- name: getCompositionJSON
path: "/apis/{{ .Values.global.compositionApiVersion }}/namespaces/{{ .Release.Namespace }}/{{ .Values.global.compositionResource }}/{{ .Release.Name }}"
verb: GET
headers:
- 'Accept: application/yaml'
{{- end }}
2 changes: 1 addition & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terminal:
events:
enabled: true
yamlviewer:
enabled: false
enabled: true
namespace: krateo-system
global:
compositionId: compositionId
Expand Down