Skip to content

Commit 52cc88a

Browse files
committed
Use licenseID from env
1 parent 58342c9 commit 52cc88a

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

applications/wg-easy/Taskfile.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ vars:
1212
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
1313
RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}'
1414
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
15+
REPLICATED_LICENSE_ID: '{{.REPLICATED_LICENSE_ID}}'
1516

1617
# Cluster configuration
1718
CLUSTER_NAME: '{{.CLUSTER_NAME | default "test-cluster"}}'
@@ -53,16 +54,15 @@ tasks:
5354
silent: false
5455
vars:
5556
EMBEDDED: '{{.EMBEDDED | default "false"}}'
56-
LICENSE_ID: '{{if eq .EMBEDDED "true"}}{{.LICENSE_ID | default "2cmqT1dBVHZ3aSH21kPxWtgoYGr"}}{{end}}'
5757
TIMEOUT: '{{if eq .EMBEDDED "true"}}420{{else}}300{{end}}'
5858
TTL: '{{.TTL | default "4h"}}'
5959
status:
6060
- replicated cluster ls --output json | jq -e '.[] | select(.name == "{{.CLUSTER_NAME}}")' > /dev/null
6161
cmds:
6262
- |
6363
if [ "{{.EMBEDDED}}" = "true" ]; then
64-
echo "Creating embedded cluster {{.CLUSTER_NAME}} with license ID {{.LICENSE_ID}}..."
65-
replicated cluster create --distribution embedded-cluster --name {{.CLUSTER_NAME}} --license-id {{.LICENSE_ID}} --ttl {{.TTL}}
64+
echo "Creating embedded cluster {{.CLUSTER_NAME}} with license ID {{.REPLICATED_LICENSE_ID}}..."
65+
replicated cluster create --distribution embedded-cluster --name {{.CLUSTER_NAME}} --license-id {{.REPLICATED_LICENSE_ID}} --ttl {{.TTL}}
6666
else
6767
echo "Creating cluster {{.CLUSTER_NAME}} with distribution {{.DISTRIBUTION}}..."
6868
replicated cluster create --name {{.CLUSTER_NAME}} --distribution {{.DISTRIBUTION}} --version {{.K8S_VERSION}} --disk {{.DISK_SIZE}} --instance-type {{.INSTANCE_TYPE}} --ttl {{.TTL}}
@@ -173,9 +173,11 @@ tasks:
173173

174174
helm-install:
175175
desc: Install all charts using helmfile
176-
silent: false
176+
silent: true
177177
vars:
178-
LICENSE_ID: '{{.LICENSE_ID | default "2cmqT1dBVHZ3aSH21kPxWtgoYGr"}}'
178+
HELM_ENV: '{{.HELM_ENV | default "default"}}'
179+
requires:
180+
vars: [REPLICATED_LICENSE_ID]
179181
cmds:
180182
- echo "Installing all charts via helmfile"
181183
- |
@@ -190,11 +192,8 @@ tasks:
190192
ENV_VARS=$(task utils:port-operations OPERATION=getenv CLUSTER_NAME={{.CLUSTER_NAME}} )
191193
192194
# Deploy with helmfile
193-
helm registry logout registry.replicated.com || true
194-
helm registry login registry.replicated.com --username [email protected] --password {{.LICENSE_ID}}
195195
echo "Using $ENV_VARS"
196-
eval "KUBECONFIG={{.KUBECONFIG_FILE}} HELMFILE_ENVIRONMENT=replicated $ENV_VARS helmfile sync --wait"
197-
helm registry logout registry.replicated.com
196+
eval "KUBECONFIG={{.KUBECONFIG_FILE}} HELMFILE_ENVIRONMENT={{.HELM_ENV}} REPLICATED_APP={{.APP_SLUG}} $ENV_VARS helmfile sync --wait"
198197
- echo "All charts installed!"
199198
deps:
200199
- setup-kubeconfig

applications/wg-easy/docs/development-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Test multiple charts working together using Helmfile orchestration.
173173
174174
```bash
175175
# set a license id so we can perform the helm install from the replicated registry
176-
export LICENSE_ID=<customer license id>
176+
export REPLICATED_LICENSE_ID=<customer license id>
177177
task helm-install
178178
```
179179

applications/wg-easy/helmfile.yaml.gotmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ environments:
2121
values:
2222
- app: '{{ env "REPLICATED_APP" | default "wg-easy" }}'
2323
- channel: '{{ env "CHANNEL" | default "unstable" }}'
24+
- username: "[email protected]"
25+
- password: '{{env "REPLICATED_LICENSE_ID"}}'
2426
- chartSources:
2527
certManager: 'oci://registry.replicated.com/{{ env "REPLICATED_APP" | default "wg-easy" }}/{{ env "CHANNEL" | default "unstable" }}/cert-manager'
2628
certManagerIssuers: 'oci://registry.replicated.com/{{ env "REPLICATED_APP" | default "wg-easy" }}/{{ env "CHANNEL" | default "unstable" }}/cert-manager-issuers'
@@ -30,6 +32,13 @@ environments:
3032
- extras:
3133
enableReplicatedSDK: true
3234
---
35+
repositories:
36+
- name: registry.replicated.com
37+
oci: true
38+
url: registry.replicated.com
39+
username: '{{ .Values.username }}'
40+
password: '{{ .Values.password }}'
41+
3342
releases:
3443
# Install cert-manager with CRDs but without issuers
3544
- name: cert-manager

0 commit comments

Comments
 (0)