opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

Fix git pull error in core contrib test

Open jomcgi opened this issue 8 months ago • 3 comments

Description

Core contrib is intermittently failing when pulling the core repo in tox. Add gh actions/checkout for the core repo before running tox to mitigate this.

As the error is transient I'm not 100% sure that this resolves it but I have not encountered it with any of the GH Actions that have been triggered.

Fixes #3352

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • [x] Tested with CI on this PR

Does This PR Require a Core Repo Change?

  • [x] No.

Checklist:

  • [x] Followed the style guidelines of this project
  • [x] Changelogs have been updated
  • [x] Unit tests have been added
  • [x] Documentation has been updated

jomcgi avatar Mar 12 '25 15:03 jomcgi

My idea for this one would be just do a actions/checkout first. If checkout works, it means will be able to install things from that revision

We already do a checkout before hitting this error, the actions/checkout action has a retry built in which is why we do not see this error there.

I couldn't see a flag for tox that would let us use the output of that checkout in tox -e ...

    runs-on: ubuntu-latest
    steps:
      - name: Checkout contrib repo @ SHA - ${% raw %}{{ env.CONTRIB_REPO_SHA }}{% endraw %}
        uses: actions/checkout@v4
        with:
          repository: open-telemetry/opentelemetry-python-contrib
          ref: ${% raw %}{{ env.CONTRIB_REPO_SHA }}{% endraw %}

      - name: Set up Python 3.8
        uses: actions/setup-python@v5
        with:
          python-version: "3.8"
          architecture: "x64"

      - name: Install tox
        run: pip install tox-uv

      - name: Run tests
        run: tox -e {{ job_data.tox_env }} -- -ra

The revision always exists (it's used for all of the other actions that run successfully and the previous checkout step) but we fail without retry when tox pulls it in Run tests.

jomcgi avatar Mar 12 '25 18:03 jomcgi

My idea for this one would be just do a actions/checkout first. If checkout works, it means will be able to install things from that revision

We already do a checkout before hitting this error, the actions/checkout action has a retry built in which is why we do not see this error there.

I couldn't see a flag for tox that would let us use the output of that checkout in tox -e ...

    runs-on: ubuntu-latest
    steps:
      - name: Checkout contrib repo @ SHA - ${% raw %}{{ env.CONTRIB_REPO_SHA }}{% endraw %}
        uses: actions/checkout@v4
        with:
          repository: open-telemetry/opentelemetry-python-contrib
          ref: ${% raw %}{{ env.CONTRIB_REPO_SHA }}{% endraw %}

      - name: Set up Python 3.8
        uses: actions/setup-python@v5
        with:
          python-version: "3.8"
          architecture: "x64"

      - name: Install tox
        run: pip install tox-uv

      - name: Run tests
        run: tox -e {{ job_data.tox_env }} -- -ra

The revision always exists (it's used for all of the other actions that run successfully and the previous checkout step) but we fail without retry when tox pulls it in Run tests.

I mean, checkout core repo at the core repo revision we want before the contrib one. We only have this problem for core_contrib_tests, which we test instrumentation libraries against a revision of Core. So, checkout core at that revision and use it

emdneto avatar Mar 12 '25 21:03 emdneto

I mean, checkout core repo at the core repo revision we want before the contrib one. We only have this problem for core_contrib_tests, which we test instrumentation libraries against a revision of Core. So, checkout core at that revision and use it

Understood - I'll update my PR so that it only adds that checkout for core_contrib tests.

jomcgi avatar Mar 13 '25 07:03 jomcgi

Good callout - I've updated tox.ini to allow passing the core rep as an environment variable. Successful run from opentelemtry-python using the my latest commit 01d7ae632fc0e27523f91897e77aced7cde1d09a: https://github.com/jomcgi/opentelemetry-python/actions/runs/14079667070/job/39429499877

Logs show the expected git+file://.. reference instead of the remote repo:

py38-test-instrumentation-openai-v2-latest: 
uv pip install 
'opentelemetry-api@ git+file:///home/runner/work/opentelemetry-python/opentelemetry-python/opentelemetry-python@8cb080cf886b1bb897c2baed6cb76d826532cba4#egg=opentelemetry-api&subdirectory=opentelemetry-api' 
'opentelemetry-sdk@ git+file:///home/runner/work/opentelemetry-python/opentelemetry-python/opentelemetry-python@8cb080cf886b1bb897c2baed6cb76d826532cba4#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk' 

jomcgi avatar Mar 26 '25 09:03 jomcgi

Passing test from the core repo with the latest commit: https://github.com/jomcgi/opentelemetry-python/actions/runs/14362978923

jomcgi avatar Apr 09 '25 17:04 jomcgi

Unfortunately I don't think this is working :sweat:

xrmx avatar Jul 28 '25 14:07 xrmx