Skip to content

add not supported lang versions #1

add not supported lang versions

add not supported lang versions #1

name: Lib-injection tests
on:
workflow_call:
inputs:
build_lib_injection_app_images:
description: "Shall we build python base images for tests on python tracer"
default: false
required: false
type: boolean
library:
description: "Library to test"
required: true
type: string
env:
REGISTRY: ghcr.io
jobs:
compute-matrix:
name: Get weblogs for Lib-Injection tests
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.compute-matrix.outputs.matrix }}
matrix_not_supported: ${{ steps.compute-matrix.outputs.matrix_not_supported }}
init_image: ${{ steps.compute-matrix.outputs.init_image }}
steps:
- name: Compute matrix
id: compute-matrix
shell: python
run: |
import json
import os
weblogs={
"cpp": [],
"dotnet": ["dd-lib-dotnet-init-test-app"],
"golang": [],
"java": ["dd-lib-java-init-test-app"],
"nodejs": ["sample-app"],
"php": [],
"python": ["dd-lib-python-init-test-django", "dd-lib-python-init-test-django-gunicorn", "dd-lib-python-init-test-django-uvicorn"],
"ruby": ["dd-lib-ruby-init-test-rails", "dd-lib-ruby-init-test-rails-explicit", "dd-lib-ruby-init-test-rails-gemsrb"]
}
#Lang version not supported for these weblogs
not_supported_weblogs={
"cpp": [],
"dotnet": [],
"golang": [],
"java": ["jdk7-app"],
"nodejs": [],
"php": [],
"python": [],
"ruby": []
}
init_images={
"cpp": [],
"dotnet": ["gcr.io/datadoghq/dd-lib-dotnet-init:latest","ghcr.io/datadog/dd-trace-dotnet/dd-lib-dotnet-init:latest_snapshot"],
"golang": [],
"java": ["gcr.io/datadoghq/dd-lib-java-init:latest","ghcr.io/datadog/dd-trace-java/dd-lib-java-init:latest_snapshot"],
"nodejs": ["gcr.io/datadoghq/dd-lib-js-init:latest","ghcr.io/datadog/dd-trace-js/dd-lib-js-init:latest_snapshot"],
"php": [],
"python": ["gcr.io/datadoghq/dd-lib-python-init:latest","ghcr.io/datadog/dd-trace-py/dd-lib-python-init:latest_snapshot"],
"ruby": ["gcr.io/datadoghq/dd-lib-ruby-init:latest","ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:latest_snapshot"],
}
result = weblogs["${{ inputs.library }}"]
result_not_supported = not_supported_weblogs["${{ inputs.library }}"]
result_init_image = init_images["${{ inputs.library }}"]
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'matrix={json.dumps(result)}', file=fh)
print(f'init_image={json.dumps(result_init_image)}', file=fh)
print(f'matrix_not_supported={json.dumps(result_not_supported)}', file=fh)
print(json.dumps(result, indent=2))
print(json.dumps(result_init_image, indent=2))
print(json.dumps(result_not_supported, indent=2))
lib-injection-init-image-validator:
if: inputs.library == 'dotnet' || inputs.library == 'java' || inputs.library == 'python' || inputs.library == 'ruby' || inputs.library == 'nodejs'
runs-on:
group: "APM Larger Runners"
permissions:
contents: read
packages: read
needs:
- compute-matrix
strategy:
matrix:

Check failure on line 89 in .github/workflows/run-lib-injection.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/run-lib-injection.yml

Invalid workflow file

