From a67e9ce99af3ea8eb4956015e80b71a2bda09046 Mon Sep 17 00:00:00 2001 From: Tim Haasdyk Date: Thu, 13 Jun 2024 10:34:21 +0200 Subject: [PATCH 01/41] Make `local.env` creation idempotent in `task setup` --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index d3e1c51a0..8143e5f08 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -31,7 +31,7 @@ tasks: deps: [ setup-win, setup-unix ] cmds: - git config blame.ignoreRevsFile .git-blame-ignore-revs - - echo "HONEYCOMB_API_KEY=__REPLACE__" >> deployment/local-dev/local.env + - echo "HONEYCOMB_API_KEY=__REPLACE__" > deployment/local-dev/local.env - echo "#OTEL_SDK_DISABLED=true" >> deployment/local-dev/local.env - echo "GOOGLE_OAUTH_CLIENT_ID=__REPLACE__.apps.googleusercontent.com" >> deployment/local-dev/local.env - echo "GOOGLE_OAUTH_CLIENT_SECRET=__REPLACE__" >> deployment/local-dev/local.env From 4cd0ee2dab2dc78e65b7f15772977d4de86c0e42 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 08:35:10 -0600 Subject: [PATCH 02/41] initial workflow attempt --- .github/workflows/k8s-action.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/k8s-action.yaml diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml new file mode 100644 index 000000000..7a796efae --- /dev/null +++ b/.github/workflows/k8s-action.yaml @@ -0,0 +1,25 @@ +name: run k8s in a github action? +on: + workflow_dispatch: + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: setup k8s + uses: helm/kind-action@1.10.0 + - name: Verify k8s + run: | + kubectl cluster-info + kubectl get nodes + - name: deploy + run: | + kubectl apply -k ./deployment/develop + kubectl wait --for=condition=Ready --timeout=60s deployment/lexbox + - name: status + if: always() + run: kubectl get deployment/lexbox + From fe2658369f44288d52a2d844190487e7722f8b75 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 08:37:45 -0600 Subject: [PATCH 03/41] add pr trigger --- .github/workflows/k8s-action.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 7a796efae..99d737902 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -1,6 +1,9 @@ name: run k8s in a github action? on: workflow_dispatch: + pull_request: + branches: + - develop jobs: execute: From c11d3f5dc3ed4f971cce74e25ebc5fcc8aec9432 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 08:39:29 -0600 Subject: [PATCH 04/41] fix help kind version --- .github/workflows/k8s-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 99d737902..6922830f8 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -13,7 +13,7 @@ jobs: with: submodules: true - name: setup k8s - uses: helm/kind-action@1.10.0 + uses: helm/kind-action@v1.10.0 - name: Verify k8s run: | kubectl cluster-info From e267c0ffd04cc0f028d617b9c5be141f466b4702 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 08:46:00 -0600 Subject: [PATCH 05/41] only run codeql when code changes --- .github/workflows/codeql.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 492828ad7..399812e87 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -5,6 +5,11 @@ on: branches: [ "develop", "main" ] pull_request: branches: [ "develop", "main" ] + paths: + - "**/*.cs" + - "**/*.csproj" + - "**/*.ts" + - "**/*.js" schedule: - cron: '34 21 * * 2' @@ -38,7 +43,7 @@ jobs: uses: actions/checkout@v4 with: submodules: true - + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL From 93f0d9a2e58d728f7ae342afecbd5f249766c239 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 08:49:10 -0600 Subject: [PATCH 06/41] use local-dev instead of develop since cert-manager is missing --- .github/workflows/k8s-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 6922830f8..9866c7f5f 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -20,7 +20,7 @@ jobs: kubectl get nodes - name: deploy run: | - kubectl apply -k ./deployment/develop + kubectl apply -k ./deployment/local-dev kubectl wait --for=condition=Ready --timeout=60s deployment/lexbox - name: status if: always() From 8fccda123b56ace52600c91b81fd159312a05080 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 08:54:44 -0600 Subject: [PATCH 07/41] breakout local.env setup and call in k8s workflow to fix issue where file was missing --- .github/workflows/k8s-action.yaml | 3 +++ Taskfile.yml | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 9866c7f5f..f3c0e2a22 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -12,6 +12,9 @@ jobs: - uses: actions/checkout@v4 with: submodules: true + - name: Install Task + uses: arduino/setup-task@v2 + - run: task setup-local-env - name: setup k8s uses: helm/kind-action@v1.10.0 - name: Verify k8s diff --git a/Taskfile.yml b/Taskfile.yml index 8143e5f08..10cd7c308 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -28,13 +28,9 @@ includes: tasks: setup: - deps: [ setup-win, setup-unix ] + deps: [ setup-win, setup-unix, setup-local-env ] cmds: - git config blame.ignoreRevsFile .git-blame-ignore-revs - - echo "HONEYCOMB_API_KEY=__REPLACE__" > deployment/local-dev/local.env - - echo "#OTEL_SDK_DISABLED=true" >> deployment/local-dev/local.env - - echo "GOOGLE_OAUTH_CLIENT_ID=__REPLACE__.apps.googleusercontent.com" >> deployment/local-dev/local.env - - echo "GOOGLE_OAUTH_CLIENT_SECRET=__REPLACE__" >> deployment/local-dev/local.env - kubectl --context=docker-desktop apply -f deployment/setup/namespace.yaml - docker build -t local-dev-init data/ setup-win: @@ -47,6 +43,12 @@ tasks: cmds: - wget -c -O {{.DATA_DIR}}/sena-3.zip 'https://drive.google.com/uc?export=download&id=1I-hwc0RHoQqW774gbS5qR-GHa1E7BlsS' - wget -c -O {{.DATA_DIR}}/elawa.zip 'https://drive.usercontent.google.com/download?export=download&id=1Jk-eSDho8ATBMS-Kmfatwi-MWQth26ro&confirm=t' + setup-local-env: + cmds: + - echo "HONEYCOMB_API_KEY=__REPLACE__" > deployment/local-dev/local.env + - echo "#OTEL_SDK_DISABLED=true" >> deployment/local-dev/local.env + - echo "GOOGLE_OAUTH_CLIENT_ID=__REPLACE__.apps.googleusercontent.com" >> deployment/local-dev/local.env + - echo "GOOGLE_OAUTH_CLIENT_SECRET=__REPLACE__" >> deployment/local-dev/local.env # k8s up: From bb5797de8a6d1703eeb395ecd45fb1b3fdffd944 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 08:57:10 -0600 Subject: [PATCH 08/41] create languagedepot namespace before applying --- .github/workflows/k8s-action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index f3c0e2a22..0902d56ef 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -23,6 +23,7 @@ jobs: kubectl get nodes - name: deploy run: | + kubectl create namespace languagedepot kubectl apply -k ./deployment/local-dev kubectl wait --for=condition=Ready --timeout=60s deployment/lexbox - name: status From a189893bf5c30c5e9c167a0c4fe69ca9876ac9ab Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 09:05:26 -0600 Subject: [PATCH 09/41] correct waiit action to wait for pods and select by label, specify namespace since default ns isn't where we want to check --- .github/workflows/k8s-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 0902d56ef..4a73f5467 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -25,7 +25,7 @@ jobs: run: | kubectl create namespace languagedepot kubectl apply -k ./deployment/local-dev - kubectl wait --for=condition=Ready --timeout=60s deployment/lexbox + kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' - name: status if: always() run: kubectl get deployment/lexbox From 86a9dbe96fb6d89eb2fd9efb41d2d7eb79abd8de Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 09:07:01 -0600 Subject: [PATCH 10/41] add missing namespace --- .github/workflows/k8s-action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 4a73f5467..1c7140bd2 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -25,8 +25,8 @@ jobs: run: | kubectl create namespace languagedepot kubectl apply -k ./deployment/local-dev - kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' + kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot - name: status if: always() - run: kubectl get deployment/lexbox + run: kubectl get deployment/lexbox -n languagedepot From d2bbb69f8a6531cd2c2b932ff2d55e61ae683077 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 09:55:37 -0600 Subject: [PATCH 11/41] use skaffold to setup cluster, run dotnet test with GHA logger --- .github/workflows/k8s-action.yaml | 16 ++++++++++++++-- backend/Testing/Testing.csproj | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 1c7140bd2..0c639a15b 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -5,6 +5,7 @@ on: branches: - develop + jobs: execute: runs-on: ubuntu-latest @@ -15,6 +16,10 @@ jobs: - name: Install Task uses: arduino/setup-task@v2 - run: task setup-local-env + - name: Install Skaffold + run: | + curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 + sudo install skaffold /usr/local/bin/ - name: setup k8s uses: helm/kind-action@v1.10.0 - name: Verify k8s @@ -24,9 +29,16 @@ jobs: - name: deploy run: | kubectl create namespace languagedepot - kubectl apply -k ./deployment/local-dev - kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot + task up - name: status if: always() run: kubectl get deployment/lexbox -n languagedepot + - name: test + env: + TEST_SERVER_HOSTNAME: 'localhost' + TEST_STANDARD_HG_HOSTNAME: 'hg.localhost' + TEST_RESUMABLE_HG_HOSTNAME: 'resumable.localhost' + TEST_PROJECT_CODE: 'sena-3' + TEST_DEFAULT_PASSWORD: 'pass' + run: dotnet test --logger GitHubActions --filter Category=Integration diff --git a/backend/Testing/Testing.csproj b/backend/Testing/Testing.csproj index 6e8e6d7b1..ad8c978be 100644 --- a/backend/Testing/Testing.csproj +++ b/backend/Testing/Testing.csproj @@ -48,6 +48,10 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + From db4001eac19da19275802dc2d57b9e0669625be7 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 10:24:31 -0600 Subject: [PATCH 12/41] setup better failure logs, remove skaffold since we don't want to build anything --- .github/workflows/k8s-action.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 0c639a15b..4cc9c9a58 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -16,10 +16,6 @@ jobs: - name: Install Task uses: arduino/setup-task@v2 - run: task setup-local-env - - name: Install Skaffold - run: | - curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 - sudo install skaffold /usr/local/bin/ - name: setup k8s uses: helm/kind-action@v1.10.0 - name: Verify k8s @@ -29,10 +25,14 @@ jobs: - name: deploy run: | kubectl create namespace languagedepot - task up + kubectl apply -k ./deployment/local-dev + kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot - name: status - if: always() - run: kubectl get deployment/lexbox -n languagedepot + if: failure() + run: | + kubectl describe pods -l 'app in (lexbox, ui, hg, db)' -n languagedepot + echo "========== LOGS ==========" + kubectl logs -l 'app in (lexbox, ui, hg, db)' -n languagedepot --prefix --all-containers - name: test env: TEST_SERVER_HOSTNAME: 'localhost' From 7e1ace2156f328fff8f8857dbd9c6887ee0afa4d Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 10:35:49 -0600 Subject: [PATCH 13/41] switch from kind to mini kube because of PVC issues --- .github/workflows/k8s-action.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 4cc9c9a58..026787c23 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -17,13 +17,16 @@ jobs: uses: arduino/setup-task@v2 - run: task setup-local-env - name: setup k8s - uses: helm/kind-action@v1.10.0 + uses: medyagh/setup-minikube@latest - name: Verify k8s run: | kubectl cluster-info kubectl get nodes - name: deploy run: | + minikube image load ghcr.io/sillsdev/lexbox-hgweb:latest + minikube image load ghcr.io/sillsdev/lexbox-api:develop + minikube image load ghcr.io/sillsdev/lexbox-ui:develop kubectl create namespace languagedepot kubectl apply -k ./deployment/local-dev kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot From 6fff47cb56075db6fd0117673b42d7910cffeaa4 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 10:57:35 -0600 Subject: [PATCH 14/41] introduce a kustomize layer for gha, change storage class used --- .github/workflows/k8s-action.yaml | 2 +- deployment/gha/change-storage-class.patch.yaml | 7 +++++++ deployment/gha/kustomize.yaml | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 deployment/gha/change-storage-class.patch.yaml create mode 100644 deployment/gha/kustomize.yaml diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 026787c23..5161847d2 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -28,7 +28,7 @@ jobs: minikube image load ghcr.io/sillsdev/lexbox-api:develop minikube image load ghcr.io/sillsdev/lexbox-ui:develop kubectl create namespace languagedepot - kubectl apply -k ./deployment/local-dev + kubectl apply -k ./deployment/gha kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot - name: status if: failure() diff --git a/deployment/gha/change-storage-class.patch.yaml b/deployment/gha/change-storage-class.patch.yaml new file mode 100644 index 000000000..0a0496142 --- /dev/null +++ b/deployment/gha/change-storage-class.patch.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: hg-repos + namespace: languagedepot +spec: + storageClassName: standard # Because kind only supports the standard storage class diff --git a/deployment/gha/kustomize.yaml b/deployment/gha/kustomize.yaml new file mode 100644 index 000000000..5eb3cd765 --- /dev/null +++ b/deployment/gha/kustomize.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: languagedepot + +resources: +- ../local-dev/ + +patches: + - target: + version: v1 + kind: PersistentVolumeClaim + path: change-storage-class.patch.yaml + +images: + - name: busybox:1.36.1 + newName: busybox:1.36.1 From 6467ead46c3f06eb0d1917dd1c8ca5a061bea70b Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:00:20 -0600 Subject: [PATCH 15/41] correct name of kustomize file, change back to kind --- .github/workflows/k8s-action.yaml | 8 ++++---- deployment/gha/{kustomize.yaml => kustomization.yaml} | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename deployment/gha/{kustomize.yaml => kustomization.yaml} (100%) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 5161847d2..baea7289f 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -17,16 +17,16 @@ jobs: uses: arduino/setup-task@v2 - run: task setup-local-env - name: setup k8s - uses: medyagh/setup-minikube@latest + uses: helm/kind-action@v1.10.0 - name: Verify k8s run: | kubectl cluster-info kubectl get nodes - name: deploy run: | - minikube image load ghcr.io/sillsdev/lexbox-hgweb:latest - minikube image load ghcr.io/sillsdev/lexbox-api:develop - minikube image load ghcr.io/sillsdev/lexbox-ui:develop + kind load docker-image ghcr.io/sillsdev/lexbox-hgweb:latest + kind load docker-image ghcr.io/sillsdev/lexbox-api:develop + kind load docker-image ghcr.io/sillsdev/lexbox-ui:develop kubectl create namespace languagedepot kubectl apply -k ./deployment/gha kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot diff --git a/deployment/gha/kustomize.yaml b/deployment/gha/kustomization.yaml similarity index 100% rename from deployment/gha/kustomize.yaml rename to deployment/gha/kustomization.yaml From 44e278f5c93cc1ffab45df31ab5df35d0aa104b3 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:02:22 -0600 Subject: [PATCH 16/41] pull image with docker before pulling with kind --- .github/workflows/k8s-action.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index baea7289f..ed1fb4627 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -24,6 +24,9 @@ jobs: kubectl get nodes - name: deploy run: | + docker image pull ghcr.io/sillsdev/lexbox-hgweb:latest + docker image pull ghcr.io/sillsdev/lexbox-api:develop + docker image pull ghcr.io/sillsdev/lexbox-ui:develop kind load docker-image ghcr.io/sillsdev/lexbox-hgweb:latest kind load docker-image ghcr.io/sillsdev/lexbox-api:develop kind load docker-image ghcr.io/sillsdev/lexbox-ui:develop From fed1f606d64e8bae30cc584acb6ca8bc3cd7636b Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:04:48 -0600 Subject: [PATCH 17/41] donn't attempt to load images via kind --- .github/workflows/k8s-action.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index ed1fb4627..0a6de28d8 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -24,12 +24,9 @@ jobs: kubectl get nodes - name: deploy run: | - docker image pull ghcr.io/sillsdev/lexbox-hgweb:latest - docker image pull ghcr.io/sillsdev/lexbox-api:develop - docker image pull ghcr.io/sillsdev/lexbox-ui:develop - kind load docker-image ghcr.io/sillsdev/lexbox-hgweb:latest - kind load docker-image ghcr.io/sillsdev/lexbox-api:develop - kind load docker-image ghcr.io/sillsdev/lexbox-ui:develop + docker image pull -q ghcr.io/sillsdev/lexbox-hgweb:latest + docker image pull -q ghcr.io/sillsdev/lexbox-api:develop + docker image pull -q ghcr.io/sillsdev/lexbox-ui:develop kubectl create namespace languagedepot kubectl apply -k ./deployment/gha kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot From 80be6b1e68aaeead814e367aa5ac728fbb1b4935 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:12:14 -0600 Subject: [PATCH 18/41] change local-dev-init back to use busybox, increase timeout when waiting for deployments --- .github/workflows/k8s-action.yaml | 2 +- deployment/gha/kustomization.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 0a6de28d8..c51738a31 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -29,7 +29,7 @@ jobs: docker image pull -q ghcr.io/sillsdev/lexbox-ui:develop kubectl create namespace languagedepot kubectl apply -k ./deployment/gha - kubectl wait --for=condition=Ready --timeout=60s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot + kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot - name: status if: failure() run: | diff --git a/deployment/gha/kustomization.yaml b/deployment/gha/kustomization.yaml index 5eb3cd765..d4c1f8a2c 100644 --- a/deployment/gha/kustomization.yaml +++ b/deployment/gha/kustomization.yaml @@ -12,5 +12,5 @@ patches: path: change-storage-class.patch.yaml images: - - name: busybox:1.36.1 + - name: local-dev-init #revert change made by local-dev patch newName: busybox:1.36.1 From a49524050e548f2563379e242336e3d1a2180d0a Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:20:01 -0600 Subject: [PATCH 19/41] prevent doubl prefixing busybox with the tag --- .github/workflows/k8s-action.yaml | 3 --- deployment/gha/kustomization.yaml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index c51738a31..ae091e14d 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -24,9 +24,6 @@ jobs: kubectl get nodes - name: deploy run: | - docker image pull -q ghcr.io/sillsdev/lexbox-hgweb:latest - docker image pull -q ghcr.io/sillsdev/lexbox-api:develop - docker image pull -q ghcr.io/sillsdev/lexbox-ui:develop kubectl create namespace languagedepot kubectl apply -k ./deployment/gha kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot diff --git a/deployment/gha/kustomization.yaml b/deployment/gha/kustomization.yaml index d4c1f8a2c..93ba6384a 100644 --- a/deployment/gha/kustomization.yaml +++ b/deployment/gha/kustomization.yaml @@ -13,4 +13,4 @@ patches: images: - name: local-dev-init #revert change made by local-dev patch - newName: busybox:1.36.1 + newName: busybox From f300cfd28f6bc06d288b93e8fc81332e6676e16f Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:29:32 -0600 Subject: [PATCH 20/41] increase log tail length to see error --- .github/workflows/k8s-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index ae091e14d..d3019fa61 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -32,7 +32,7 @@ jobs: run: | kubectl describe pods -l 'app in (lexbox, ui, hg, db)' -n languagedepot echo "========== LOGS ==========" - kubectl logs -l 'app in (lexbox, ui, hg, db)' -n languagedepot --prefix --all-containers + kubectl logs -l 'app in (lexbox, ui, hg, db)' -n languagedepot --prefix --all-containers --tail=50 - name: test env: TEST_SERVER_HOSTNAME: 'localhost' From 1a1118b5806c2f295ea124bce5b54c50e8ba7baa Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:37:20 -0600 Subject: [PATCH 21/41] add frontend folder to gha for dotnet to write the schema to. --- deployment/gha/kustomization.yaml | 1 + deployment/gha/lexbox.patch.yaml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 deployment/gha/lexbox.patch.yaml diff --git a/deployment/gha/kustomization.yaml b/deployment/gha/kustomization.yaml index 93ba6384a..949415e82 100644 --- a/deployment/gha/kustomization.yaml +++ b/deployment/gha/kustomization.yaml @@ -6,6 +6,7 @@ resources: - ../local-dev/ patches: + - path: lexbox.patch.yaml - target: version: v1 kind: PersistentVolumeClaim diff --git a/deployment/gha/lexbox.patch.yaml b/deployment/gha/lexbox.patch.yaml new file mode 100644 index 000000000..eda7c2e77 --- /dev/null +++ b/deployment/gha/lexbox.patch.yaml @@ -0,0 +1,16 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: lexbox + namespace: languagedepot +spec: + template: + spec: + containers: + - name: lexbox-api + volumeMounts: + - mountPath: /frontend + name: gql-schema + volumes: + - name: gql-schema + emptyDir: {} From 65a56737a2134fdd6e00edc46d819c7babbd65a5 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:52:00 -0600 Subject: [PATCH 22/41] ensure that kind forwards localhost:80 to ingress in gha --- .github/workflows/k8s-action.yaml | 5 +++++ deployment/gha/kind.yaml | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 deployment/gha/kind.yaml diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index d3019fa61..ba9687cae 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -8,6 +8,7 @@ on: jobs: execute: + timeout-minutes: 60 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -18,6 +19,8 @@ jobs: - run: task setup-local-env - name: setup k8s uses: helm/kind-action@v1.10.0 + with: + config: deployment/gha/kind.yaml - name: Verify k8s run: | kubectl cluster-info @@ -33,6 +36,8 @@ jobs: kubectl describe pods -l 'app in (lexbox, ui, hg, db)' -n languagedepot echo "========== LOGS ==========" kubectl logs -l 'app in (lexbox, ui, hg, db)' -n languagedepot --prefix --all-containers --tail=50 + - name: verify ingress + run: curl -v http://localhost - name: test env: TEST_SERVER_HOSTNAME: 'localhost' diff --git a/deployment/gha/kind.yaml b/deployment/gha/kind.yaml new file mode 100644 index 000000000..fd7063b0b --- /dev/null +++ b/deployment/gha/kind.yaml @@ -0,0 +1,11 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP From a373210407b618f61d64c2ae8ab45441c199efb5 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 11:58:21 -0600 Subject: [PATCH 23/41] ensure we wait for ingress to be ready --- .github/workflows/k8s-action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index ba9687cae..5960d798c 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -30,6 +30,7 @@ jobs: kubectl create namespace languagedepot kubectl apply -k ./deployment/gha kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot + kubectl wait --for=condition=Ready --timeout=90s pod -l 'app.kubernetes.io/name=ingress-nginx' -n languagedepot - name: status if: failure() run: | From 7dc04440ff13a6a4c4d1a3b4171e892b8ad1bf6d Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 12:05:41 -0600 Subject: [PATCH 24/41] wait for app.kubernetes.io/component=controller --- .github/workflows/k8s-action.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 5960d798c..b588c8b9a 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -30,13 +30,15 @@ jobs: kubectl create namespace languagedepot kubectl apply -k ./deployment/gha kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot - kubectl wait --for=condition=Ready --timeout=90s pod -l 'app.kubernetes.io/name=ingress-nginx' -n languagedepot + kubectl wait --for=condition=Ready --timeout=90s pod -l 'app.kubernetes.io/component=controller' -n languagedepot - name: status if: failure() run: | kubectl describe pods -l 'app in (lexbox, ui, hg, db)' -n languagedepot echo "========== LOGS ==========" kubectl logs -l 'app in (lexbox, ui, hg, db)' -n languagedepot --prefix --all-containers --tail=50 + echo "========== INGRESS ==========" + kubectl logs -l 'app.kubernetes.io/name=ingress-nginx' -n languagedepot --prefix --all-containers --tail=50 - name: verify ingress run: curl -v http://localhost - name: test From 258d916a9590a4b8cc0554ec23cf895e116d2cfd Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 12:17:48 -0600 Subject: [PATCH 25/41] use port forwarding to access ingress --- .github/workflows/k8s-action.yaml | 10 ++++++---- deployment/gha/kind.yaml | 9 --------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index b588c8b9a..381f187d6 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -39,13 +39,15 @@ jobs: kubectl logs -l 'app in (lexbox, ui, hg, db)' -n languagedepot --prefix --all-containers --tail=50 echo "========== INGRESS ==========" kubectl logs -l 'app.kubernetes.io/name=ingress-nginx' -n languagedepot --prefix --all-containers --tail=50 + - name: forward ingress + run: kubectl port-forward service/ingress-nginx-controller 6579:80 -n languagedepot & - name: verify ingress - run: curl -v http://localhost + run: curl -v http://localhost:6579 - name: test env: - TEST_SERVER_HOSTNAME: 'localhost' - TEST_STANDARD_HG_HOSTNAME: 'hg.localhost' - TEST_RESUMABLE_HG_HOSTNAME: 'resumable.localhost' + TEST_SERVER_HOSTNAME: 'localhost:6579' + TEST_STANDARD_HG_HOSTNAME: 'hg.localhost:6579' + TEST_RESUMABLE_HG_HOSTNAME: 'resumable.localhost:6579' TEST_PROJECT_CODE: 'sena-3' TEST_DEFAULT_PASSWORD: 'pass' run: dotnet test --logger GitHubActions --filter Category=Integration diff --git a/deployment/gha/kind.yaml b/deployment/gha/kind.yaml index fd7063b0b..18eb9ae2e 100644 --- a/deployment/gha/kind.yaml +++ b/deployment/gha/kind.yaml @@ -1,11 +1,2 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 -nodes: -- role: control-plane - extraPortMappings: - - containerPort: 80 - hostPort: 80 - protocol: TCP - - containerPort: 443 - hostPort: 443 - protocol: TCP From b1db60910e703b5da84c2b360e472318574a3319 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 12:28:34 -0600 Subject: [PATCH 26/41] explicitly build and restore to ensure that MercurialExtensions is found --- .github/workflows/k8s-action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 381f187d6..d01738d56 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -43,6 +43,8 @@ jobs: run: kubectl port-forward service/ingress-nginx-controller 6579:80 -n languagedepot & - name: verify ingress run: curl -v http://localhost:6579 + - name: build + run: dotnet restore && dotnet build --no-restore - name: test env: TEST_SERVER_HOSTNAME: 'localhost:6579' From f8dade4081a9f531296fe2e3603e1642d101d938 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 12:35:44 -0600 Subject: [PATCH 27/41] disable export to honeycomb in gha --- deployment/gha/lexbox.patch.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/deployment/gha/lexbox.patch.yaml b/deployment/gha/lexbox.patch.yaml index eda7c2e77..e08e97750 100644 --- a/deployment/gha/lexbox.patch.yaml +++ b/deployment/gha/lexbox.patch.yaml @@ -11,6 +11,23 @@ spec: volumeMounts: - mountPath: /frontend name: gql-schema + - name: otel-collector + env: #don't try to export to honeycomb + - name: COLLECTOR_CONFIG_OVERRIDE + value: | + exporters: + otlp/aspire: + endpoint: localhost:18889 + tls: + insecure: true + service: + pipelines: + traces: + exporters: [otlp/aspire] + metrics: + exporters: [otlp/aspire] + logs: + exporters: [otlp/aspire] volumes: - name: gql-schema emptyDir: {} From f995fd844a8633abaaffb0574d86407dee11272c Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 13:19:27 -0600 Subject: [PATCH 28/41] rename workflow --- .github/workflows/k8s-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index d01738d56..721403642 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -1,4 +1,4 @@ -name: run k8s in a github action? +name: Self contained integration tests on: workflow_dispatch: pull_request: From 653d8edbc15a76bab02f7008479eaa6d5a23092a Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 10 Jun 2024 16:25:58 -0600 Subject: [PATCH 29/41] add blame timeout to integration tests running on gha. --- .github/workflows/k8s-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 721403642..3944df85c 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -52,5 +52,5 @@ jobs: TEST_RESUMABLE_HG_HOSTNAME: 'resumable.localhost:6579' TEST_PROJECT_CODE: 'sena-3' TEST_DEFAULT_PASSWORD: 'pass' - run: dotnet test --logger GitHubActions --filter Category=Integration + run: dotnet test --logger GitHubActions --filter Category=Integration --blame-hang-timeout 40m From f7936540eb37795a480421223a015d007bbb2234 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 6 Aug 2024 15:24:58 +0700 Subject: [PATCH 30/41] install cert-manager during deployment --- .github/workflows/k8s-action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 3944df85c..b57a5d72a 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -28,6 +28,7 @@ jobs: - name: deploy run: | kubectl create namespace languagedepot + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.0/cert-manager.yaml kubectl apply -k ./deployment/gha kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot kubectl wait --for=condition=Ready --timeout=90s pod -l 'app.kubernetes.io/component=controller' -n languagedepot From c1d39c1f69dd1c8a84a129afc0925c6a8a8b3681 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 6 Aug 2024 15:38:51 +0700 Subject: [PATCH 31/41] ensure cert manager is ready before deploying --- .github/workflows/k8s-action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index b57a5d72a..1fd96f019 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -29,6 +29,7 @@ jobs: run: | kubectl create namespace languagedepot kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.0/cert-manager.yaml + kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (cert-manager, webhook)' -n cert-manager kubectl apply -k ./deployment/gha kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot kubectl wait --for=condition=Ready --timeout=90s pod -l 'app.kubernetes.io/component=controller' -n languagedepot From d6509096d6fb313f887dd0ae7221f5e6f6ea4388 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 6 Aug 2024 15:42:56 +0700 Subject: [PATCH 32/41] don't try to build maui stuff --- .github/workflows/k8s-action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 1fd96f019..c628c1136 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -46,7 +46,7 @@ jobs: - name: verify ingress run: curl -v http://localhost:6579 - name: build - run: dotnet restore && dotnet build --no-restore + run: dotnet restore LexBoxOnly.slnf && dotnet build --no-restore LexBoxOnly.slnf - name: test env: TEST_SERVER_HOSTNAME: 'localhost:6579' @@ -54,5 +54,5 @@ jobs: TEST_RESUMABLE_HG_HOSTNAME: 'resumable.localhost:6579' TEST_PROJECT_CODE: 'sena-3' TEST_DEFAULT_PASSWORD: 'pass' - run: dotnet test --logger GitHubActions --filter Category=Integration --blame-hang-timeout 40m + run: dotnet test LexBoxOnly.slnf --logger GitHubActions --filter Category=Integration --blame-hang-timeout 40m From 6396b77536c2c781ab1382511ef04b3468f80ce1 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 6 Aug 2024 16:19:10 +0700 Subject: [PATCH 33/41] configure gha k8s deployment to run as the staging environment. --- deployment/gha/app-config.yaml | 6 ++++++ deployment/gha/kustomization.yaml | 1 + 2 files changed, 7 insertions(+) create mode 100644 deployment/gha/app-config.yaml diff --git a/deployment/gha/app-config.yaml b/deployment/gha/app-config.yaml new file mode 100644 index 000000000..7f69d2995 --- /dev/null +++ b/deployment/gha/app-config.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: app-config +data: + environment-name: "Staging" diff --git a/deployment/gha/kustomization.yaml b/deployment/gha/kustomization.yaml index 949415e82..d4fd2042e 100644 --- a/deployment/gha/kustomization.yaml +++ b/deployment/gha/kustomization.yaml @@ -11,6 +11,7 @@ patches: version: v1 kind: PersistentVolumeClaim path: change-storage-class.patch.yaml + - path: app-config.yaml images: - name: local-dev-init #revert change made by local-dev patch From 2f828dc0d4ef76d88b7fe362e88dc797ca8153b3 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 6 Aug 2024 16:26:47 +0700 Subject: [PATCH 34/41] switch back to Development, and make /var/www writable --- deployment/gha/app-config.yaml | 2 +- deployment/gha/lexbox.patch.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/deployment/gha/app-config.yaml b/deployment/gha/app-config.yaml index 7f69d2995..7cf3f5cfe 100644 --- a/deployment/gha/app-config.yaml +++ b/deployment/gha/app-config.yaml @@ -3,4 +3,4 @@ kind: ConfigMap metadata: name: app-config data: - environment-name: "Staging" + environment-name: "Development" diff --git a/deployment/gha/lexbox.patch.yaml b/deployment/gha/lexbox.patch.yaml index e08e97750..538e31a32 100644 --- a/deployment/gha/lexbox.patch.yaml +++ b/deployment/gha/lexbox.patch.yaml @@ -11,6 +11,8 @@ spec: volumeMounts: - mountPath: /frontend name: gql-schema + - mountPath: /var/www + name: www - name: otel-collector env: #don't try to export to honeycomb - name: COLLECTOR_CONFIG_OVERRIDE @@ -31,3 +33,5 @@ spec: volumes: - name: gql-schema emptyDir: {} + - name: www + emptyDir: {} From 0e1af3d67f8a2ce9bad50c3593cd658920babcc1 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Wed, 7 Aug 2024 08:39:20 +0700 Subject: [PATCH 35/41] fix test error when ServerHostname includes a port --- .../SyncReverseProxy/SendReceiveServiceTests.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/backend/Testing/SyncReverseProxy/SendReceiveServiceTests.cs b/backend/Testing/SyncReverseProxy/SendReceiveServiceTests.cs index 27315efa0..a67eb9683 100644 --- a/backend/Testing/SyncReverseProxy/SendReceiveServiceTests.cs +++ b/backend/Testing/SyncReverseProxy/SendReceiveServiceTests.cs @@ -133,14 +133,8 @@ public async Task SendReceiveAfterProjectReset(HgProtocol protocol) var srResult = _sendReceiveService.SendReceiveProject(sendReceiveParams, AdminAuth); // First, save the current value of `hg tip` from the original project - var tipUri = new UriBuilder - { - Scheme = TestingEnvironmentVariables.HttpScheme, - Host = TestingEnvironmentVariables.ServerHostname, - Path = $"hg/{projectConfig.Code}/tags", - Query = "?style=json" - }; - var response = await _adminApiTester.HttpClient.GetAsync(tipUri.Uri); + var tipUri = $"/hg/{projectConfig.Code}/tags?style=json"; + var response = await _adminApiTester.HttpClient.GetAsync(tipUri); var jsonResult = await response.Content.ReadFromJsonAsync(); var originalTip = jsonResult?["node"]?.AsValue()?.ToString(); originalTip.ShouldNotBeNull(); @@ -155,7 +149,7 @@ public async Task SendReceiveAfterProjectReset(HgProtocol protocol) await _adminApiTester.HttpClient.PostAsync($"{_adminApiTester.BaseUrl}/api/project/finishResetProject/{projectConfig.Code}", null); // Step 2: verify project is now empty, i.e. tip is "0000000..." - response = await _adminApiTester.HttpClient.GetAsync(tipUri.Uri); + response = await _adminApiTester.HttpClient.GetAsync(tipUri); jsonResult = await response.Content.ReadFromJsonAsync(); var emptyTip = jsonResult?["node"]?.AsValue()?.ToString(); emptyTip.ShouldNotBeNull(); @@ -178,7 +172,7 @@ public async Task SendReceiveAfterProjectReset(HgProtocol protocol) _output.WriteLine(srResultStep3); // Step 4: verify project tip is same hash as original project tip - response = await _adminApiTester.HttpClient.GetAsync(tipUri.Uri); + response = await _adminApiTester.HttpClient.GetAsync(tipUri); jsonResult = await response.Content.ReadFromJsonAsync(); var postSRTip = jsonResult?["node"]?.AsValue()?.ToString(); postSRTip.ShouldNotBeNull(); From a1e423a2fd2fd60a2ac72c703c17b8c36d7c071a Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Wed, 7 Aug 2024 08:51:26 +0700 Subject: [PATCH 36/41] increase timeout waiting for pods to be ready --- .github/workflows/k8s-action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index c628c1136..5562f0451 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -31,8 +31,8 @@ jobs: kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.0/cert-manager.yaml kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (cert-manager, webhook)' -n cert-manager kubectl apply -k ./deployment/gha - kubectl wait --for=condition=Ready --timeout=90s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot - kubectl wait --for=condition=Ready --timeout=90s pod -l 'app.kubernetes.io/component=controller' -n languagedepot + kubectl wait --for=condition=Ready --timeout=120s pod -l 'app.kubernetes.io/component=controller' -n languagedepot + kubectl wait --for=condition=Ready --timeout=120s pod -l 'app in (lexbox, ui, hg, db)' -n languagedepot - name: status if: failure() run: | From 9c896a24e1163462ee9b18c7d559f126d8da3283 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Wed, 14 Aug 2024 15:30:46 +0700 Subject: [PATCH 37/41] update Chorus version to fix issue with resumable not respecting port numbers --- backend/Testing/Testing.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Testing/Testing.csproj b/backend/Testing/Testing.csproj index ad8c978be..b416bb438 100644 --- a/backend/Testing/Testing.csproj +++ b/backend/Testing/Testing.csproj @@ -15,7 +15,7 @@ - + From cb08ad223389904bc2537720f0917bbf8fd7db61 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Wed, 14 Aug 2024 15:42:14 +0700 Subject: [PATCH 38/41] include flakey tests in self contained integration tests --- .github/workflows/k8s-action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/k8s-action.yaml index 5562f0451..287a664c8 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/k8s-action.yaml @@ -54,5 +54,5 @@ jobs: TEST_RESUMABLE_HG_HOSTNAME: 'resumable.localhost:6579' TEST_PROJECT_CODE: 'sena-3' TEST_DEFAULT_PASSWORD: 'pass' - run: dotnet test LexBoxOnly.slnf --logger GitHubActions --filter Category=Integration --blame-hang-timeout 40m + run: dotnet test LexBoxOnly.slnf --logger GitHubActions --filter "Category=Integration|Category=FlakyIntegration" --blame-hang-timeout 40m From 949374bccede2088c437e6eb2048b1d269cd4698 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Thu, 15 Aug 2024 13:47:39 +0700 Subject: [PATCH 39/41] setup integration tests to run after pr builds or push to develop. --- .github/workflows/develop-api.yaml | 8 +++++++ ...-action.yaml => integration-test-gha.yaml} | 22 ++++++++++++++----- deployment/gha/kustomization.yaml | 6 +++++ 3 files changed, 31 insertions(+), 5 deletions(-) rename .github/workflows/{k8s-action.yaml => integration-test-gha.yaml} (77%) diff --git a/.github/workflows/develop-api.yaml b/.github/workflows/develop-api.yaml index 6b643c7ae..a667a4fa5 100644 --- a/.github/workflows/develop-api.yaml +++ b/.github/workflows/develop-api.yaml @@ -51,6 +51,14 @@ jobs: k8s-environment: develop deploy-domain: lexbox.dev.languagetechnology.org + integration-test-gha: + name: Self hosted integration tests + needs: [build-api, set-version] + uses: ./.github/workflows/integration-test-gha.yaml + with: + lexbox-api-tag: ${{ needs.set-version.outputs.version }} + + integration-tests: name: Integration tests concurrency: develop diff --git a/.github/workflows/k8s-action.yaml b/.github/workflows/integration-test-gha.yaml similarity index 77% rename from .github/workflows/k8s-action.yaml rename to .github/workflows/integration-test-gha.yaml index 287a664c8..f77a1c294 100644 --- a/.github/workflows/k8s-action.yaml +++ b/.github/workflows/integration-test-gha.yaml @@ -1,10 +1,18 @@ name: Self contained integration tests on: workflow_dispatch: - pull_request: - branches: - - develop - + inputs: + lexbox-api-tag: + description: 'The version of lexbox-api to test' + default: 'develop' + required: true + workflow_call: + inputs: + lexbox-api-tag: + description: 'The version of lexbox-api to test' + default: 'develop' + type: string + required: true jobs: execute: @@ -25,6 +33,10 @@ jobs: run: | kubectl cluster-info kubectl get nodes + - name: Update image lexbox-api version + uses: mikefarah/yq@0b34c9a00de1c575a34eea05af1d956a525c4fc1 # v4.34.2 + with: + cmd: yq eval -i '(.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-api").newTag) = "${{ inputs.lexbox-api-tag }"' "./deployment/gha/kustomization.yaml" - name: deploy run: | kubectl create namespace languagedepot @@ -47,7 +59,7 @@ jobs: run: curl -v http://localhost:6579 - name: build run: dotnet restore LexBoxOnly.slnf && dotnet build --no-restore LexBoxOnly.slnf - - name: test + - name: Dotnet test env: TEST_SERVER_HOSTNAME: 'localhost:6579' TEST_STANDARD_HG_HOSTNAME: 'hg.localhost:6579' diff --git a/deployment/gha/kustomization.yaml b/deployment/gha/kustomization.yaml index d4fd2042e..d3a7091e4 100644 --- a/deployment/gha/kustomization.yaml +++ b/deployment/gha/kustomization.yaml @@ -16,3 +16,9 @@ patches: images: - name: local-dev-init #revert change made by local-dev patch newName: busybox + - name: ghcr.io/sillsdev/lexbox-api + newTag: develop #will be replaced by workflow + - name: ghcr.io/sillsdev/lexbox-ui + newTag: develop + - name: ghcr.io/sillsdev/lexbox-hgweb + newTag: latest From 29e682a4f076ed6d603a9bce0969b2d4050a5e3c Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Thu, 15 Aug 2024 13:49:30 +0700 Subject: [PATCH 40/41] fix syntax of variable replacement --- .github/workflows/integration-test-gha.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test-gha.yaml b/.github/workflows/integration-test-gha.yaml index f77a1c294..162b88ce6 100644 --- a/.github/workflows/integration-test-gha.yaml +++ b/.github/workflows/integration-test-gha.yaml @@ -36,7 +36,7 @@ jobs: - name: Update image lexbox-api version uses: mikefarah/yq@0b34c9a00de1c575a34eea05af1d956a525c4fc1 # v4.34.2 with: - cmd: yq eval -i '(.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-api").newTag) = "${{ inputs.lexbox-api-tag }"' "./deployment/gha/kustomization.yaml" + cmd: yq eval -i '(.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-api").newTag) = "${{ inputs.lexbox-api-tag }}"' "./deployment/gha/kustomization.yaml" - name: deploy run: | kubectl create namespace languagedepot From 3306112b37225cc3e47682b48f0e4d5b98efc2d1 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Fri, 16 Aug 2024 09:56:19 +0700 Subject: [PATCH 41/41] disable self hosted integration tests since they're flakey --- .github/workflows/develop-api.yaml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/develop-api.yaml b/.github/workflows/develop-api.yaml index a667a4fa5..f499f0fef 100644 --- a/.github/workflows/develop-api.yaml +++ b/.github/workflows/develop-api.yaml @@ -59,15 +59,16 @@ jobs: lexbox-api-tag: ${{ needs.set-version.outputs.version }} - integration-tests: - name: Integration tests - concurrency: develop - uses: ./.github/workflows/integration-test.yaml - permissions: - checks: write - secrets: inherit - needs: deploy-api - with: - environment: develop - runs-on: self-hosted - hg-version: 6 + # for now disabling integration tests on self hosted since they're flaky, depend on tests in gha above +# integration-tests: +# name: Integration tests +# concurrency: develop +# uses: ./.github/workflows/integration-test.yaml +# permissions: +# checks: write +# secrets: inherit +# needs: deploy-api +# with: +# environment: develop +# runs-on: self-hosted +# hg-version: 6