Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Add option to exit non-zero if there's an error #9

Open
jfharden opened this issue Jul 20, 2023 · 0 comments
Open

Add option to exit non-zero if there's an error #9

jfharden opened this issue Jul 20, 2023 · 0 comments

Comments

@jfharden
Copy link

It would be good if we could cause a non-zero exit code if the config has errors. This would make it easy to include in CI pipelines. For example a git repo could include a github action which checks the config.

Currently it would require grepping the output to look for a string, this feels quite fragile.

My proposal, so as to keep backwards compatibility would be to have a new flag which invokes this behaviour, such as -fail-on-error which causes otel-config-validation to exit with a non-zero exit code

Example github workflow for validation:

name: Github Actions Tests

on:
  workflow_call:
  pull_request:

permissions:
  contents: read

jobs:
  config-validation:
    name: Validate config file
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
        with:
          path: pay-adot
      - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
        with:
          repository: lightstep/otel-config-validator
          path: otel-config-validator-source
      - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
        with:
          go-version: '^1.19.2'
      - name: build-otel-config-validator
        working-directory: otel-config-validator-source
        run: go build -o otel-config-validator ./cmd/cli/main.go
      - name: validate-config
        run: otel-config-validator-source/otel-config-validator -f pay-adot/config.yml
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant