Skip to content

Commit 0838119

Browse files
committed
Use licenseID from env
1 parent 3189158 commit 0838119

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
@@ -13,6 +13,7 @@ vars:
1313
RELEASE_CHANNELd: '{{.RELEASE_CHANNEL | default "Unstable"}}'
1414
RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}'
1515
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
16+
REPLICATED_LICENSE_ID: '{{.REPLICATED_LICENSE_ID}}'
1617

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

175175
helm-install:
176176
desc: Install all charts using helmfile
177-
silent: false
177+
silent: true
178178
vars:
179-
LICENSE_ID: '{{.LICENSE_ID | default "2cmqT1dBVHZ3aSH21kPxWtgoYGr"}}'
179+
HELM_ENV: '{{.HELM_ENV | default "default"}}'
180+
requires:
181+
vars: [REPLICATED_LICENSE_ID]
180182
cmds:
181183
- echo "Installing all charts via helmfile"
182184
- |
@@ -191,11 +193,8 @@ tasks:
191193
ENV_VARS=$(task utils:port-operations OPERATION=getenv CLUSTER_NAME={{.CLUSTER_NAME}} )
192194
193195
# Deploy with helmfile
194-
helm registry logout registry.replicated.com || true
195-
helm registry login registry.replicated.com --username [email protected] --password {{.LICENSE_ID}}
196196
echo "Using $ENV_VARS"
197-
eval "KUBECONFIG={{.KUBECONFIG_FILE}} HELMFILE_ENVIRONMENT=replicated $ENV_VARS helmfile sync --wait"
198-
helm registry logout registry.replicated.com
197+
eval "KUBECONFIG={{.KUBECONFIG_FILE}} HELMFILE_ENVIRONMENT={{.HELM_ENV}} REPLICATED_APP={{.APP_SLUG}} $ENV_VARS helmfile sync --wait"
199198
- echo "All charts installed!"
200199
deps:
201200
- 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)