Skip to content

move wg-easy application away from replicated-library #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.tgz

# Ignore IDE and editor folders
.cursorindexingignore
.idea/
.vscode/
*.swp
Expand Down Expand Up @@ -52,3 +53,5 @@ applications/wg-easy/release/
.aider*
# SpecStory explanation file
.specstory/.what-is-this.md

**/.claude/settings.local.json
53 changes: 26 additions & 27 deletions applications/wg-easy/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ includes:

vars:
# Application configuration
APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}'
APP_SLUG: '{{.REPLICATED_APP_SLUG | default "wg-easy-cre"}}'
APP_SLUG: '{{.REPLICATED_APP | default "wg-easy-cre"}}'

# Release configuration
RELEASE_CHANNELd: '{{.RELEASE_CHANNEL | default "Unstable"}}'
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}'
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'

Expand Down Expand Up @@ -234,23 +233,22 @@ tasks:
- find ./replicated -name '*.yaml' -not -name 'config.yaml' -exec cp {} ./release/ \; 2>/dev/null || true

# extract namespaces from helmChart files
- yq ea '[.spec.namespace] | unique' */replicated/helmChart-*.yaml | yq '.spec.additionalNamespaces *= load("/dev/stdin") | .spec.additionalNamespaces += "*" ' replicated/application.yaml > release/application.yaml.new
- echo "Extracting namespaces from helmChart files..."
- yq ea '[.spec.namespace] | unique' ./charts/*/replicated/helmChart-*.yaml | yq '.spec.additionalNamespaces *= load("/dev/stdin") | .spec.additionalNamespaces += "*" ' replicated/application.yaml > release/application.yaml.new
- cat release/application.yaml.new
- mv release/application.yaml.new release/application.yaml

# set helmChart versions from associated helm Chart.yaml
- echo "Setting helmChart versions..."
- |
while read directory; do

echo $directory
parent=$(basename $(dirname $directory))

# Find all replicated directories and update helmChart files in one loop
find ./charts -maxdepth 2 -mindepth 2 -type d -name replicated | while read chartDir; do
echo $chartDir
parent=$(basename $(dirname $chartDir))
helmChartName="helmChart-$parent.yaml"
export version=$(yq -r '.version' $parent/Chart.yaml )

yq '.spec.chart.chartVersion = strenv(version) | .spec.chart.chartVersion style="single"' $directory/$helmChartName | tee release/$helmChartName

done < <(find . -maxdepth 2 -mindepth 2 -type d -name replicated)
export version=$(yq -r '.version' $chartDir/../Chart.yaml )
yq '.spec.chart.chartVersion = strenv(version) | .spec.chart.chartVersion style="single"' $chartDir/$helmChartName | tee release/$helmChartName
done

# Merge config.yaml files
- echo "Merging config.yaml files..."
Expand All @@ -275,8 +273,8 @@ tasks:
# Package Helm charts
- echo "Packaging Helm charts..."
- |
# Find top-level directories containing Chart.yaml files
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
# Find top-level directories containing Chart.yaml files, excluding the templates chart
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | grep -v "charts/templates" | xargs dirname); do
echo "Packaging chart: $chart_dir"
# Navigate to chart directory, package it, and move the resulting .tgz to release folder
(cd "$chart_dir" && helm package . && mv *.tgz ../../release/)
Expand All @@ -291,18 +289,18 @@ tasks:
silent: false
run: once
vars:
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
VERSION: '{{.VERSION | default "0.0.1"}}'
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}'
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
requires:
vars: [APP_SLUG, VERSION]
vars: [APP_SLUG, RELEASE_CHANNEL, RELEASE_VERSION]
cmds:
- echo "Creating and promoting release for {{.APP_SLUG}} to channel {{.CHANNEL}}..."
- echo "Creating and promoting release for {{.APP_SLUG}} to channel {{.RELEASE_CHANNEL}}..."
- |
# Create and promote the release in one step
echo "Creating release from files in ./release directory..."
replicated release create --app {{.APP_SLUG}} --yaml-dir ./release --release-notes "{{.RELEASE_NOTES}}" --promote {{.CHANNEL}} --version {{.VERSION}}
echo "Release version {{.VERSION}} created and promoted to channel {{.CHANNEL}}"
replicated release create --app {{.APP_SLUG}} --yaml-dir ./release --release-notes "{{.RELEASE_NOTES}}" --promote {{.RELEASE_CHANNEL}} --version {{.RELEASE_VERSION}}
echo "Release version {{.RELEASE_VERSION}} created and promoted to channel {{.RELEASE_CHANNEL}}"
deps:
- release-prepare

Expand All @@ -313,7 +311,7 @@ tasks:
vars:
CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}'
CUSTOMER_EMAIL: '{{.CUSTOMER_EMAIL | default "[email protected]"}}'
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
LICENSE_TYPE: '{{.LICENSE_TYPE | default "dev"}}'
EXPIRES_IN: '{{.EXPIRES_IN | default ""}}'
requires:
Expand All @@ -338,7 +336,7 @@ tasks:
--app {{.APP_SLUG}} \
--name {{.CUSTOMER_NAME}} \
--email {{.CUSTOMER_EMAIL}} \
--channel {{.CHANNEL}} \
--channel {{.RELEASE_CHANNEL}} \
--type {{.LICENSE_TYPE}} \
--output json"

Expand Down Expand Up @@ -391,7 +389,7 @@ tasks:
desc: Setup Replicated embedded cluster on the GCP VM
silent: false
vars:
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
AUTH_TOKEN: '{{.AUTH_TOKEN | default "2usDXzovcJNcpn54yS5tFQVNvCq"}}'
deps:
- gcp-vm-create
Expand All @@ -404,7 +402,7 @@ tasks:
vars:
OPERATION: "setup-embedded"
APP_SLUG: '{{.APP_SLUG}}'
CHANNEL: '{{.CHANNEL}}'
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL}}'
AUTH_TOKEN: '{{.AUTH_TOKEN}}'
GCP_PROJECT: '{{.GCP_PROJECT}}'
GCP_ZONE: '{{.GCP_ZONE}}'
Expand Down Expand Up @@ -476,7 +474,7 @@ tasks:
- echo "Cleaning complete!"

full-test-cycle:
desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete
desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete, and clean up build artifacts
silent: false
cmds:
- task: cluster-create
Expand All @@ -486,3 +484,4 @@ tasks:
- task: helm-install
- task: test
- task: cluster-delete
- task: clean
10 changes: 5 additions & 5 deletions applications/wg-easy/charts/wg-easy/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: templates
repository: file://../templates
version: 1.0.0
digest: sha256:9939fc386e44c7a8d0a274f270ec92ac70ac9858442b4f85638122044082da74
generated: "2025-05-06T15:20:40.596254-04:00"
- name: common
repository: https://bjw-s-labs.github.io/helm-charts
version: 3.7.3
digest: sha256:8d4fda6f1e6a4b35c83a8a65274352a9ade5a96ed80cfa68d072ab3f89d18d59
generated: "2025-05-06T17:08:23.761384-04:00"
19 changes: 14 additions & 5 deletions applications/wg-easy/charts/wg-easy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
name: wg-easy
version: 1.0.0
apiVersion: v2
dependencies:
- name: templates
version: '*'
repository: file://../templates
- name: common
repository: https://bjw-s-labs.github.io/helm-charts
version: 3.7.3
- name: templates
version: '*'
repository: file://../templates
description: Simple wireguard with web configuration management
home: https://github.com/chris-sanders/helm-charts/charts/wg-easy
maintainers:
- email: [email protected]
name: Chris Sanders
url: https://github.com/chris-sanders/helm-charts
name: wg-easy
version: 1.0.0
6 changes: 0 additions & 6 deletions applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.lock

This file was deleted.

13 changes: 0 additions & 13 deletions applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.yaml

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading