Skip to content
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

chore: remove api-data-watcher-pusher replace with seed #736

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
(steps.list-changed.outputs.changed == 'true' && !contains(github.event.pull_request.labels.*.name, 'next-release')) ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing'))
run: |
make install-lagoon
make kind/seed-data
make -j8 -O fill-test-ci-values TESTS=[${{ matrix.test }}]

- name: Helm-install the test fixtures and fill lagoon-test/ci/linter-values.yaml (next-release)
Expand All @@ -143,7 +143,7 @@ jobs:
(contains(github.event.pull_request.labels.*.name, 'next-release'))
run: |
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
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
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
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

- name: Free up some disk space
Expand Down
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -639,3 +639,41 @@ port-forwards: pf-keycloak pf-api pf-ssh pf-ui
.PHONY: run-tests
run-tests:
$(HELM) test --namespace lagoon-core --timeout 30m lagoon-test

# kind/seed-data is a way to seed a lagoon-core
# CORE_APP_VERSION_OR_TREEISH = heads/main
CORE_APP_VERSION_OR_TREEISH = heads/remove-data-watcher-pusher

.PHONY: kind/seed-data
kind/seed-data: install-lagoon
ifeq (,$(subst ",,$(CORE_APP_VERSION_OR_TREEISH)))
$(eval CORE_APP_VERSION_OR_TREEISH = tags/$(shell $(HELM) search repo lagoon/lagoon-core -o json | $(JQ) -r '.[]|.app_version'))
endif
@echo "Loading API seed data" && \
export LAGOON_LEGACY_ADMIN=$$(docker run \
-e JWTSECRET="$$($(KUBECTL) get secret -n lagoon-core lagoon-core-secrets -o jsonpath="{.data.JWTSECRET}" | base64 --decode)" \
-e JWTAUDIENCE=api.dev \
-e JWTUSER=localadmin \
uselagoon/tests \
python3 /ansible/tasks/api/admin_token.py) && \
export SSH_PORTAL_HOST="$$($(KUBECTL) -n lagoon get services lagoon-remote-ssh-portal -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" && \
export SSH_PORTAL_PORT="$$($(KUBECTL) -n lagoon get services lagoon-remote-ssh-portal -o jsonpath='{.spec.ports[0].port}')" && \
export CONSOLE_URL="https://kubernetes.default.svc/" && \
export KUBERNETES_TOKEN="$$($(KUBECTL) get secret -n lagoon lagoon-remote-ssh-core-token -o jsonpath="{.data.token}" | base64 --decode)" && \
export ROUTER_PATTERN="\$${project}.\$${environment}.$$($(KUBECTL) -n ingress-nginx get services ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" && \
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 && \
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}}') && \
export SEED_DATA_JSON="{\"query\": \"$$SEED_DATA\"}" && \
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 - && \
echo "Loading API seed users" && \
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 && \
cat /tmp/seed-users.sh \
| $(KUBECTL) -n lagoon-core exec -i $$($(KUBECTL) -n lagoon-core get pods \
-l app.kubernetes.io/component=lagoon-core-keycloak -o json | $(JQ) -r '.items[0].metadata.name') -- sh -c "cat > /tmp/seed-users.sh" && \
$(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' \
&& 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" \
&& echo "eg. [email protected] has the password [email protected]" \
&& echo "" \
&& echo "If you want to create an example SSO identity provider and example user, run make k3d/example-sso" \
&& echo "If you want to configure simple webauthn browswer flow, run make k3d/configure-webauthn" \
&& echo ""
2 changes: 1 addition & 1 deletion charts/lagoon-test/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ appVersion: v2.23.0
annotations:
artifacthub.io/changes: |
- kind: changed
description: update lagoon-core appVersion to v2.23.0
description: removed api-data-watcher-pusher
6 changes: 0 additions & 6 deletions charts/lagoon-test/ci/linter-values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ localGit:
image:
repository: ${imageRegistry}/local-git

localAPIDataWatcherPusher:
image:
repository: ${imageRegistry}/local-api-data-watcher-pusher
additonalEnvs:
CLEAR_API_DATA: ${clearApiData}

tests:
image:
repository: ${imageRegistry}/tests
Expand Down
30 changes: 0 additions & 30 deletions charts/lagoon-test/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,3 @@ app.kubernetes.io/name: {{ include "lagoon-test.name" . }}
app.kubernetes.io/component: {{ include "lagoon-test.localGit.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}



{{/*
Create a default fully qualified app name for local-api-data-watcher-pusher.
*/}}
{{- define "lagoon-test.localAPIDataWatcherPusher.fullname" -}}
{{- include "lagoon-test.fullname" . }}-local-api-data-watcher-pusher
{{- end }}

{{/*
Common labels local-api-data-watcher-pusher.
*/}}
{{- define "lagoon-test.localAPIDataWatcherPusher.labels" -}}
helm.sh/chart: {{ include "lagoon-test.chart" . }}
{{ include "lagoon-test.localAPIDataWatcherPusher.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels local-api-data-watcher-pusher.
*/}}
{{- define "lagoon-test.localAPIDataWatcherPusher.selectorLabels" -}}
app.kubernetes.io/name: {{ include "lagoon-test.name" . }}
app.kubernetes.io/component: {{ include "lagoon-test.localAPIDataWatcherPusher.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

This file was deleted.

17 changes: 0 additions & 17 deletions charts/lagoon-test/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,6 @@ localGit:

affinity: {}

localAPIDataWatcherPusher:

image:
repository: uselagoon/local-api-data-watcher-pusher
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: ""

additionalEnvs:
# CLEAR_API_DATA: true

podSecurityContext: {}

securityContext: {}

resources: {}

tests:

image:
Expand Down
Loading