Skip to content

Commit

Permalink
Obscure smee url from generated logs
Browse files Browse the repository at this point in the history
obscured smee url from generated logs in CI.

Signed-off-by: Zaki Shaikh <[email protected]>
  • Loading branch information
zakisk committed Nov 27, 2024
1 parent f16dfed commit 8e32728
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/kind-e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ jobs:
- name: Collect logs
if: ${{ always() }}
run: |
./hack/gh-workflow-ci.sh collect_logs
./hack/gh-workflow-ci.sh collect_logs \
"${{ secrets.TEST_GITEA_SMEEURL }}" \
"${{ secrets.TEST_GITHUB_SECOND_SMEE_URL }}"
- name: Upload artifacts
if: ${{ always() }}
Expand Down
9 changes: 8 additions & 1 deletion hack/gh-workflow-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ run_e2e_tests() {
}

collect_logs() {
test_gitea_smee_url="${1}"
github_ghe_smee_url="${2}"
mkdir -p /tmp/logs
kind export logs /tmp/logs
[[ -d /tmp/gosmee-replay ]] && cp -a /tmp/gosmee-replay /tmp/logs/
Expand All @@ -142,6 +144,11 @@ collect_logs() {
done
kubectl -n ${ns} get events >/tmp/logs/ns/${ns}/events
done

for url in "${test_gitea_smee_url}" "${github_ghe_smee_url}"; do
# shellcheck disable=SC2038
find /tmp/logs -type f -exec grep -l "${url}" {} \; | xargs -r sed -i "s|${url}|SMEE_URL|g"
done
}

help() {
Expand Down Expand Up @@ -175,7 +182,7 @@ run_e2e_tests)
run_e2e_tests "${2}" "${3}" "${4}" "${5}" "${6}" "${7}" "${8}" "${9}" "${10}" "${11}"
;;
collect_logs)
collect_logs
collect_logs "${2}" "${3}"
;;
help)
help
Expand Down

0 comments on commit 8e32728

Please sign in to comment.