You have an error in your yaml syntax on line 89
- weblog: ${{ fromJson(needs.compute-matrix.outputs.matrix) }}
lib_init_image: ${{ fromJson(needs.compute-matrix.outputs.init_image) }}
lang_suported: "true"
- weblog: ${{ fromJson(needs.compute-matrix.outputs.matrix_not_supported) }}
lib_init_image: ${{ fromJson(needs.compute-matrix.outputs.init_image) }}
lang_suported: "false"
fail-fast: false
env:
TEST_LIBRARY: ${{ inputs.library }}
LIB_INIT_IMAGE: ${{ matrix.lib_init_image }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # 3.0.0
with:
registry: ghcr.io/datadog
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build weblog init image validator
if: matrix.lang_suported == 'true'
run: lib-injection/build/build_lib_injection_weblog.sh -w ${{ matrix.weblog }} -l ${{ inputs.library }}
- name: Install runner
uses: ./.github/actions/install_runner
- name: Perform lib injection
if: matrix.lang_suported == 'true'
run: |
echo "Testing lib injection init image: $LIB_INIT_IMAGE"
./run.sh LIB_INJECTION_VALIDATION
- name: Perform lib injection for not supported lang
if: matrix.lang_suported == 'false'
run: |
echo "Testing lib injection init image: $LIB_INIT_IMAGE"
echo "Weblog: ${{ matrix.weblog }}"
- name: Compress logs
id: compress_logs
if: always()
run: tar -czvf artifact.tar.gz $(ls | grep logs)
- name: Upload artifact
if: always() && steps.compress_logs.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: logs_lib-injection_validation_${{ inputs.library}}_${{matrix.weblog}}_${{ endsWith(matrix.lib_init_image, 'latest_snapshot') == true && 'latest_snapshot' || 'latest'}}
path: artifact.tar.gz
k8s-lib-injection-tests:
if: 1==2 && inputs.library == 'dotnet' || inputs.library == 'java' || inputs.library == 'python' || inputs.library == 'ruby' || inputs.library == 'nodejs'
runs-on:
group: "APM Larger Runners"
permissions:
contents: read
packages: write
needs:
- compute-matrix
strategy:
matrix:
weblog: ${{ fromJson(needs.compute-matrix.outputs.matrix) }}
version:
- latest
- latest_snapshot
fail-fast: false
env:
TEST_LIBRARY: ${{ inputs.library }}
WEBLOG_VARIANT: ${{ matrix.weblog }}
DOCKER_REGISTRY_IMAGES_PATH: ghcr.io/datadog
DOCKER_IMAGE_TAG: ${{ matrix.version }}
BUILDX_PLATFORMS: linux/amd64
SYSTEM_TESTS_REPORT_ENVIRONMENT: dev
SYSTEM_TESTS_REPORT_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.12.1 # 0.13.0 is causing the builds to fail
install: true
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 1
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # 3.0.0
with:
registry: ghcr.io/datadog
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build weblog base images (PR)
if: inputs.build_lib_injection_app_images
env:
DOCKER_IMAGE_WEBLOG_TAG: ${{ github.sha }}
APP_DOCKER_IMAGE_REPO: ghcr.io/datadog/system-tests/${{ matrix.weblog }}
run: |
cd lib-injection/build/docker/$TEST_LIBRARY/$WEBLOG_VARIANT
LIBRARY_INJECTION_TEST_APP_IMAGE=$APP_DOCKER_IMAGE_REPO:${{ github.sha }} ./build.sh
cd ..
- name: Build weblog latest base images
#If we execute on system-tests-dashboard, we can't push the images because we don't have the permissions.
#To asign the permissions, we need to configure the image on ghcr, but due to a issue we can't do it
#The case is opened with github support
if: github.ref == 'refs/heads/main' && github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
env:
DOCKER_IMAGE_WEBLOG_TAG: latest
APP_DOCKER_IMAGE_REPO: ghcr.io/datadog/system-tests/${{ matrix.weblog }}
run: |
cd lib-injection/build/docker/$TEST_LIBRARY/$WEBLOG_VARIANT
LIBRARY_INJECTION_TEST_APP_IMAGE=$APP_DOCKER_IMAGE_REPO:latest ./build.sh
cd ..
- name: Install runner
uses: ./.github/actions/install_runner
- name: Kubernetes lib-injection tests (using custom weblog image tag)
if: inputs.build_lib_injection_app_images
id: k8s-lib-injection-tests-custom-weblog-tag
run: DOCKER_IMAGE_WEBLOG_TAG=${{ github.sha }} ./run.sh K8S_LIB_INJECTION_FULL
- name: Kubernetes lib-injection tests
if: inputs.build_lib_injection_app_images != true
id: k8s-lib-injection-tests
run: ./run.sh K8S_LIB_INJECTION_FULL
- name: Compress logs
id: compress_logs
if: always()
run: tar -czvf artifact.tar.gz $(ls | grep logs)
- name: Upload artifact
if: always() && steps.compress_logs.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: logs_k8s-lib-injection_${{ inputs.library}}_${{matrix.weblog}}_${{ matrix.version == 'latest' && 'prod' || 'dev' }}
path: artifact.tar.gz