From 7fdad3ce284a91d3ccb588a34a4a59b84fc7509d Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Mon, 12 Aug 2024 09:47:47 -0300 Subject: [PATCH 01/19] add workflow --- .github/workflows/pr-checks.yaml | 38 ++++++++++++++++++++++++++++ charts/tracetest-core/values.yaml | 1 + scripts/setup_kind_cluster.sh | 25 ++++++++++++++++--- values-kind-ci.yaml | 41 +++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/pr-checks.yaml create mode 100644 values-kind-ci.yaml diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml new file mode 100644 index 00000000..0dc771ac --- /dev/null +++ b/.github/workflows/pr-checks.yaml @@ -0,0 +1,38 @@ +name: Create Cluster + +on: pull_request + +jobs: + create-cluster: + runs-on: ubuntu-latest + env: + TRACETEST_LICENSE: ${{ secrets.TRACETEST_ONPREM_TEST_LICENSE }} + AGENT_API_KEY: ${{ secrets.AGENT_API_KEY }} + AGENT_ENV_ID: ${{ secrets.AGENT_ENV_ID }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup KinD + uses: helm/kind-action@v1 + with: + cluster_name: tracetest + # install_only: true + + - name: Test public images + run: | + kubectl config get-contexts + ./scripts/setup_kind_cluster.sh --ci --build-deps --install-demo --force-setup + + helm install cloudagent -n default ./charts/tracetest-agent --set agent.apiKey="$AGENT_API_KEY" --set agent.environmentId="$AGENT_ENV_ID" + + kubectl wait --for=condition=available --timeout=60s deployment/cloudagent-tracetest-agent + echo "Cloudagent deployed" + + kubectl wait --for=condition=available --timeout=60s deployment/tt-tracetest-core-api + kubectl logs deployment/tt-tracetest-core-api + kubectl logs deployment/cloudagent-tracetest-agent + kubectl get cm tt-tracetest-core -o yaml + + sleep 600 diff --git a/charts/tracetest-core/values.yaml b/charts/tracetest-core/values.yaml index 6772c493..09436825 100644 --- a/charts/tracetest-core/values.yaml +++ b/charts/tracetest-core/values.yaml @@ -34,6 +34,7 @@ config: sampling: 50 analytics: false + # collectorEndpoint: "some-collector.namespace:4317" server: httpPort: *httpPort diff --git a/scripts/setup_kind_cluster.sh b/scripts/setup_kind_cluster.sh index a8d9aa93..f194a067 100755 --- a/scripts/setup_kind_cluster.sh +++ b/scripts/setup_kind_cluster.sh @@ -5,6 +5,7 @@ set -e function show_help() { echo "Usage: setup_kind_cluster.sh [OPTIONS]" echo "Options:" + echo " --ci Setup cluster for a CI environment" echo " --reset Reset the existing kind cluster" echo " --private Use private repositories. Requires a PAT with read:packages scope." echo " --build-deps Build dependencies for all charts" @@ -26,6 +27,11 @@ PROJECT_ROOT=$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)") KUBECONFIG_FILE=$PROJECT_ROOT/tracetest.kubeconfig ENV_FILE=$PROJECT_ROOT/cluster.env HELM_EXTRA_FLAGS=() +VALUES_FILE=values-kind.yaml + +if [[ "$@" == *"--ci"* ]]; then + VALUES_FILE=values-kind-ci.yaml +fi if [[ "$@" == *"--debug"* ]]; then set -x @@ -68,12 +74,23 @@ else printf "\n\e[1mCluster already exists\e[0m\n" fi -cat < $ENV_FILE +# the kind cluster might have been created from outside this script, as in CI pipelines. +# if that's the case, leave kubeconfig alone +if [[ -f $KUBECONFIG_FILE ]]; then + cat < $ENV_FILE export KUBECONFIG=$KUBECONFIG:$KUBECONFIG_FILE kubectl config use-context kind-tracetest EOF -source $ENV_FILE + source $ENV_FILE +else + printf "\n\e[43m\e[1mCustom Kubeconfig file not detected, use default kubectl config\e[0m\e[0m\n" +fi + +if [[ "$@" == *"--force-setup"* ]]; then + printf "\n\e[43m\e[1mForce setup flag detected\e[0m\e[0m\n" + SETUP_CLUSTER=true +fi if [[ "$SETUP_CLUSTER" == true ]]; then @@ -116,10 +133,10 @@ fi printf "\n\e[42m\e[1mStarting Tracetest OnPrem components installation\e[0m\e[0m\n" printf "\n\e[42m\e[1mInstalling Tracetest dependencies\e[0m\e[0m\n" -helm upgrade --install ttdeps $PROJECT_ROOT/charts/tracetest-dependencies -f $PROJECT_ROOT/values-kind.yaml "${HELM_EXTRA_FLAGS[@]}" +helm upgrade --install ttdeps $PROJECT_ROOT/charts/tracetest-dependencies -f $PROJECT_ROOT/$VALUES_FILE "${HELM_EXTRA_FLAGS[@]}" printf "\n\e[42m\e[1mInstalling Tracetest on-prem\e[0m\e[0m\n" -helm upgrade --install tt $PROJECT_ROOT/charts/tracetest-onprem -f $PROJECT_ROOT/values-kind.yaml "${HELM_EXTRA_FLAGS[@]}" +helm upgrade --install tt $PROJECT_ROOT/charts/tracetest-onprem -f $PROJECT_ROOT/$VALUES_FILE "${HELM_EXTRA_FLAGS[@]}" if [[ "$@" == *"--install-demo"* ]]; then printf "\n\e[42m\e[1mInstalling Pokeshop demo\e[0m\e[0m\n" diff --git a/values-kind-ci.yaml b/values-kind-ci.yaml new file mode 100644 index 00000000..1a07ae1d --- /dev/null +++ b/values-kind-ci.yaml @@ -0,0 +1,41 @@ +global: + validCertificate: false + urls: + rootDomain: &rootDomain "tracetest.localdev" + + postgresql: + auth: + host: "ttdeps-postgresql" + username: "postgres" + password: "postgres" + database: "tracetest" + + mongodb: + auth: + protocol: "mongodb" + host: "ttdeps-tracetest-dependencies-mongodb" + username: "mongodb" + password: "mongodb" + database: "tracetest" + options: + retryWrites: "true" + authSource: admin + + +traefik: + service: + type: NodePort + + dnsNames: + - *rootDomain + - "pokeshop.localdev" + + tls: + issuerRef: + name: issuer-selfsigned + kind: ClusterIssuer + group: cert-manager.io + +tracetest-core: + config: + collectorEndpoint: "cloudagent-tracetest-agent.default:4317" \ No newline at end of file From 08ff329585aaa28735cbe5c211ff6d3ce1c3b557 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 4 Sep 2024 16:24:29 -0300 Subject: [PATCH 02/19] implement workflow add org id remove unused step save output fix try again fix add tracetest cli step; test run other tests add env id upadte path add variableset tests fix revert run all suites; test each feature individually run all, one by one disable disable --- .github/workflows/pr-checks.yaml | 87 +++++++++++++++++-- .gitignore | 4 +- .../tracetest-agent/templates/deployment.yaml | 3 + kind-config.yaml | 2 - tests/vars/ci.yaml | 25 ++++++ values-kind-ci.yaml | 5 +- 6 files changed, 114 insertions(+), 12 deletions(-) create mode 100644 tests/vars/ci.yaml diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 0dc771ac..494059cb 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -9,6 +9,7 @@ jobs: TRACETEST_LICENSE: ${{ secrets.TRACETEST_ONPREM_TEST_LICENSE }} AGENT_API_KEY: ${{ secrets.AGENT_API_KEY }} AGENT_ENV_ID: ${{ secrets.AGENT_ENV_ID }} + TESTS_REPO_DIR: "/tmp/tests" steps: - name: Checkout @@ -18,21 +19,93 @@ jobs: uses: helm/kind-action@v1 with: cluster_name: tracetest - # install_only: true + install_only: true - name: Test public images run: | kubectl config get-contexts ./scripts/setup_kind_cluster.sh --ci --build-deps --install-demo --force-setup + + kind get kubeconfig --name tracetest > ~/.kube/config - helm install cloudagent -n default ./charts/tracetest-agent --set agent.apiKey="$AGENT_API_KEY" --set agent.environmentId="$AGENT_ENV_ID" + helm upgrade --install cloudagent ./charts/tracetest-agent \ + -n default \ + --set agent.apiKey="$AGENT_API_KEY" \ + --set agent.environmentId="$AGENT_ENV_ID" kubectl wait --for=condition=available --timeout=60s deployment/cloudagent-tracetest-agent echo "Cloudagent deployed" - kubectl wait --for=condition=available --timeout=60s deployment/tt-tracetest-core-api - kubectl logs deployment/tt-tracetest-core-api - kubectl logs deployment/cloudagent-tracetest-agent - kubectl get cm tt-tracetest-core -o yaml + - name: Configure Custom DNS + run: | + # setup custom DNS resolve + sudo echo "127.0.0.1 tracetest.localdev" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 pokeshop.localdev" | sudo tee -a /etc/hosts + + - name: Install Playwright + run: | + npx playwright install --with-deps + + - name: Configure intial org and env + env: + TRACETEST_TEST_REPO_CLONE_PAT: ${{ secrets.TRACETEST_TEST_REPO_CLONE_PAT }} + TRACETEST_TEST_REPO: ${{ secrets.TRACETEST_TEST_REPO }} + GH_USERNAME: ${{ secrets.TRACETEST_USER_GH_USERNAME }} + GH_PASSWORD: ${{ secrets.TRACETEST_USER_GH_PASSWORD }} + GH_SECRET: ${{ secrets.TRACETEST_USER_GH_SECRET }} + TRACETEST_ENDPOINT: https://tracetest.localdev:30000/ + OUTPUT_TOKEN_FILE: "/tmp/token.json" + run: | + BASEDIR=$(pwd) + + # sparse checkout of the testing directory + git clone --depth 1 --filter=blob:none --sparse https://$TRACETEST_TEST_REPO_CLONE_PAT@github.com/$TRACETEST_TEST_REPO.git $TESTS_REPO_DIR + cd $TESTS_REPO_DIR + git sparse-checkout init --cone + git sparse-checkout set testing + + cd testing/e2e-tracetesting + + + npm install + npx playwright test tests/setup/extract-default-token.manual.ts --grep '@manual' + + ############################################ + ############################################ + + cd $BASEDIR + + # run script for initial configuration + + export VARS_TOKEN=$(cat $OUTPUT_TOKEN_FILE | jq -r '.token') + sed -i 's/%TOKEN_PLACEHOLDER%/'"$VARS_TOKEN"'/g' tests/vars/ci.yaml + + export VARS_ORG_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.orgId') + sed -i 's/%ORG_ID_PLACEHOLDER%/'"$VARS_ORG_ID"'/g' tests/vars/ci.yaml + + export VARS_ENV_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.envId') + sed -i 's/%ENV_ID_PLACEHOLDER%/'"$VARS_ENV_ID"'/g' tests/vars/ci.yaml + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-output + path: /tmp/tests/ + + - name: Configure Tracetest CLI + uses: kubeshop/tracetest-github-action@v1 + with: + token: ${{secrets.TRACETEST_CLI_TOKEN}} + + - name: run tracetests + run: | + # tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features --vars ./tests/vars/ci.yaml - sleep 600 + #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/enviromment_tokens --vars ./tests/vars/ci.yaml + #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environment_members --vars ./tests/vars/ci.yaml + tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environments --vars ./tests/vars/ci.yaml + tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organization_invites --vars ./tests/vars/ci.yaml + tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organizations --vars ./tests/vars/ci.yaml + tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/polling_profiles --vars ./tests/vars/ci.yaml + tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/tests --vars ./tests/vars/ci.yaml + tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/variable_sets --vars ./tests/vars/ci.yaml diff --git a/.gitignore b/.gitignore index f2cdfe08..567ba1ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ **/*/Chart.lock **/*/charts/* cluster.env -tracetest.kubeconfig -.env +*.env +*tracetest.kubeconfig *.bkp \ No newline at end of file diff --git a/charts/tracetest-agent/templates/deployment.yaml b/charts/tracetest-agent/templates/deployment.yaml index 1d80e71f..d3e2d4d2 100644 --- a/charts/tracetest-agent/templates/deployment.yaml +++ b/charts/tracetest-agent/templates/deployment.yaml @@ -22,6 +22,9 @@ spec: imagePullPolicy: IfNotPresent args: [ + "--mode", "ci", + "-v", + {{- if .Values.agent.environmentId }} "--environment", "{{ .Values.agent.environmentId }}", diff --git a/kind-config.yaml b/kind-config.yaml index b246b17e..c4e3c366 100644 --- a/kind-config.yaml +++ b/kind-config.yaml @@ -6,6 +6,4 @@ nodes: - containerPort: 30000 hostPort: 30000 protocol: TCP -- role: worker -- role: worker - role: worker \ No newline at end of file diff --git a/tests/vars/ci.yaml b/tests/vars/ci.yaml new file mode 100644 index 00000000..59b140de --- /dev/null +++ b/tests/vars/ci.yaml @@ -0,0 +1,25 @@ +type: VariableSet +spec: + id: helm-ci + name: Helm CI + values: + - key: BASE_URL + value: https://tracetest.localdev:30000 + type: raw + - key: TOKEN + value: "%TOKEN_PLACEHOLDER%" + type: raw + - key: ORG_ID + value: "%ORG_ID_PLACEHOLDER%" + type: raw + - key: ENV_ID + value: "%ENV_ID_PLACEHOLDER%" + type: raw + - key: POKESHOP_URL + value: https://pokeshop.localdev:30000 + type: raw + # This placeholder exists because when we try to run the tests testsuite, + # the cli will ask for the + - key: CREATED_TEST_ID + value: PLACEHOLDER + type: raw diff --git a/values-kind-ci.yaml b/values-kind-ci.yaml index 1a07ae1d..f664aaa8 100644 --- a/values-kind-ci.yaml +++ b/values-kind-ci.yaml @@ -38,4 +38,7 @@ traefik: tracetest-core: config: - collectorEndpoint: "cloudagent-tracetest-agent.default:4317" \ No newline at end of file + telemetry: + enabled: true + collector: + endpoint: "cloudagent-tracetest-agent.default:4318" \ No newline at end of file From 6b5c2fcfe8063dd3b1172a1ed6569272c2a47a22 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Thu, 19 Sep 2024 10:20:55 -0300 Subject: [PATCH 03/19] use branch --- .github/workflows/pr-checks.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 494059cb..12b6547a 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -59,10 +59,12 @@ jobs: BASEDIR=$(pwd) # sparse checkout of the testing directory - git clone --depth 1 --filter=blob:none --sparse https://$TRACETEST_TEST_REPO_CLONE_PAT@github.com/$TRACETEST_TEST_REPO.git $TESTS_REPO_DIR + git clone https://$TRACETEST_TEST_REPO_CLONE_PAT@github.com/$TRACETEST_TEST_REPO.git $TESTS_REPO_DIR cd $TESTS_REPO_DIR - git sparse-checkout init --cone - git sparse-checkout set testing + + #TODO USE MAIN + git fetch origin fix-tests + git switch fix-tests cd testing/e2e-tracetesting @@ -101,11 +103,11 @@ jobs: run: | # tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features --vars ./tests/vars/ci.yaml - #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/enviromment_tokens --vars ./tests/vars/ci.yaml + tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/enviromment_tokens --vars ./tests/vars/ci.yaml #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environment_members --vars ./tests/vars/ci.yaml - tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environments --vars ./tests/vars/ci.yaml - tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organization_invites --vars ./tests/vars/ci.yaml - tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organizations --vars ./tests/vars/ci.yaml + #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environments --vars ./tests/vars/ci.yaml + #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organization_invites --vars ./tests/vars/ci.yaml + #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organizations --vars ./tests/vars/ci.yaml tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/polling_profiles --vars ./tests/vars/ci.yaml tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/tests --vars ./tests/vars/ci.yaml - tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/variable_sets --vars ./tests/vars/ci.yaml + #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/variable_sets --vars ./tests/vars/ci.yaml From ced7aace80a5405b5849b347da490f6c7776cc4e Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Thu, 19 Sep 2024 14:21:07 -0300 Subject: [PATCH 04/19] add instr5umentation for services --- tests/vars/ci.yaml | 6 +++--- values-kind-ci.yaml | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/vars/ci.yaml b/tests/vars/ci.yaml index 59b140de..3e2276dc 100644 --- a/tests/vars/ci.yaml +++ b/tests/vars/ci.yaml @@ -7,13 +7,13 @@ spec: value: https://tracetest.localdev:30000 type: raw - key: TOKEN - value: "%TOKEN_PLACEHOLDER%" + value: "LfUFWNRNR" type: raw - key: ORG_ID - value: "%ORG_ID_PLACEHOLDER%" + value: "x8FZHRNR" type: raw - key: ENV_ID - value: "%ENV_ID_PLACEHOLDER%" + value: "ttenv_7892386645cf2885" type: raw - key: POKESHOP_URL value: https://pokeshop.localdev:30000 diff --git a/values-kind-ci.yaml b/values-kind-ci.yaml index f664aaa8..5fbfb2a3 100644 --- a/values-kind-ci.yaml +++ b/values-kind-ci.yaml @@ -41,4 +41,23 @@ tracetest-core: telemetry: enabled: true collector: - endpoint: "cloudagent-tracetest-agent.default:4318" \ No newline at end of file + endpoint: "cloudagent-tracetest-agent.default:4318" + +tracetest-cloud: + config: + telemetry: + enabled: true + collector: + endpoint: "cloudagent-tracetest-agent.default:4317" + +tracetest-agent-operator: + config: + telemetry: + collector: + endpoint: "cloudagent-tracetest-agent.default:4317" + +tracetest-monitor-operator: + config: + telemetry: + collector: + endpoint: "cloudagent-tracetest-agent.default:4317" \ No newline at end of file From 1ca704c2e6f1d69fe4a03807df68a54ed701643a Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 12:17:45 -0300 Subject: [PATCH 05/19] fix scripts --- .github/workflows/pr-checks.yaml | 51 ++------------------------------ scripts/prepare_ci_env.sh | 38 ++++++++++++++++++++++++ scripts/setup_kind_cluster.sh | 21 +++++++++++++ tests/vars/ci.yaml | 11 +++++-- 4 files changed, 70 insertions(+), 51 deletions(-) create mode 100755 scripts/prepare_ci_env.sh diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 12b6547a..7d11b7db 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -28,11 +28,6 @@ jobs: kind get kubeconfig --name tracetest > ~/.kube/config - helm upgrade --install cloudagent ./charts/tracetest-agent \ - -n default \ - --set agent.apiKey="$AGENT_API_KEY" \ - --set agent.environmentId="$AGENT_ENV_ID" - kubectl wait --for=condition=available --timeout=60s deployment/cloudagent-tracetest-agent echo "Cloudagent deployed" @@ -60,39 +55,8 @@ jobs: # sparse checkout of the testing directory git clone https://$TRACETEST_TEST_REPO_CLONE_PAT@github.com/$TRACETEST_TEST_REPO.git $TESTS_REPO_DIR - cd $TESTS_REPO_DIR - - #TODO USE MAIN - git fetch origin fix-tests - git switch fix-tests - - cd testing/e2e-tracetesting - - - npm install - npx playwright test tests/setup/extract-default-token.manual.ts --grep '@manual' - - ############################################ - ############################################ - - cd $BASEDIR - - # run script for initial configuration - - export VARS_TOKEN=$(cat $OUTPUT_TOKEN_FILE | jq -r '.token') - sed -i 's/%TOKEN_PLACEHOLDER%/'"$VARS_TOKEN"'/g' tests/vars/ci.yaml - - export VARS_ORG_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.orgId') - sed -i 's/%ORG_ID_PLACEHOLDER%/'"$VARS_ORG_ID"'/g' tests/vars/ci.yaml - - export VARS_ENV_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.envId') - sed -i 's/%ENV_ID_PLACEHOLDER%/'"$VARS_ENV_ID"'/g' tests/vars/ci.yaml - - - uses: actions/upload-artifact@v4 - if: always() - with: - name: test-output - path: /tmp/tests/ + + ./scripts/prepare_ci_env.sh - name: Configure Tracetest CLI uses: kubeshop/tracetest-github-action@v1 @@ -101,13 +65,4 @@ jobs: - name: run tracetests run: | - # tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features --vars ./tests/vars/ci.yaml - - tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/enviromment_tokens --vars ./tests/vars/ci.yaml - #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environment_members --vars ./tests/vars/ci.yaml - #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environments --vars ./tests/vars/ci.yaml - #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organization_invites --vars ./tests/vars/ci.yaml - #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organizations --vars ./tests/vars/ci.yaml - tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/polling_profiles --vars ./tests/vars/ci.yaml - tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/tests --vars ./tests/vars/ci.yaml - #tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/variable_sets --vars ./tests/vars/ci.yaml + tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features --vars ./tests/vars/ci.yaml \ No newline at end of file diff --git a/scripts/prepare_ci_env.sh b/scripts/prepare_ci_env.sh new file mode 100755 index 00000000..b60533fc --- /dev/null +++ b/scripts/prepare_ci_env.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +BASE_DIR=$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)") +echo $BASE_DIR +exit + +if [ -z "$TEST_REPO_DIR" ]; then + echo "Error: TEST_REPO_DIR is not set." + exit 1 +fi + +cd $TEST_REPO_DIR/testing/e2e-tracetesting + + +npm install +npx playwright test tests/setup/extract-default-token.manual.ts --grep '@manual' + +############################################ +############################################ + +cd $BASEDIR + +# run script for initial configuration + +export VARS_TOKEN=$(cat $OUTPUT_TOKEN_FILE | jq -r '.token') +sed -i 's/%TOKEN_PLACEHOLDER%/'"$VARS_TOKEN"'/g' tests/vars/ci.yaml + +export VARS_ORG_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.orgId') +sed -i 's/%ORG_ID_PLACEHOLDER%/'"$VARS_ORG_ID"'/g' tests/vars/ci.yaml + +export VARS_ENV_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.envId') +sed -i 's/%ENV_ID_PLACEHOLDER%/'"$VARS_ENV_ID"'/g' tests/vars/ci.yaml + +export VARS_COOKIE=$(cat $OUTPUT_TOKEN_FILE | jq -r '.cookieHeader') +sed -i 's/%COOKIE_PLACEHOLDER%/'"$VARS_COOKIE"'/g' tests/vars/ci.yaml + +export VARS_INVITE_EMAIL=$(cat $OUTPUT_TOKEN_FILE | jq -r '.inviteEmail') +sed -i 's/%INVITE_EMAIL_PLACEHOLDER%/'"$VARS_INVITE_EMAIL"'/g' tests/vars/ci.yaml \ No newline at end of file diff --git a/scripts/setup_kind_cluster.sh b/scripts/setup_kind_cluster.sh index f194a067..ee5b6e8c 100755 --- a/scripts/setup_kind_cluster.sh +++ b/scripts/setup_kind_cluster.sh @@ -154,6 +154,27 @@ if [[ "$SETUP_CLUSTER" == true || "$@" == *"--config-coredns"* ]]; then printf "\n" fi +if [[ "$@" == *"--ci"* ]]; then + printf "\n\e[42m\e[1mInstalling CI Agent\e[0m\e[0m\n" + # Validate required environment variables + if [[ -z "$AGENT_API_KEY" ]]; then + printf "\e[41mError: AGENT_API_KEY environment variable is not set\e[0m\n" + exit 1 + fi + + if [[ -z "$AGENT_ENV_ID" ]]; then + printf "\e[41mError: AGENT_ENV_ID environment variable is not set\e[0m\n" + exit 1 + fi + + helm upgrade --install cloudagent ./charts/tracetest-agent \ + -n default \ + --set agent.apiKey="$AGENT_API_KEY" \ + --set agent.environmentId="$AGENT_ENV_ID" + + printf "\n" +fi + # Capturing the end time end_time=$(date +%s) diff --git a/tests/vars/ci.yaml b/tests/vars/ci.yaml index 3e2276dc..2dba127d 100644 --- a/tests/vars/ci.yaml +++ b/tests/vars/ci.yaml @@ -7,13 +7,18 @@ spec: value: https://tracetest.localdev:30000 type: raw - key: TOKEN - value: "LfUFWNRNR" + value: "%TOKEN_PLACEHOLDER%" + type: raw + - key: INVITE_EMAIL + value: "%INVITE_EMAIL_PLACEHOLDER%" + - key: INVITED_COOKIE + value: "%COOKIE_PLACEHOLDER%" type: raw - key: ORG_ID - value: "x8FZHRNR" + value: "%ORG_ID_PLACEHOLDER%" type: raw - key: ENV_ID - value: "ttenv_7892386645cf2885" + value: "%ENV_ID_PLACEHOLDER%" type: raw - key: POKESHOP_URL value: https://pokeshop.localdev:30000 From c37a736124abfac3ec562f8840b811d80ff62835 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 12:33:20 -0300 Subject: [PATCH 06/19] fix script --- scripts/prepare_ci_env.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/prepare_ci_env.sh b/scripts/prepare_ci_env.sh index b60533fc..cea290fa 100755 --- a/scripts/prepare_ci_env.sh +++ b/scripts/prepare_ci_env.sh @@ -1,38 +1,43 @@ #!/bin/bash BASE_DIR=$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)") -echo $BASE_DIR -exit if [ -z "$TEST_REPO_DIR" ]; then echo "Error: TEST_REPO_DIR is not set." exit 1 fi +if [ -z "$OUTPUT_TOKEN_FILE" ]; then + echo "Error: OUTPUT_TOKEN_FILE is not set." + exit 1 +fi + + + cd $TEST_REPO_DIR/testing/e2e-tracetesting -npm install -npx playwright test tests/setup/extract-default-token.manual.ts --grep '@manual' +# npm install +# npx playwright test tests/setup/extract-default-token.manual.ts --grep '@manual' ############################################ ############################################ -cd $BASEDIR +cd $BASE_DIR # run script for initial configuration export VARS_TOKEN=$(cat $OUTPUT_TOKEN_FILE | jq -r '.token') -sed -i 's/%TOKEN_PLACEHOLDER%/'"$VARS_TOKEN"'/g' tests/vars/ci.yaml +sed -i.bkp 's/%TOKEN_PLACEHOLDER%/'"$VARS_TOKEN"'/g' tests/vars/ci.yaml export VARS_ORG_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.orgId') -sed -i 's/%ORG_ID_PLACEHOLDER%/'"$VARS_ORG_ID"'/g' tests/vars/ci.yaml +sed -i.bkp 's/%ORG_ID_PLACEHOLDER%/'"$VARS_ORG_ID"'/g' tests/vars/ci.yaml export VARS_ENV_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.envId') -sed -i 's/%ENV_ID_PLACEHOLDER%/'"$VARS_ENV_ID"'/g' tests/vars/ci.yaml +sed -i.bkp 's/%ENV_ID_PLACEHOLDER%/'"$VARS_ENV_ID"'/g' tests/vars/ci.yaml export VARS_COOKIE=$(cat $OUTPUT_TOKEN_FILE | jq -r '.cookieHeader') -sed -i 's/%COOKIE_PLACEHOLDER%/'"$VARS_COOKIE"'/g' tests/vars/ci.yaml +sed -i.bkp 's/%COOKIE_PLACEHOLDER%/'"$VARS_COOKIE"'/g' tests/vars/ci.yaml export VARS_INVITE_EMAIL=$(cat $OUTPUT_TOKEN_FILE | jq -r '.inviteEmail') -sed -i 's/%INVITE_EMAIL_PLACEHOLDER%/'"$VARS_INVITE_EMAIL"'/g' tests/vars/ci.yaml \ No newline at end of file +sed -i.bkp 's/%INVITE_EMAIL_PLACEHOLDER%/'"$VARS_INVITE_EMAIL"'/g' tests/vars/ci.yaml \ No newline at end of file From 458008f583f208d1c404f86c9cde673e72c35402 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 15:24:54 -0300 Subject: [PATCH 07/19] more fixes --- .github/workflows/pr-checks.yaml | 3 ++- scripts/prepare_ci_env.sh | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 7d11b7db..cce2b809 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -54,7 +54,8 @@ jobs: BASEDIR=$(pwd) # sparse checkout of the testing directory - git clone https://$TRACETEST_TEST_REPO_CLONE_PAT@github.com/$TRACETEST_TEST_REPO.git $TESTS_REPO_DIR + git clone --depth 1 --filter=blob:none --sparse https://$TRACETEST_TEST_REPO_CLONE_PAT@github.com/$TRACETEST_TEST_REPO.git $TESTS_REPO_DIR + git sparse-checkout set testing/ ./scripts/prepare_ci_env.sh diff --git a/scripts/prepare_ci_env.sh b/scripts/prepare_ci_env.sh index cea290fa..42a6458a 100755 --- a/scripts/prepare_ci_env.sh +++ b/scripts/prepare_ci_env.sh @@ -16,9 +16,10 @@ fi cd $TEST_REPO_DIR/testing/e2e-tracetesting - -# npm install -# npx playwright test tests/setup/extract-default-token.manual.ts --grep '@manual' +if [[ "$*" != *"--skip-playwright"* ]]; then + npm install + npx playwright test tests/setup/extract-default-token.manual.ts --grep '@manual' +fi ############################################ ############################################ @@ -36,7 +37,7 @@ sed -i.bkp 's/%ORG_ID_PLACEHOLDER%/'"$VARS_ORG_ID"'/g' tests/vars/ci.yaml export VARS_ENV_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.envId') sed -i.bkp 's/%ENV_ID_PLACEHOLDER%/'"$VARS_ENV_ID"'/g' tests/vars/ci.yaml -export VARS_COOKIE=$(cat $OUTPUT_TOKEN_FILE | jq -r '.cookieHeader') +export VARS_COOKIE=$(cat $OUTPUT_TOKEN_FILE | jq -r '.cookieHeader' | sed 's/[&/\]/\\&/g') sed -i.bkp 's/%COOKIE_PLACEHOLDER%/'"$VARS_COOKIE"'/g' tests/vars/ci.yaml export VARS_INVITE_EMAIL=$(cat $OUTPUT_TOKEN_FILE | jq -r '.inviteEmail') From b68ffa4fdb8cf3eb0fddc36238726410ce55976f Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 15:41:21 -0300 Subject: [PATCH 08/19] add secrets --- .github/workflows/pr-checks.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index cce2b809..c13ec3b4 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -3,7 +3,8 @@ name: Create Cluster on: pull_request jobs: - create-cluster: + tracetests: + name: Run tracetests on a KinD cluster runs-on: ubuntu-latest env: TRACETEST_LICENSE: ${{ secrets.TRACETEST_ONPREM_TEST_LICENSE }} @@ -23,7 +24,6 @@ jobs: - name: Test public images run: | - kubectl config get-contexts ./scripts/setup_kind_cluster.sh --ci --build-deps --install-demo --force-setup kind get kubeconfig --name tracetest > ~/.kube/config @@ -48,6 +48,10 @@ jobs: GH_USERNAME: ${{ secrets.TRACETEST_USER_GH_USERNAME }} GH_PASSWORD: ${{ secrets.TRACETEST_USER_GH_PASSWORD }} GH_SECRET: ${{ secrets.TRACETEST_USER_GH_SECRET }} + GH_MEMBER_EMAIL: ${{ secrets.TRACETEST_MEMBER_GH_EMAIL }} + GH_MEMBER_USERNAME: ${{ secrets.TRACETEST_MEMBER_GH_USERNAME }} + GH_MEMBER_PASSWORD: ${{ secrets.TRACETEST_MEMBER_GH_PASSWORD }} + GH_MEMBER_SECRET: ${{ secrets.TRACETEST_MEMBER_GH_SECRET }} TRACETEST_ENDPOINT: https://tracetest.localdev:30000/ OUTPUT_TOKEN_FILE: "/tmp/token.json" run: | From 3edda4ef1500a5cbf23442a1f279fc51a1e31f9d Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 15:46:30 -0300 Subject: [PATCH 09/19] simplify pipeline --- .github/workflows/pr-checks.yaml | 16 +--------------- scripts/setup_ci_host.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 15 deletions(-) create mode 100755 scripts/setup_ci_host.sh diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index c13ec3b4..e3e55ed7 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -25,21 +25,7 @@ jobs: - name: Test public images run: | ./scripts/setup_kind_cluster.sh --ci --build-deps --install-demo --force-setup - - kind get kubeconfig --name tracetest > ~/.kube/config - - kubectl wait --for=condition=available --timeout=60s deployment/cloudagent-tracetest-agent - echo "Cloudagent deployed" - - - name: Configure Custom DNS - run: | - # setup custom DNS resolve - sudo echo "127.0.0.1 tracetest.localdev" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 pokeshop.localdev" | sudo tee -a /etc/hosts - - - name: Install Playwright - run: | - npx playwright install --with-deps + ./scripts/setup_ci_host.sh - name: Configure intial org and env env: diff --git a/scripts/setup_ci_host.sh b/scripts/setup_ci_host.sh new file mode 100755 index 00000000..87b457cd --- /dev/null +++ b/scripts/setup_ci_host.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +printf "\n\e[42m\e[1mPersiste kubeconfig file\e[0m\e[0m\n" +kind get kubeconfig --name tracetest > ~/.kube/config + +printf "\n\e[42m\e[1mConfigure host DNS\e[0m\e[0m\n" +# setup custom DNS resolve +sudo echo "127.0.0.1 tracetest.localdev" | sudo tee -a /etc/hosts +sudo echo "127.0.0.1 pokeshop.localdev" | sudo tee -a /etc/hosts + +kubectl wait --for=condition=available --timeout=60s deployment/cloudagent-tracetest-agent +printf "\n\e[42m\e[1mCloudAgent deployed\e[0m\e[0m\n" \ No newline at end of file From 6c65575f2bafc636507bd16aac83bc7d27695eb1 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 15:48:05 -0300 Subject: [PATCH 10/19] fixes --- .github/workflows/pr-checks.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index e3e55ed7..01301042 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -41,13 +41,15 @@ jobs: TRACETEST_ENDPOINT: https://tracetest.localdev:30000/ OUTPUT_TOKEN_FILE: "/tmp/token.json" run: | - BASEDIR=$(pwd) + BASE_DIR=$(pwd) # sparse checkout of the testing directory git clone --depth 1 --filter=blob:none --sparse https://$TRACETEST_TEST_REPO_CLONE_PAT@github.com/$TRACETEST_TEST_REPO.git $TESTS_REPO_DIR + cd $TESTS_REPO_DIR git sparse-checkout set testing/ - ./scripts/prepare_ci_env.sh + + $BASE_DIR/scripts/prepare_ci_env.sh - name: Configure Tracetest CLI uses: kubeshop/tracetest-github-action@v1 From 80761b6d2ac81b598fec899886d2425be325ed7a Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 15:53:56 -0300 Subject: [PATCH 11/19] add debug --- .github/workflows/pr-checks.yaml | 2 +- scripts/prepare_ci_env.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 01301042..85f22087 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -49,7 +49,7 @@ jobs: git sparse-checkout set testing/ - $BASE_DIR/scripts/prepare_ci_env.sh + $BASE_DIR/scripts/prepare_ci_env.sh --debug - name: Configure Tracetest CLI uses: kubeshop/tracetest-github-action@v1 diff --git a/scripts/prepare_ci_env.sh b/scripts/prepare_ci_env.sh index 42a6458a..ea11cf02 100755 --- a/scripts/prepare_ci_env.sh +++ b/scripts/prepare_ci_env.sh @@ -1,5 +1,9 @@ #!/bin/bash +if [[ "$*" == *"--debug"* ]]; then + set -x +fi + BASE_DIR=$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)") if [ -z "$TEST_REPO_DIR" ]; then From d06dccee2a2c9c18eaafd82dc8bf1f9e9cd85f95 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 15:58:42 -0300 Subject: [PATCH 12/19] test --- .github/workflows/pr-checks.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 85f22087..8024ea40 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -10,7 +10,6 @@ jobs: TRACETEST_LICENSE: ${{ secrets.TRACETEST_ONPREM_TEST_LICENSE }} AGENT_API_KEY: ${{ secrets.AGENT_API_KEY }} AGENT_ENV_ID: ${{ secrets.AGENT_ENV_ID }} - TESTS_REPO_DIR: "/tmp/tests" steps: - name: Checkout @@ -40,6 +39,7 @@ jobs: GH_MEMBER_SECRET: ${{ secrets.TRACETEST_MEMBER_GH_SECRET }} TRACETEST_ENDPOINT: https://tracetest.localdev:30000/ OUTPUT_TOKEN_FILE: "/tmp/token.json" + TESTS_REPO_DIR: "/tmp/tests" run: | BASE_DIR=$(pwd) @@ -57,5 +57,7 @@ jobs: token: ${{secrets.TRACETEST_CLI_TOKEN}} - name: run tracetests + env: + TESTS_REPO_DIR: "/tmp/tests" run: | tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features --vars ./tests/vars/ci.yaml \ No newline at end of file From 541110bc757c9b588e0a44be14388800e3e3473e Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 16:03:56 -0300 Subject: [PATCH 13/19] test --- .github/workflows/pr-checks.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 8024ea40..aa38beff 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -49,7 +49,11 @@ jobs: git sparse-checkout set testing/ - $BASE_DIR/scripts/prepare_ci_env.sh --debug + echo $TEST_REPO_DIR + echo $OUTPUT_TOKEN_FILE + TEST_REPO_DIR=$TEST_REPO_DIR \ + OUTPUT_TOKEN_FILE=$OUTPUT_TOKEN_FILE \ + $BASE_DIR/scripts/prepare_ci_env.sh --debug - name: Configure Tracetest CLI uses: kubeshop/tracetest-github-action@v1 From 0147422a86fef66a8c22f5153b0889b499aef8c5 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 16:10:54 -0300 Subject: [PATCH 14/19] fix --- .github/workflows/pr-checks.yaml | 6 +----- scripts/prepare_ci_env.sh | 6 +++--- scripts/setup_kind_cluster.sh | 2 ++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index aa38beff..8024ea40 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -49,11 +49,7 @@ jobs: git sparse-checkout set testing/ - echo $TEST_REPO_DIR - echo $OUTPUT_TOKEN_FILE - TEST_REPO_DIR=$TEST_REPO_DIR \ - OUTPUT_TOKEN_FILE=$OUTPUT_TOKEN_FILE \ - $BASE_DIR/scripts/prepare_ci_env.sh --debug + $BASE_DIR/scripts/prepare_ci_env.sh --debug - name: Configure Tracetest CLI uses: kubeshop/tracetest-github-action@v1 diff --git a/scripts/prepare_ci_env.sh b/scripts/prepare_ci_env.sh index ea11cf02..02e653bb 100755 --- a/scripts/prepare_ci_env.sh +++ b/scripts/prepare_ci_env.sh @@ -6,8 +6,8 @@ fi BASE_DIR=$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)") -if [ -z "$TEST_REPO_DIR" ]; then - echo "Error: TEST_REPO_DIR is not set." +if [ -z "$TESTS_REPO_DIR" ]; then + echo "Error: TESTS_REPO_DIR is not set." exit 1 fi @@ -18,7 +18,7 @@ fi -cd $TEST_REPO_DIR/testing/e2e-tracetesting +cd $TESTS_REPO_DIR/testing/e2e-tracetesting if [[ "$*" != *"--skip-playwright"* ]]; then npm install diff --git a/scripts/setup_kind_cluster.sh b/scripts/setup_kind_cluster.sh index ee5b6e8c..a385ce5f 100755 --- a/scripts/setup_kind_cluster.sh +++ b/scripts/setup_kind_cluster.sh @@ -16,6 +16,8 @@ function show_help() { echo "" echo "Environment variables that might be read:" echo " TRACETEST_LICENSE OnPrem license key (if not provided, the script will prompt for it)" + echo " AGENT_API_KEY Cloud Agent API key" + echo " AGENT_ENV_ID Cloud Agent environment ID" } if [[ "$@" == *"--help"* ]]; then From 6fae03b6091df01a03e34517e2f5b87fe511c60b Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 16:17:54 -0300 Subject: [PATCH 15/19] exit on error --- .github/workflows/pr-checks.yaml | 1 - scripts/prepare_ci_env.sh | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 8024ea40..01aaaaee 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -48,7 +48,6 @@ jobs: cd $TESTS_REPO_DIR git sparse-checkout set testing/ - $BASE_DIR/scripts/prepare_ci_env.sh --debug - name: Configure Tracetest CLI diff --git a/scripts/prepare_ci_env.sh b/scripts/prepare_ci_env.sh index 02e653bb..5852590b 100755 --- a/scripts/prepare_ci_env.sh +++ b/scripts/prepare_ci_env.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + if [[ "$*" == *"--debug"* ]]; then set -x fi From fe12c8088ca652b1fdb206fbf2930a067ee2a9c0 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 17:12:45 -0300 Subject: [PATCH 16/19] save images --- .github/workflows/pr-checks.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 01aaaaee..57f68114 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -7,6 +7,7 @@ jobs: name: Run tracetests on a KinD cluster runs-on: ubuntu-latest env: + TESTS_REPO_DIR: "/tmp/tests" TRACETEST_LICENSE: ${{ secrets.TRACETEST_ONPREM_TEST_LICENSE }} AGENT_API_KEY: ${{ secrets.AGENT_API_KEY }} AGENT_ENV_ID: ${{ secrets.AGENT_ENV_ID }} @@ -39,7 +40,6 @@ jobs: GH_MEMBER_SECRET: ${{ secrets.TRACETEST_MEMBER_GH_SECRET }} TRACETEST_ENDPOINT: https://tracetest.localdev:30000/ OUTPUT_TOKEN_FILE: "/tmp/token.json" - TESTS_REPO_DIR: "/tmp/tests" run: | BASE_DIR=$(pwd) @@ -50,13 +50,19 @@ jobs: $BASE_DIR/scripts/prepare_ci_env.sh --debug + - name: Upload artifacts + uses: actions/upload-artifact@v3 + if: always() + with: + name: /tmp/tests/testing/e2e-tracetesting/test-results + path: artifacts + retention-days: 90 + - name: Configure Tracetest CLI uses: kubeshop/tracetest-github-action@v1 with: token: ${{secrets.TRACETEST_CLI_TOKEN}} - name: run tracetests - env: - TESTS_REPO_DIR: "/tmp/tests" run: | tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features --vars ./tests/vars/ci.yaml \ No newline at end of file From a0c4521ea6cf47e519afcce508d9c338651f6561 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 17:20:00 -0300 Subject: [PATCH 17/19] test --- .github/workflows/pr-checks.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 57f68114..922a11b3 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -50,11 +50,14 @@ jobs: $BASE_DIR/scripts/prepare_ci_env.sh --debug + pwd + tree + - name: Upload artifacts uses: actions/upload-artifact@v3 if: always() with: - name: /tmp/tests/testing/e2e-tracetesting/test-results + name: /tmp/tests/testing/ path: artifacts retention-days: 90 From 310288bcd7aaf1aeb85b1d1169da5f955c19e2e1 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 17:29:12 -0300 Subject: [PATCH 18/19] remove debug --- .github/workflows/pr-checks.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 922a11b3..5dedc448 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -48,17 +48,14 @@ jobs: cd $TESTS_REPO_DIR git sparse-checkout set testing/ - $BASE_DIR/scripts/prepare_ci_env.sh --debug - - pwd - tree + $BASE_DIR/scripts/prepare_ci_env.sh - name: Upload artifacts uses: actions/upload-artifact@v3 if: always() with: - name: /tmp/tests/testing/ - path: artifacts + name: images + path: /tmp/tests/testing/e2e-tracetesting/test-results retention-days: 90 - name: Configure Tracetest CLI From 43582eec7411197e010a18f685acffc1d9d72f16 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Wed, 25 Sep 2024 17:36:35 -0300 Subject: [PATCH 19/19] update actions --- .github/workflows/pr-checks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 5dedc448..e0b89f6b 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup KinD uses: helm/kind-action@v1 @@ -51,7 +51,7 @@ jobs: $BASE_DIR/scripts/prepare_ci_env.sh - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: images