Skip to content

Commit 8481e4b

Browse files
authored
Merge pull request #58 from replicatedhq/adamancini/release-create
release to Replicated Vendor Portal
2 parents 694b71a + 3186577 commit 8481e4b

File tree

97 files changed

+4183
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+4183
-51
lines changed

.gitignore

-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
**/charts/*.tgz
33
**/.specstory/
44

5-
6-
# Ignore Helm dependency directories
7-
**/charts/*.lock
8-
95
# General files to ignore
106
*.log
117
*.gz
@@ -53,8 +49,6 @@ applications/mlflow/tests/.venv/
5349
# wg-easy specific
5450
*.kubeconfig
5551
applications/wg-easy/release/
56-
applications/wg-easy/*/charts/
57-
applications/wg-easy/*/Chart.lock
5852
.aider*
5953
# SpecStory explanation file
6054
.specstory/.what-is-this.md

applications/wg-easy/README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ Use tools to automate repetitive tasks, reducing human error and increasing deve
5555

5656
```
5757
applications/wg-easy/
58-
├── charts/templates/ # Common templates shared across charts
59-
├── cert-manager/ # Wrapped cert-manager chart
60-
├── cert-manager-issuers/ # Chart for cert-manager issuers
58+
├── charts
59+
│   ├── cert-manager # Wrapped cert-manager chart
60+
│   ├── cert-manager-issuers # Chart for cert-manager issuers
61+
│   ├── replicated-sdk # Replicated SDK chart
62+
│   ├── templates # Common templates shared across charts
63+
│   ├── traefik # Wrapped Traefik chart
64+
│   └── wg-easy # Main application chart
6165
├── replicated/ # Root Replicated configuration
62-
├── replicated-sdk/ # Replicated SDK chart
6366
├── taskfiles/ # Task utility functions
64-
├── traefik/ # Wrapped Traefik chart
65-
├── wg-easy/ # Main application chart
6667
├── helmfile.yaml # Defines chart installation order
6768
└── Taskfile.yaml # Main task definitions
6869
```

applications/wg-easy/Taskfile.yaml

+133-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ includes:
66

77
vars:
88
# Application configuration
9-
APP_SLUG: '{{.REPLICATED_APP | default "wg-easy"}}'
9+
APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}'
10+
APP_SLUG: '{{.REPLICATED_APP_SLUG | default "wg-easy-cre"}}'
11+
12+
# Release configuration
13+
RELEASE_CHANNELd: '{{.RELEASE_CHANNEL | default "Unstable"}}'
14+
RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}'
15+
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
1016

1117
# Cluster configuration
1218
CLUSTER_NAME: '{{.CLUSTER_NAME | default "test-cluster"}}'
@@ -131,14 +137,14 @@ tasks:
131137
- echo "Updating Helm dependencies for all charts..."
132138
- |
133139
# Find all charts and update their dependencies
134-
for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
140+
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
135141
echo "Updating dependency $chart_dir"
136-
helm dependency update "$chart_dir"
142+
helm dependency update --skip-refresh "$chart_dir"
137143
done
138144
- echo "All dependencies updated!"
139145

140-
ports-expose:
141-
desc: Expose configured ports and capture exposed URLs
146+
cluster-ports-expose:
147+
desc: Expose configured ports for a cluster and capture exposed URLs
142148
silent: false
143149
run: once
144150
status:
@@ -166,8 +172,8 @@ tasks:
166172
deps:
167173
- cluster-create
168174

169-
helm-deploy:
170-
desc: Deploy all charts using helmfile
175+
helm-install:
176+
desc: Install all charts using helmfile
171177
silent: false
172178
cmds:
173179
- echo "Installing all charts via helmfile"
@@ -185,10 +191,10 @@ tasks:
185191
# Deploy with helmfile
186192
echo "Using $ENV_VARS"
187193
eval "KUBECONFIG={{.KUBECONFIG_FILE}} $ENV_VARS helmfile sync --wait"
188-
- echo "All charts deployed!"
194+
- echo "All charts installed!"
189195
deps:
190196
- setup-kubeconfig
191-
- ports-expose
197+
- cluster-ports-expose
192198

193199
cluster-delete:
194200
desc: Delete all test clusters with matching name and clean up kubeconfig
@@ -270,10 +276,10 @@ tasks:
270276
- echo "Packaging Helm charts..."
271277
- |
272278
# Find top-level directories containing Chart.yaml files
273-
for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
279+
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
274280
echo "Packaging chart: $chart_dir"
275281
# Navigate to chart directory, package it, and move the resulting .tgz to release folder
276-
(cd "$chart_dir" && helm package . && mv *.tgz ../release/)
282+
(cd "$chart_dir" && helm package . && mv *.tgz ../../release/)
277283
done
278284
279285
- echo "Release files prepared in ./release/ directory"
@@ -283,8 +289,10 @@ tasks:
283289
release-create:
284290
desc: Create and promote a release using the Replicated CLI
285291
silent: false
292+
run: once
286293
vars:
287294
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
295+
VERSION: '{{.VERSION | default "0.0.1"}}'
288296
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
289297
requires:
290298
vars: [APP_SLUG, VERSION]
@@ -298,6 +306,53 @@ tasks:
298306
deps:
299307
- release-prepare
300308

309+
customer-create:
310+
desc: Create a new customer or get existing customer with matching name and return their ID
311+
silent: false
312+
run: once
313+
vars:
314+
CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}'
315+
CUSTOMER_EMAIL: '{{.CUSTOMER_EMAIL | default "test@example.com"}}'
316+
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
317+
LICENSE_TYPE: '{{.LICENSE_TYPE | default "dev"}}'
318+
EXPIRES_IN: '{{.EXPIRES_IN | default ""}}'
319+
requires:
320+
vars: [APP_SLUG]
321+
cmds:
322+
- |
323+
# First check if customer already exists
324+
echo "Looking for existing customer {{.CUSTOMER_NAME}} for app {{.APP_SLUG}}..."
325+
EXISTING_CUSTOMER=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.CUSTOMER_NAME}}") | .id' | head -1)
326+
327+
if [ -n "$EXISTING_CUSTOMER" ]; then
328+
echo "Found existing customer {{.CUSTOMER_NAME}} with ID: $EXISTING_CUSTOMER"
329+
echo "$EXISTING_CUSTOMER"
330+
exit 0
331+
fi
332+
333+
# No existing customer found, create a new one
334+
echo "Creating new customer {{.CUSTOMER_NAME}} for app {{.APP_SLUG}}..."
335+
336+
# Build the command with optional expiration
337+
CMD="replicated customer create \
338+
--app {{.APP_SLUG}} \
339+
--name {{.CUSTOMER_NAME}} \
340+
--email {{.CUSTOMER_EMAIL}} \
341+
--channel {{.CHANNEL}} \
342+
--type {{.LICENSE_TYPE}} \
343+
--output json"
344+
345+
# Add expiration if specified
346+
if [ -n "{{.EXPIRES_IN}}" ]; then
347+
CMD="$CMD --expires-in {{.EXPIRES_IN}}"
348+
fi
349+
350+
# Create the customer and capture the output
351+
CUSTOMER_JSON=$($CMD)
352+
353+
# Extract and output just the customer ID
354+
echo "$CUSTOMER_JSON" | jq -r '.id'
355+
301356
gcp-vm-create:
302357
desc: Create a simple GCP VM instance
303358
silent: false
@@ -355,14 +410,79 @@ tasks:
355410
GCP_ZONE: '{{.GCP_ZONE}}'
356411
VM_NAME: '{{.VM_NAME}}'
357412

413+
customer-ls:
414+
desc: List customers for the application
415+
silent: false
416+
vars:
417+
OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}'
418+
requires:
419+
vars: [APP_SLUG]
420+
cmds:
421+
- echo "Listing customers for app {{.APP_SLUG}}..."
422+
- replicated customer ls --app {{.APP_SLUG}} --output {{.OUTPUT_FORMAT}}
423+
424+
customer-delete:
425+
desc: Archive a customer by ID
426+
silent: false
427+
vars:
428+
CUSTOMER_ID: '{{.CUSTOMER_ID}}'
429+
requires:
430+
vars: [APP_SLUG, CUSTOMER_ID]
431+
cmds:
432+
- echo "Archiving customer with ID {{.CUSTOMER_ID}} from app {{.APP_SLUG}}..."
433+
- |
434+
# Verify customer exists before attempting to archive
435+
CUSTOMER_EXISTS=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .id')
436+
if [ -z "$CUSTOMER_EXISTS" ]; then
437+
echo "Error: Customer with ID {{.CUSTOMER_ID}} not found for app {{.APP_SLUG}}"
438+
exit 1
439+
fi
440+
441+
# Get customer name for confirmation message
442+
CUSTOMER_NAME=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .name')
443+
444+
# Archive the customer
445+
replicated customer archive {{.CUSTOMER_ID}} --app {{.APP_SLUG}}
446+
447+
# Confirm archiving
448+
echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived"
449+
450+
clean:
451+
desc: Remove temporary Helm directories, chart dependencies, and release folder
452+
silent: false
453+
cmds:
454+
- echo "Cleaning temporary directories and dependencies..."
455+
- |
456+
# Remove the release directory
457+
if [ -d "./release" ]; then
458+
echo "Removing release directory..."
459+
rm -rf ./release
460+
fi
461+
462+
# Find and remove tmpcharts-* directories in charts/
463+
echo "Removing temporary chart directories..."
464+
find charts/ -type d -name "tmpcharts-*" -print
465+
find charts/ -type d -name "tmpcharts-*" -exec rm -rf {} \; 2>/dev/null || true
466+
467+
# Clean up chart dependencies (.tgz files) in charts/*/charts/
468+
echo "Removing chart dependencies..."
469+
find charts/ -path "*/charts/*.tgz" -type f -print
470+
find charts/ -path "*/charts/*.tgz" -type f -delete
471+
472+
# Clean up any tmpcharts directories in subdirectories
473+
echo "Cleaning up any remaining tmpcharts directories..."
474+
find . -type d -name "tmpcharts-*" -print
475+
find . -type d -name "tmpcharts-*" -exec rm -rf {} \; 2>/dev/null || true
476+
- echo "Cleaning complete!"
477+
358478
full-test-cycle:
359479
desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete
360480
silent: false
361481
cmds:
362482
- task: cluster-create
363483
- task: setup-kubeconfig
364-
- task: ports-expose
484+
- task: cluster-ports-expose
365485
- task: dependencies-update
366-
- task: helm-deploy
486+
- task: helm-install
367487
- task: test
368488
- task: cluster-delete
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
- name: cert-manager
3+
repository: https://charts.jetstack.io
4+
version: v1.14.5
5+
- name: templates
6+
repository: file://../templates
7+
version: 1.0.0
8+
digest: sha256:ab86a335f7f473446968c607ed7920bf4ce29f625e5ff6175be17bb2e1101a32
9+
generated: "2025-05-06T15:35:47.871225-04:00"

