Skip to content

Commit 0a83f63

Browse files
committed
chore: remove api-data-watcher-pusher replace with seed
1 parent 7912fc4 commit 0a83f63

File tree

7 files changed

+41
-126
lines changed

7 files changed

+41
-126
lines changed

.github/workflows/test-suite.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
(steps.list-changed.outputs.changed == 'true' && !contains(github.event.pull_request.labels.*.name, 'next-release')) ||
135135
(contains(github.event.pull_request.labels.*.name, 'needs-testing'))
136136
run: |
137-
make install-lagoon
137+
make kind/seed-data
138138
make -j8 -O fill-test-ci-values TESTS=[${{ matrix.test }}]
139139
140140
- name: Helm-install the test fixtures and fill lagoon-test/ci/linter-values.yaml (next-release)
@@ -143,7 +143,7 @@ jobs:
143143
(contains(github.event.pull_request.labels.*.name, 'next-release'))
144144
run: |
145145
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' ./charts/lagoon-core/ci/linter-values.yaml ./charts/lagoon-core/ci/testlagoon-main-override.yaml
146-
make install-lagoon IMAGE_REGISTRY=testlagoon IMAGE_TAG=main OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=uselagoon/build-deploy-image:main OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=testlagoon/task-activestandby:main
146+
make kind/seed-data IMAGE_REGISTRY=testlagoon IMAGE_TAG=main OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=uselagoon/build-deploy-image:main OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=testlagoon/task-activestandby:main
147147
make -j8 -O fill-test-ci-values TESTS=[${{ matrix.test }}] IMAGE_REGISTRY=testlagoon IMAGE_TAG=main OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=uselagoon/build-deploy-image:main OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=testlagoon/task-activestandby:main
148148
149149
- name: Free up some disk space

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,3 +639,41 @@ port-forwards: pf-keycloak pf-api pf-ssh pf-ui
639639
.PHONY: run-tests
640640
run-tests:
641641
$(HELM) test --namespace lagoon-core --timeout 30m lagoon-test
642+
643+
# kind/seed-data is a way to seed a lagoon-core
644+
# CORE_APP_VERSION_OR_TREEISH = heads/main
645+
CORE_APP_VERSION_OR_TREEISH = heads/remove-data-watcher-pusher
646+
647+
.PHONY: kind/seed-data
648+
kind/seed-data: install-lagoon
649+
ifeq (,$(subst ",,$(CORE_APP_VERSION_OR_TREEISH)))
650+
$(eval CORE_APP_VERSION_OR_TREEISH = tags/$(shell $(HELM) search repo lagoon/lagoon-core -o json | $(JQ) -r '.[]|.app_version'))
651+
endif
652+
@echo "Loading API seed data" && \
653+
export LAGOON_LEGACY_ADMIN=$$(docker run \
654+
-e JWTSECRET="$$($(KUBECTL) get secret -n lagoon-core lagoon-core-secrets -o jsonpath="{.data.JWTSECRET}" | base64 --decode)" \
655+
-e JWTAUDIENCE=api.dev \
656+
-e JWTUSER=localadmin \
657+
uselagoon/tests \
658+
python3 /ansible/tasks/api/admin_token.py) && \
659+
export SSH_PORTAL_HOST="$$($(KUBECTL) -n lagoon get services lagoon-remote-ssh-portal -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" && \
660+
export SSH_PORTAL_PORT="$$($(KUBECTL) -n lagoon get services lagoon-remote-ssh-portal -o jsonpath='{.spec.ports[0].port}')" && \
661+
export CONSOLE_URL="https://kubernetes.default.svc/" && \
662+
export KUBERNETES_TOKEN="$$($(KUBECTL) get secret -n lagoon lagoon-remote-ssh-core-token -o jsonpath="{.data.token}" | base64 --decode)" && \
663+
export ROUTER_PATTERN="\$${project}.\$${environment}.$$($(KUBECTL) -n ingress-nginx get services ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" && \
664+
curl -sSLo /tmp/seed.gql https://raw.githubusercontent.com/uselagoon/lagoon/refs/$(CORE_APP_VERSION_OR_TREEISH)/local-dev/seed-data/00-populate-kubernetes.gql && \
665+
export SEED_DATA=$$(envsubst < /tmp/seed.gql | sed 's/"/\\"/g' | sed 's/\\n/\\\\n/g' | awk -F'\n' '{if(NR == 1) {printf $$0} else {printf "\\n"$$0}}') && \
666+
export SEED_DATA_JSON="{\"query\": \"$$SEED_DATA\"}" && \
667+
wget --quiet --header "Content-Type: application/json" --header "Authorization: bearer $${LAGOON_LEGACY_ADMIN}" "http://lagoon-api.$$($(KUBECTL) -n ingress-nginx get services ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}').nip.io/graphql" --post-data "$$SEED_DATA_JSON" --content-on-error -O - && \
668+
echo "Loading API seed users" && \
669+
curl -sSLo /tmp/seed-users.sh https://raw.githubusercontent.com/uselagoon/lagoon/refs/$(CORE_APP_VERSION_OR_TREEISH)/local-dev/seed-data/seed-users.sh && \
670+
cat /tmp/seed-users.sh \
671+
| $(KUBECTL) -n lagoon-core exec -i $$($(KUBECTL) -n lagoon-core get pods \
672+
-l app.kubernetes.io/component=lagoon-core-keycloak -o json | $(JQ) -r '.items[0].metadata.name') -- sh -c "cat > /tmp/seed-users.sh" && \
673+
$(KUBECTL) -n lagoon-core exec -it $$($(KUBECTL) -n lagoon-core get pods -l app.kubernetes.io/component=lagoon-core-keycloak -o json | $(JQ) -r '.items[0].metadata.name') -- bash '/tmp/seed-users.sh' \
674+
&& echo "You will be able to log in with these seed user email addresses and the passwords will be the same as the email address" \
675+
&& echo "eg. [email protected] has the password [email protected]" \
676+
&& echo "" \
677+
&& echo "If you want to create an example SSO identity provider and example user, run make k3d/example-sso" \
678+
&& echo "If you want to configure simple webauthn browswer flow, run make k3d/configure-webauthn" \
679+
&& echo ""

charts/lagoon-test/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ appVersion: v2.23.0
2929
annotations:
3030
artifacthub.io/changes: |
3131
- kind: changed
32-
description: update lagoon-core appVersion to v2.23.0
32+
description: removed api-data-watcher-pusher

charts/lagoon-test/ci/linter-values.yaml.tpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ localGit:
1111
image:
1212
repository: ${imageRegistry}/local-git
1313

14-
localAPIDataWatcherPusher:
15-
image:
16-
repository: ${imageRegistry}/local-api-data-watcher-pusher
17-
additonalEnvs:
18-
CLEAR_API_DATA: ${clearApiData}
19-
2014
tests:
2115
image:
2216
repository: ${imageRegistry}/tests

charts/lagoon-test/templates/_helpers.tpl

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -88,33 +88,3 @@ app.kubernetes.io/name: {{ include "lagoon-test.name" . }}
8888
app.kubernetes.io/component: {{ include "lagoon-test.localGit.fullname" . }}
8989
app.kubernetes.io/instance: {{ .Release.Name }}
9090
{{- end }}
91-
92-
93-
94-
{{/*
95-
Create a default fully qualified app name for local-api-data-watcher-pusher.
96-
*/}}
97-
{{- define "lagoon-test.localAPIDataWatcherPusher.fullname" -}}
98-
{{- include "lagoon-test.fullname" . }}-local-api-data-watcher-pusher
99-
{{- end }}
100-
101-
{{/*
102-
Common labels local-api-data-watcher-pusher.
103-
*/}}
104-
{{- define "lagoon-test.localAPIDataWatcherPusher.labels" -}}
105-
helm.sh/chart: {{ include "lagoon-test.chart" . }}
106-
{{ include "lagoon-test.localAPIDataWatcherPusher.selectorLabels" . }}
107-
{{- if .Chart.AppVersion }}
108-
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
109-
{{- end }}
110-
app.kubernetes.io/managed-by: {{ .Release.Service }}
111-
{{- end }}
112-
113-
{{/*
114-
Selector labels local-api-data-watcher-pusher.
115-
*/}}
116-
{{- define "lagoon-test.localAPIDataWatcherPusher.selectorLabels" -}}
117-
app.kubernetes.io/name: {{ include "lagoon-test.name" . }}
118-
app.kubernetes.io/component: {{ include "lagoon-test.localAPIDataWatcherPusher.fullname" . }}
119-
app.kubernetes.io/instance: {{ .Release.Name }}
120-
{{- end }}

charts/lagoon-test/templates/local-api-data-watcher-pusher.job.yaml

Lines changed: 0 additions & 70 deletions
This file was deleted.

charts/lagoon-test/values.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,6 @@ localGit:
111111

112112
affinity: {}
113113

114-
localAPIDataWatcherPusher:
115-
116-
image:
117-
repository: uselagoon/local-api-data-watcher-pusher
118-
pullPolicy: Always
119-
# Overrides the image tag whose default is the chart appVersion.
120-
tag: ""
121-
122-
additionalEnvs:
123-
# CLEAR_API_DATA: true
124-
125-
podSecurityContext: {}
126-
127-
securityContext: {}
128-
129-
resources: {}
130-
131114
tests:
132115

133116
image:

0 commit comments

Comments
 (0)