From 27e719234fe4f94cd8b9a0c5388dae1833d7ac82 Mon Sep 17 00:00:00 2001 From: Yingchun Guo Date: Tue, 30 Jul 2024 14:45:42 +0800 Subject: [PATCH] enable google secrets in helm chart e2e workflow Signed-off-by: Yingchun Guo --- .github/workflows/chart-e2e.yaml | 12 ++++++++---- .github/workflows/scripts/e2e/chart_test.sh | 5 +---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/chart-e2e.yaml b/.github/workflows/chart-e2e.yaml index 49352b98..fa784d85 100644 --- a/.github/workflows/chart-e2e.yaml +++ b/.github/workflows/chart-e2e.yaml @@ -4,7 +4,7 @@ name: E2E test with helm charts on: - pull_request: + pull_request_target: branches: [main] types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped paths: @@ -29,7 +29,7 @@ jobs: - name: Checkout out Repo uses: actions/checkout@v4 with: - fetch-depth: 0 + ref: "refs/pull/${{ github.event.number }}/merge" - name: Get test matrix id: get-test-matrix @@ -79,7 +79,7 @@ jobs: - name: Checkout out Repo uses: actions/checkout@v4 with: - fetch-depth: 0 + ref: "refs/pull/${{ github.event.number }}/merge" - name: Set variables run: | @@ -97,7 +97,6 @@ jobs: echo "CHART_FOLDER=$CHARTS_DIR/${{ matrix.example }}" >> $GITHUB_ENV fi - - name: Initialize chart testing run: | # Replace values for CI test environment @@ -117,6 +116,9 @@ jobs: - name: Helm install id: install + env: + GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }} + GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} run: | set -xe echo "should_cleanup=true" >> $GITHUB_ENV @@ -128,6 +130,8 @@ jobs: if ! helm install --create-namespace --namespace $NAMESPACE --wait \ --timeout "$ROLLOUT_TIMEOUT_SECONDS" \ --set autodependency.enabled=true \ + --set GOOGLE_API_KEY=${{ env.GOOGLE_API_KEY}} \ + --set GOOGLE_CSE_ID=${{ env.GOOGLE_CSE_ID}} \ --values ${{ env.CHART_FOLDER}}/${value_file} \ $RELEASE_NAME ${{ env.CHART_FOLDER}} ; then echo "Failed to install chart ${{ matrix.example }}" diff --git a/.github/workflows/scripts/e2e/chart_test.sh b/.github/workflows/scripts/e2e/chart_test.sh index bef37587..9b9f0460 100755 --- a/.github/workflows/scripts/e2e/chart_test.sh +++ b/.github/workflows/scripts/e2e/chart_test.sh @@ -19,10 +19,7 @@ function dump_pod_log() { function dump_pods_status() { namespace=$1 echo "-----DUMP POD STATUS in NS $namespace------" - - # get pod status - outputs=$(kubectl get pods -n $namespace -owide) - echo $outputs + kubectl get pods -n $namespace -o wide echo "-----------------------------------" # Get all pods in the namespace and their statuses