Skip to content

Commit b5d5889

Browse files
authored
cd: store sensitive logs on the server to be able to read them if we got an error during deploy or e2e tests run and use self-hosted runners to be able to access the logs, remove --suppress-diff flag to show helm diff in deploy logs (not in action logs) (#46)
* ci: write e2e logs to the constant file instead of /dev/null to be able to read logs * test: trigger workflows * docs: add example of a logs filename * test: deploy without --suppress-diff flag * Revert "test: deploy without --suppress-diff flag" This reverts commit 070ff1a. * Revert "test: trigger workflows" This reverts commit fd2c719. * cd: remove line break to write logs to the file and not leak a secrets instead of multi-line that is broken if there is an extra space in between the lines * docs: explain why we use self-hosted runner for e2e tests againt prod and add link for '2>&1' explanation * format: remove extra empty line * cd: remove --suppress-diff flag to show helm diff in deploy logs
1 parent c67ca19 commit b5d5889

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎.github/workflows/.reusable-e2e-tests-against-prod.yml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ on:
55

66
jobs:
77
e2e-test-against-prod:
8-
runs-on: ubuntu-24.04
8+
# need to run on our own runners that we have access to the logs later on our servers
9+
# otherwise, if we use shared runners they store log files in their VMs which we cannot access
10+
runs-on: self-hosted
911
steps:
1012
- uses: actions/checkout@v4
1113

@@ -21,9 +23,11 @@ jobs:
2123
2224
- name: Run E2E Tests Against Local Env
2325
run: |
24-
# Learn more about '> /dev/null 2>&1': https://stackoverflow.com/a/42919998
26+
# Redirecting logs to a file on the server
27+
# Example of a filename: "/var/log/inner-circle/e2e/2026-07-22-inner-circle-time-api-run-27459153975-job-81169369662.log"
28+
# Learn more about '2>&1': https://stackoverflow.com/a/42919998
2529
# In essence it merges output and error streams and doesn't show errors in the terminal to avoid leakage of secrets in the pipeline
26-
java -jar karate.jar . > /dev/null 2>&1
30+
java -jar karate.jar . > "/var/log/inner-circle/e2e/$(date +%F)-${{ github.event.repository.name }}-run-${{ github.run_id }}-job-${{ job.check_run_id }}.log" 2>&1
2731
env:
2832
"AUTH_FIRST_TENANT_LOGIN_WITH_ALL_PERMISSIONS": ${{ secrets.INNER_CIRCLE_PROD_AUTH_FIRST_TENANT_LOGIN_WITH_ALL_PERMISSIONS }}
2933
"AUTH_FIRST_TENANT_PASSWORD_WITH_ALL_PERMISSIONS": ${{ secrets.INNER_CIRCLE_PROD_AUTH_FIRST_TENANT_PASSWORD_WITH_ALL_PERMISSIONS }}

‎.github/workflows/deploy-to-prod-from-default.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
# then they will break other vars
2222
# Also we use quotes because without them some vars (DB Connection) break down
2323
run: |
24-
helmfile cache cleanup && helmfile apply --suppress-diff --namespace "${{ secrets.INNER_CIRCLE_PROD_NAMESPACE }}" -f Api/ci/helmfile.yaml \
24+
helmfile cache cleanup && helmfile apply --namespace "${{ secrets.INNER_CIRCLE_PROD_NAMESPACE }}" -f Api/ci/helmfile.yaml \
2525
--state-values-set image.tag="sha-${{ github.sha }}" \
2626
--state-values-set ingress.hostname="${{ secrets.INNER_CIRCLE_PROD_HOSTNAME }}" \
2727
--state-values-set extraSecretEnvVars.ConnectionStrings__DefaultConnection="${{ secrets.INNER_CIRCLE_PROD_AUTH_DB_CONNECTION_STRING }}" \
@@ -30,7 +30,8 @@ jobs:
3030
--state-values-set extraSecretEnvVars.InnerCircleServiceUrls__MailServiceUrl="${{ secrets.INNER_CIRCLE_PROD_MAIL_SERVICE_URL }}" \
3131
--state-values-set extraSecretEnvVars.InnerCircleServiceUrls__EmployeesServiceUrl="${{ secrets.INNER_CIRCLE_PROD_EMPLOYEES_SERVICE_URL }}" \
3232
--state-values-set extraSecretEnvVars.AuthenticationOptions__PublicSigningKey="${{ secrets.INNER_CIRCLE_PROD_PUBLIC_SIGNING_KEY }}" \
33-
--state-values-set extraSecretEnvVars.AuthenticationOptions__PrivateSigningKey="${{ secrets.INNER_CIRCLE_PROD_PRIVATE_SIGNING_KEY }}" > /dev/null 2>&1
33+
--state-values-set extraSecretEnvVars.AuthenticationOptions__PrivateSigningKey="${{ secrets.INNER_CIRCLE_PROD_PRIVATE_SIGNING_KEY }}" > "/var/log/inner-circle/deploy/$(date +%F)-${{ github.event.repository.name }}-run-${{ github.run_id }}-job-${{ job.check_run_id }}.log" 2>&1
34+
# on the last line where we redirect output we don't add a line break for convenience because it is easy to make it wrong having an extra space after \ symbol which leads to exposure of logs to the public pipeline logs instead of the needed private file on a runner
3435
3536
run-e2e-tests:
3637
uses: ./.github/workflows/.reusable-e2e-tests-against-prod.yml

0 commit comments

Comments
 (0)