From 6fd672abe97a3af0a43a36ca066e7144f8b35a62 Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Wed, 6 Sep 2023 16:42:47 +0200 Subject: [PATCH 1/6] Build and publish the Python E2E image Signed-off-by: Israel Blancas --- ...ublish-autoinstrumentation-e2e-images.yaml | 64 +++++++++++++++++++ .../python/Dockerfile | 7 ++ tests/instrumentation-e2e-apps/python/app.py | 10 +++ .../python/requirements.txt | 1 + 4 files changed, 82 insertions(+) create mode 100644 .github/workflows/publish-autoinstrumentation-e2e-images.yaml create mode 100644 tests/instrumentation-e2e-apps/python/Dockerfile create mode 100644 tests/instrumentation-e2e-apps/python/app.py create mode 100644 tests/instrumentation-e2e-apps/python/requirements.txt diff --git a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml new file mode 100644 index 0000000000..30fb5ec91d --- /dev/null +++ b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml @@ -0,0 +1,64 @@ +name: "Publish instrumentation E2E images" + +on: + push: + paths: + - 'tests/instrumentation-e2e-apps/**' + - '.github/workflows/publish-autoinstrumentation-e2e-images.yaml' + branches: + - main + pull_request: + paths: + - 'tests/instrumentation-e2e-apps/**' + - '.github/workflows/publish-autoinstrumentation-e2e-images.yaml' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + python: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/open-telemetry/opentelemetry-operator/python-test:e2e + tags: | + type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Login to GitHub Package Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: tests/instrumentation-e2e-apps/python + platforms: linux/arm64,linux/amd64 + push: ${{ github.event_name == 'push' }} + build-args: version=${{ env.VERSION }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache diff --git a/tests/instrumentation-e2e-apps/python/Dockerfile b/tests/instrumentation-e2e-apps/python/Dockerfile new file mode 100644 index 0000000000..e6558779b8 --- /dev/null +++ b/tests/instrumentation-e2e-apps/python/Dockerfile @@ -0,0 +1,7 @@ +FROM python:alpine3.18 + +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY app.py . + +ENTRYPOINT ["flask", "run", "-p", "8080"] diff --git a/tests/instrumentation-e2e-apps/python/app.py b/tests/instrumentation-e2e-apps/python/app.py new file mode 100644 index 0000000000..32a35d6938 --- /dev/null +++ b/tests/instrumentation-e2e-apps/python/app.py @@ -0,0 +1,10 @@ +from flask import Flask + +app = Flask(__name__) + +@app.route('/') +def index(): + return "Hi" + +if __name__ == "__main__": + app.run(host='0.0.0.0') diff --git a/tests/instrumentation-e2e-apps/python/requirements.txt b/tests/instrumentation-e2e-apps/python/requirements.txt new file mode 100644 index 0000000000..cc35792f29 --- /dev/null +++ b/tests/instrumentation-e2e-apps/python/requirements.txt @@ -0,0 +1 @@ +Flask==2.3.3 \ No newline at end of file From 7fe53441e15871624472f04bfb9e425377571b2c Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Wed, 6 Sep 2023 16:55:27 +0200 Subject: [PATCH 2/6] Fix archs Signed-off-by: Israel Blancas --- .github/workflows/publish-autoinstrumentation-e2e-images.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml index 30fb5ec91d..efcb4109c4 100644 --- a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml +++ b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml @@ -55,7 +55,7 @@ jobs: uses: docker/build-push-action@v4 with: context: tests/instrumentation-e2e-apps/python - platforms: linux/arm64,linux/amd64 + platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le push: ${{ github.event_name == 'push' }} build-args: version=${{ env.VERSION }} tags: ${{ steps.meta.outputs.tags }} From 5ff905c4b2f9512ad5c6995faad10a587c4846c5 Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Thu, 14 Sep 2023 19:20:25 +0200 Subject: [PATCH 3/6] Fix the tags Signed-off-by: Israel Blancas --- .../workflows/publish-autoinstrumentation-e2e-images.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml index efcb4109c4..d688b7d017 100644 --- a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml +++ b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml @@ -29,8 +29,7 @@ jobs: uses: docker/metadata-action@v4 with: images: ghcr.io/open-telemetry/opentelemetry-operator/python-test:e2e - tags: | - type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }} + - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -57,8 +56,5 @@ jobs: context: tests/instrumentation-e2e-apps/python platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le push: ${{ github.event_name == 'push' }} - build-args: version=${{ env.VERSION }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache From f5b6b057fa8382d7b6689e18db9a13cdc14994ea Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Thu, 14 Sep 2023 19:28:25 +0200 Subject: [PATCH 4/6] Fix the tags Signed-off-by: Israel Blancas --- .github/workflows/publish-autoinstrumentation-e2e-images.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml index d688b7d017..c06e9ac17d 100644 --- a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml +++ b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml @@ -28,7 +28,7 @@ jobs: id: meta uses: docker/metadata-action@v4 with: - images: ghcr.io/open-telemetry/opentelemetry-operator/python-test:e2e + images: ghcr.io/open-telemetry/opentelemetry-operator/python-test - name: Set up QEMU uses: docker/setup-qemu-action@v2 From 09530ea05723595c4d0c9d342f980d1ebaa37c7e Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Fri, 29 Sep 2023 18:32:48 +0200 Subject: [PATCH 5/6] Use reusable workflow Signed-off-by: Israel Blancas --- ...ublish-autoinstrumentation-e2e-images.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml diff --git a/.github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml b/.github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml new file mode 100644 index 0000000000..cfe6268864 --- /dev/null +++ b/.github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml @@ -0,0 +1,58 @@ +name: Reusable - Publish autoinstrumentation E2E images + +on: + workflow_call: + inputs: + language: + type: string + required: true + platforms: + type: string + required: true + +jobs: + publish-e2e-image: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-${{ inputs.language }} + tags: | + type=ref,event=branch + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Login to GitHub Package Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + tags: ${{ steps.meta.outputs.tags }} + context: tests/instrumentation-e2e-apps/${{ inputs.language }} + platforms: ${{ inputs.platforms }} + push: ${{ github.event_name == 'push' }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache From 386b0c243172b155e0eb67363e2cc9234a7099b1 Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Fri, 29 Sep 2023 18:34:52 +0200 Subject: [PATCH 6/6] Fix workflow name Signed-off-by: Israel Blancas --- .github/workflows/publish-autoinstrumentation-e2e-images.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml index c1348aa0bb..5a72f650ac 100644 --- a/.github/workflows/publish-autoinstrumentation-e2e-images.yaml +++ b/.github/workflows/publish-autoinstrumentation-e2e-images.yaml @@ -23,7 +23,7 @@ jobs: with: language: golang platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le - dotnet: + python: uses: ./.github/workflows/reusable-publish-autoinstrumentation-e2e-images.yaml with: language: python