refactor for dispatch style #300
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow is meant to imitate the behavior of RAPIDS project PR workflows, such as | |
on: | |
pull_request: | |
workflow_dispatch: | |
env: | |
SHARED_ACTIONS_REF: ${{ github.ref}} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
base-env-setup: | |
runs-on: ubuntu-latest | |
# These will be stashed. The names are not arbitrary. They match special OpenTelemetry names | |
# or names that are hard-coded in actions/scripts downstream. | |
env: | |
SHARED_ACTIONS_REPO: rapidsai/shared-actions | |
SHARED_ACTIONS_REF: ${{ github.ref }} | |
# this should stay the same throughout this workflow, but child workflows will each | |
# have their own OTEL_SERVICE_NAME. It is generally the job name, including any matrix elements. | |
# This is what distinguishes one job trace from another, so it is important to be distinct | |
# between jobs. | |
OTEL_SERVICE_NAME: test-telemetry plus something | |
# TODO: this should be set as an org-wide variable | |
OTEL_EXPORTER_OTLP_ENDPOINT: https://tempo.gha-runners.nvidia.com:4318 | |
OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf" | |
OTEL_RESOURCE_ATTRIBUTES: "git.repository=${{ github.repository }},git.ref=${{ github.ref }},git.sha=${{ github.sha }},git.job_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
outputs: | |
service-name: ${{ steps.export.outputs.service_name }} | |
steps: | |
- name: Compute traceparent and stash telemetry-related env vars | |
uses: rapidsai/shared-actions/telemetry-dispatch-stash-base-env-vars@telemetry-dispatch-actions | |
- name: Export service name so we can check it below | |
id: export | |
run: echo service_name="${OTEL_SERVICE_NAME}" >> ${GITHUB_OUTPUT} | |
child-workflow: | |
needs: base-env-setup | |
secrets: inherit | |
uses: rapidsai/shared-actions/.github/workflows/test-child-workflow.yaml@telemetry-dispatch-actions | |
summarize-top-level: | |
runs-on: ubuntu-latest | |
needs: | |
- base-env-setup | |
- child-workflow | |
steps: | |
- name: Load base env vars, including OTEL_SERVICE_NAME | |
uses: rapidsai/shared-actions/telemetry-dispatch-load-base-env-vars@telemetry-dispatch-actions | |
with: | |
load_service_name: "true" | |
- run: | | |
echo "env var value is: ${OTEL_SERVICE_NAME}" | |
echo "outputs value is: ${{needs.base-env-setup.outputs.service-name}}" | |
[ ${OTEL_SERVICE_NAME} = ${{needs.base-env-setup.outputs.service-name}} ] || exit 1 | |
- name: Telemetry setup | |
uses: rapidsai/shared-actions/telemetry-dispatch-write-summary@telemetry-dispatch-actions | |
with: | |
cert_concat: "${{ secrets.OTEL_EXPORTER_OTLP_CA_CERTIFICATE }};${{ secrets.OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE }};${{ secrets.OTEL_EXPORTER_OTLP_CLIENT_KEY }}" | |
- run: echo "wrong OTEL_SERVICE_NAME after telemetry summary - this might be a disconnect in the trace"; exit 1; | |
if: ${{ env.OTEL_SERVICE_NAME }} != ${{ needs.base-env-setup.outputs.service-name }} |