Skip to content

Commit 25090c7

Browse files
committed
[ci] Disable monitoring of fork branches
Jobs executing on PRs based on fork branches won't have access to the secrets required to configure collectors for logs and metrics. Disabling the collection in the custom action avoids failing such jobs. This was the behavior prior to the switch to starting collectors with golang.
1 parent 4f3f5e7 commit 25090c7

File tree

1 file changed

+7
-3
lines changed
  • .github/actions/run-monitored-tmpnet-cmd

1 file changed

+7
-3
lines changed

.github/actions/run-monitored-tmpnet-cmd/action.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,16 @@ runs:
5959
GRAFANA_URL: https://grafana-poc.avax-dev.network/d/kBQpRdWnk/avalanche-main-dashboard?orgId=1&refresh=10s&var-filter=is_ephemeral_node%7C%3D%7Cfalse&var-filter=gh_repo%7C%3D%7C${{ inputs.repository_owner }}%2F${{ inputs.repository_name }}&var-filter=gh_run_id%7C%3D%7C${{ inputs.run_id }}&var-filter=gh_run_attempt%7C%3D%7C${{ inputs.run_attempt }}
6060
GH_JOB_ID: ${{ inputs.job }}
6161
FILTER_BY_OWNER: ${{ inputs.filter_by_owner }}
62+
- name: Warn that collection of metrics and logs will not be performed
63+
if: (inputs.prometheus_username != '')
64+
shell: bash
65+
run: echo "::warning::Monitoring credentials not found. Skipping collector start. Is the PR from a fork branch?"
6266
- name: Run command
6367
shell: bash
6468
# --impure ensures the env vars are accessible to the command
6569
run: ${{ inputs.run_env }} nix develop --impure --command bash -x ${{ inputs.run }}
6670
env:
67-
TMPNET_START_COLLECTORS: true
71+
TMPNET_START_COLLECTORS: ${{ inputs.prometheus_username != '' }}
6872
LOKI_USERNAME: ${{ inputs.loki_username }}
6973
LOKI_PASSWORD: ${{ inputs.loki_password }}
7074
PROMETHEUS_USERNAME: ${{ inputs.prometheus_username }}
@@ -91,7 +95,7 @@ runs:
9195
if-no-files-found: error
9296
# TODO(marun) Maybe optionally run these checks in an AfterSuite step?
9397
- name: Check that logs were collected
94-
if: always()
98+
if: (inputs.prometheus_username != '')
9599
shell: bash
96100
run: go run github.com/ava-labs/avalanchego/tests/fixture/tmpnet/cmd check-logs
97101
env:
@@ -104,7 +108,7 @@ runs:
104108
GH_RUN_ATTEMPT: ${{ inputs.run_attempt }}
105109
GH_JOB_ID: ${{ inputs.job }}
106110
- name: Check that metrics were collected
107-
if: always()
111+
if: (inputs.prometheus_username != '')
108112
shell: bash
109113
run: go run github.com/ava-labs/avalanchego/tests/fixture/tmpnet/cmd check-metrics
110114
env:

0 commit comments

Comments
 (0)