applications/wg-easy/cert-manager/Chart.yaml renamed to applications/wg-easy/charts/cert-manager/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ dependencies:
77
repository: https://charts.jetstack.io
88
- name: templates
99
version: '*'
10-
repository: file://../charts/templates
10+
repository: file://../templates
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
- name: templates
3+
repository: file://../templates
4+
version: 1.0.0
5+
- name: replicated
6+
repository: oci://registry.replicated.com/library
7+
version: 1.1.1
8+
digest: sha256:bb2c4743fae54061dfde5812086300bf9ed7c86f9f4d80ccb0858df407d21a2a
9+
generated: "2025-05-06T15:35:43.881588-04:00"

applications/wg-easy/replicated-sdk/Chart.yaml renamed to applications/wg-easy/charts/replicated-sdk/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: v2
44
dependencies:
55
- name: templates
66
version: '*'
7-
repository: file://../charts/templates
7+
repository: file://../templates
88
- name: replicated
99
repository: oci://registry.replicated.com/library
1010
version: 1.1.1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
- name: traefik
3+
repository: https://traefik.github.io/charts
4+
version: 28.0.0
5+
- name: templates
6+
repository: file://../templates
7+
version: 1.0.0
8+
digest: sha256:14c6de6f10918ec6bbe2d6e99408da62b362fc7950ce8793ebaaa4693ffdeb75
9+
generated: "2025-05-06T15:35:53.545992-04:00"

