Skip to content

Commit

Permalink
Merge pull request #192 from Leukocyte-Lab/feat/add-playground-chart
Browse files Browse the repository at this point in the history
feat/add playground chart
  • Loading branch information
knowlet authored Jul 26, 2024
2 parents 56844b2 + c68a60d commit 1252fa8
Show file tree
Hide file tree
Showing 14 changed files with 726 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/agh3-playground-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ⚙️ [AGH3-Playground] Auto Publish Chart

on:
push:
branches:
- main
paths:
- charts/playground/**

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: 🔔 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ⚙️ Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: 📦 Install Helm
uses: azure/setup-helm@v4
with:
version: v3.14.4

- name: 📦 Add Helm dependency repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: 🎁 Release Chart
uses: helm/chart-releaser-action@v1
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
93 changes: 93 additions & 0 deletions .github/workflows/agh3-playground-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: 🔧 [AGH3-Playground] Fetch & Create Chart for Release

on:
workflow_dispatch:
inputs:
chart_version_increment:
description: "Chart Version Increment (Semver)"
required: true
default: "patch"
type: choice
options:
- "minor"
- "patch"
app_version_increment:
description: "App Version Increment (Semver or Use Existing)"
required: true
default: "patch"
type: choice
options:
- "minor"
- "patch"
- "use-existing"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: 🏷️ Get latest Playground tags from Release
uses: oprypin/find-latest-tag@v1
id: ui
with:
repository: Leukocyte-Lab/AGH3-CTR-Playground
releases-only: true
token: ${{ secrets.GH_TOKEN }}
regex: '^v\d+\.\d+\.\d+$'

- name: 🔔 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🖍️ Update version tags for Apps
uses: mikefarah/[email protected]
with:
cmd: |
cp charts/playground/values.yaml charts/playground/values.yaml.tmp
cat charts/playground/values.yaml.tmp | \
yq '.playground.image.tag = "${{ steps.ui.outputs.tag }}"' | \
yq '.' > charts/playground/values.yaml
rm charts/playground/values.yaml.tmp
- name: 📦 Install Tools for parsing semver
run: |
sudo apt update
sudo apt install gettext-base
sudo wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
sudo chmod +x /usr/local/bin/semver
semver --version
- name: 🔎 Get Chart versions
run: |
export APP_VERSION="$(yq '.appVersion' charts/playground/Chart.yaml | ${{ inputs.app_version_increment == 'use-existing' && 'sed "s/^v//g"' || format('xargs semver bump {0}', inputs.app_version_increment) }})"
export CHART_VERSION="$(yq '.version' charts/playground/Chart.yaml | xargs semver bump ${{ inputs.chart_version_increment }})"
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV"
echo "CHART_VERSION=$CHART_VERSION" >> "$GITHUB_ENV"
- name: 🖍️ Update Chart versions
uses: mikefarah/[email protected]
with:
cmd: |
cp charts/playground/Chart.yaml charts/playground/Chart.yaml.tmp
cat charts/playground/Chart.yaml.tmp | \
yq '.version = "${{ env.CHART_VERSION }}"' | \
yq '.appVersion = "v${{ env.APP_VERSION }}"' | \
yq '.' > charts/playground/Chart.yaml
rm charts/playground/Chart.yaml.tmp
- name: 🙌 Create PR
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GH_TOKEN }}
branch: build/release-chart-agh3-playground-${{ env.CHART_VERSION }}
commit-message: |
build: Release chart/agh3-playground ${{ env.CHART_VERSION }}
- Chart Version: `${{ env.CHART_VERSION }}`
- App Version: `${{ env.APP_VERSION }}`
- Playground: `${{ steps.ui.outputs.tag }}`
title: "build: Release chart/agh3-playground `v${{ env.CHART_VERSION }}`"
body: |
- Chart Version: `${{ env.CHART_VERSION }}`
- App Version: `${{ env.APP_VERSION }}`
- Playground: `${{ steps.ui.outputs.tag }}`
65 changes: 65 additions & 0 deletions .github/workflows/agh3-playground-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: ⚙️ [AGH3-Playground] 🧪 Test

on:
pull_request:
branches:
- main
paths:
- charts/playground/**

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: 🔔 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ⚙️ Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: 🪝 Install Helm
uses: azure/setup-helm@v4
with:
version: v3.14.4

- name: 📦 Add Helm dependency repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: 🧪 Run chart-linting
run: |
helm dependency build charts/playground
helm lint charts/playground
- name: 🧪 Run chart-testing -> internal mode (default)
run: |
helm dependency build charts/playground
helm template agh charts/playground \
--set customRegistrySecret.auth.username='robot$ci-test-lkc-lab+foo' \
--set customRegistrySecret.auth.password='ci-test-9e1e8ee7-edba-49d9-9cae-2dabf522d4d1' \
-n agh3-playground
- name: 🧪 Run chart-testing -> internal mode with custom namespace
run: |
helm dependency build charts/playground
helm template agh charts/playground \
--set customRegistrySecret.auth.username='robot$ci-test-lkc-lab+foo' \
--set customRegistrySecret.auth.password='ci-test-9e1e8ee7-edba-49d9-9cae-2dabf522d4d1' \
--set playground.service.backendRef.namespace='agh3-prod' \
--set playground.service.backendRef.kind='Service' \
-n agh3-playground
- name: 🧪 Run chart-testing -> external mode
run: |
helm dependency build charts/playground
helm template agh charts/playground \
--set customRegistrySecret.auth.username='robot$ci-test-lkc-lab+foo' \
--set customRegistrySecret.auth.password='ci-test-9e1e8ee7-edba-49d9-9cae-2dabf522d4d1' \
--set playground.service.backendRef.kind='ExternalService' \
--set playground.service.backendRef.endpoint='example.com/api/v1' \
-n agh3-playground
6 changes: 6 additions & 0 deletions charts/playground/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
version: 2.19.1
digest: sha256:4f539b1fbde383dd5bc020d77d70655108ed4c188b7329c1639df3f1e65de2e0
generated: "2024-07-26T15:57:16.16244+08:00"
28 changes: 28 additions & 0 deletions charts/playground/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v2
name: agh3-playground
description: A Helm chart for ArgusHack3 Playground

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.0.1-beta.10"
dependencies:
- name: common
version: 2.19.1
repository: https://charts.bitnami.com/bitnami
Loading

0 comments on commit 1252fa8

Please sign in to comment.