Skip to content

Commit

Permalink
don't use TELEMETRY_ENABLED in dispatch setup
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed Feb 10, 2025
1 parent 6000a0c commit 87733c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
11 changes: 5 additions & 6 deletions telemetry-dispatch-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,24 @@ runs:
using: 'composite'
steps:
- uses: rapidsai/shared-actions/telemetry-impls/load-then-clone@better-download-error-handling
if: ${{ github.run_attempt == '1' }}
with:
GH_TOKEN: ${{ inputs.GH_TOKEN }}
- name: Creating folder for job-created telemetry artifacts
shell: bash
run: mkdir -p telemetry-artifacts
- uses: ./shared-actions/telemetry-impls/github-actions-job-info
if: ${{ env.TELEMETRY_ENABLED == 'true' }}
id: github-job-info
if: ${{ github.run_attempt == '1' }}
- shell: bash
if: ${{ env.TELEMETRY_ENABLED == 'true' }}
id: get-job-id
if: ${{ github.run_attempt == '1' }}
run:
echo JOB_ID="$(cat job_info.json | jq -r '.id')" >> ${GITHUB_ENV};
# overrides loaded value.
- name: Set OTEL_SERVICE_NAME from job
if: ${{ env.TELEMETRY_ENABLED == 'true' }}
if: ${{ github.run_attempt == '1' }}
uses: ./shared-actions/telemetry-impls/set-otel-service-name
- name: Add attribute metadata beyond the stashed basic stuff
if: ${{ env.TELEMETRY_ENABLED == 'true' }}
if: ${{ github.run_attempt == '1' }}
shell: bash
run:
attributes="${OTEL_RESOURCE_ATTRIBUTES}";
Expand Down
2 changes: 1 addition & 1 deletion telemetry-dispatch-stash-job-artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ runs:
steps:
# Stash current job's OTEL_RESOURCE_ATTRIBUTES and any files in the telemetry-artifacts directory
- name: Stash job artifacts
if: ${{ env.TELEMETRY_ENABLED == 'true' }}
if: ${{ var.TELEMETRY_ENABLED == 'true' && github.run_attempt == '1' }}
uses: ./shared-actions/telemetry-impls/stash-job-artifacts
12 changes: 2 additions & 10 deletions telemetry-impls/load-then-clone/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,21 @@ runs:
using: 'composite'
steps:
- name: Download base environment variables file
id: download-base-env-vars
if: ${{ github.run_attempt == 1 }}
if: ${{ github.run_attempt == '1' }}
uses: actions/download-artifact@v4
with:
name: telemetry-tools-env-vars
path: telemetry-artifacts
- name: Disable telemetry if run attempt is not 1
shell: bash
if: ${{ github.run_attempt > 1 }}
run: |
echo "TELEMETRY_ENABLED=false" >> ${GITHUB_ENV}
echo "Disabling telemetry because this is not the first run attempt."
# We can't use ./telemetry-implementation/load-base-env-vars here
# because at this point we have not cloned the repo.
- name: Set environment variables from file into GITHUB_ENV
if: ${{ steps.download-base-env-vars.outcome == 'success' }}
if: ${{ github.run_attempt == '1' }}
shell: bash
# Only set the env var if it is not already set
# the ${!VARIABLE} syntax is called "indirect expansion" and it is kind of equivalent to ${${env_var_name}}
# in other words, expand to find the variable name, then dereference that variable name
# The goofy env_var_value filtering through tr is to ensure that the strings don't include quotes.
run: |
echo "TELEMETRY_ENABLED=true" >> ${GITHUB_ENV}
while read LINE; do
env_var_name="$( cut -d '=' -f 1 <<< "$LINE" )";
if [ "${!env_var_name}" = "" ]; then
Expand Down

0 comments on commit 87733c6

Please sign in to comment.