applications/wg-easy/traefik/Chart.yaml renamed to applications/wg-easy/charts/traefik/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ dependencies:
88
repository: https://traefik.github.io/charts
99
- name: templates
1010
version: '*'
11-
repository: file://../charts/templates
11+
repository: file://../templates
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: templates
3+
repository: file://../templates
4+
version: 1.0.0
5+
digest: sha256:9939fc386e44c7a8d0a274f270ec92ac70ac9858442b4f85638122044082da74
6+
generated: "2025-05-06T15:20:40.596254-04:00"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: wg-easy
2+
version: 1.0.0
3+
apiVersion: v2
4+
dependencies:
5+
- name: templates
6+
version: '*'
7+
repository: file://../templates
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
24+
manifests/
25+
doc/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: replicated-library
3+
repository: https://replicatedhq.github.io/helm-charts
4+
version: 0.13.10
5+
digest: sha256:cb41956b9ecae9581fa42eeb58487c8251a6e6d4ead534c28b577931e566e37e
6+
generated: "2023-12-27T16:31:00.156396361-06:00"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v2
2+
dependencies:
3+
- name: replicated-library
4+
repository: https://replicatedhq.github.io/helm-charts
5+
version: ^0.13.2
6+
description: Simple wireguard with web configuration management
7+
home: https://github.com/chris-sanders/helm-charts/charts/wg-easy
8+
maintainers:
9+
- email: sanders.chris@gmail.com
10+
name: Chris Sanders
11+
url: https://github.com/chris-sanders/helm-charts
12+
name: wg-easy
13+
version: 1.0.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# wg-easy
2+
3+
## Helm chart
4+
5+
This is a helm chart for deploying [wg-easy](https://github.com/wg-easy/wg-easy) which describes itself as "You have found the easiest way to install & manage WireGuard on any Linux host!". This chart is not affiliated with the upstream project and bugs for this chart should not be filed against the upstream project.
6+
7+
## Installing the Chart
8+
9+
This chart exposes all of the wg-easy environment variables for configuration under the key `wireguard`. You can see the value available in the values.yaml file with this chart. Detailed instructions have not been written although the upstream project documents each of the environment variables.
10+
11+
## Releasing the chart
12+
13+
To release a new version of this chart simply set the version number in `Chart.yaml` as part of a pull request and once merged the new version will be released. Note that since this chart uses a `chart.lock` file the version in the lock file should match the version of the dependency listed in `Chart.yaml`, which should also be the version you tested your development changes against. Anytime you adjust the dependency version in `Chart.yaml` you should use `helm dependencies update` to fetch the new version and update the lock file to match. If your lock file and dependency version in the `Chart.yaml` file do not match you should update your dependencies and re-test to ensure your changes work with the version in the lock file.
14+
15+
## Contributing
16+
17+
This chart is functional and in use but lacks practices like more user friendly install instructions, explanation of how to configure values like `loadBalancerIP` on the vpn service, and a changelog to document changes in the versions. Contributions to add any of these items, to operate in a similar fashion to what's available in the library-chart that is used as a dependency would be greatly appreciated.

0 commit comments

Comments
 (0)