diff --git a/.github/workflows/publish-autoinstrumentation-apache-httpd.yaml b/.github/workflows/publish-autoinstrumentation-apache-httpd.yaml new file mode 100644 index 0000000000..597d79ecd4 --- /dev/null +++ b/.github/workflows/publish-autoinstrumentation-apache-httpd.yaml @@ -0,0 +1,65 @@ +name: "Publish Apache HTTPD Auto-Instrumentation" + +on: + push: + paths: + - 'autoinstrumentation/apache-httpd/**' + - '.github/workflows/publish-autoinstrumentation-apache-httpd.yaml' + branches: + - main + pull_request: + paths: + - 'autoinstrumentation/apache-httpd/**' + - '.github/workflows/publish-autoinstrumentation-apache-httpd.yaml' + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + + - name: Read version + run: echo "VERSION=$(cat autoinstrumentation/apache-httpd/version.txt)" >> $GITHUB_ENV + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-apache-httpd + 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@v3 + with: + context: autoinstrumentation/apache-httpd + platforms: linux/amd64,linux/arm64 + 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 \ No newline at end of file diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index cf625ec9ba..a04fcf3e1d 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -28,6 +28,7 @@ jobs: grep -v '\#' versions.txt | grep autoinstrumentation-nodejs | awk -F= '{print "AUTO_INSTRUMENTATION_NODEJS_VERSION="$2}' >> $GITHUB_ENV grep -v '\#' versions.txt | grep autoinstrumentation-python | awk -F= '{print "AUTO_INSTRUMENTATION_PYTHON_VERSION="$2}' >> $GITHUB_ENV grep -v '\#' versions.txt | grep autoinstrumentation-dotnet | awk -F= '{print "AUTO_INSTRUMENTATION_DOTNET_VERSION="$2}' >> $GITHUB_ENV + grep -v '\#' versions.txt | grep autoinstrumentation-apache-httpd | awk -F= '{print "AUTO_INSTRUMENTATION_APACHE_HTTPD_VERSION="$2}' >> $GITHUB_ENV echo "VERSION_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV echo "VERSION=$(git describe --tags | sed 's/^v//')" >> $GITHUB_ENV @@ -82,5 +83,6 @@ jobs: AUTO_INSTRUMENTATION_NODEJS_VERSION=${{ env.AUTO_INSTRUMENTATION_NODEJS_VERSION }} AUTO_INSTRUMENTATION_PYTHON_VERSION=${{ env.AUTO_INSTRUMENTATION_PYTHON_VERSION }} AUTO_INSTRUMENTATION_DOTNET_VERSION=${{ env.AUTO_INSTRUMENTATION_DOTNET_VERSION }} + AUTO_INSTRUMENTATION_APACHE_HTTPD_VERSION=${{ env.AUTO_INSTRUMENTATION_APACHE_HTTPD_VERSION }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache diff --git a/autoinstrumentation/apache-httpd/Dockerfile b/autoinstrumentation/apache-httpd/Dockerfile new file mode 100644 index 0000000000..6b99e022c1 --- /dev/null +++ b/autoinstrumentation/apache-httpd/Dockerfile @@ -0,0 +1,26 @@ + +############################ +# STEP 1 download the webserver agent +############################ +FROM alpine:latest as agent + +ARG version + +RUN mkdir /opt/opentelemetry +WORKDIR /opt/opentelemetry + +RUN wget https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/download/webserver%2Fv$version/opentelemetry-webserver-sdk-x64-linux.tgz.zip +RUN unzip opentelemetry-webserver-sdk-x64-linux.tgz.zip +RUN mkdir agent +RUN tar -xvf opentelemetry-webserver-sdk-x64-linux.tgz -C agent + +############################ +# STEP 2 download the webserver agent +############################ +FROM alpine:latest + +COPY --from=agent /opt/opentelemetry/agent/opentelemetry-webserver-sdk /opt/opentelemetry + +RUN chmod a+w /opt/opentelemetry/logs + +CMD ["cat", "Just delivering the Opentelemetry Apache/Nginx agent"] \ No newline at end of file diff --git a/autoinstrumentation/apache-httpd/README.md b/autoinstrumentation/apache-httpd/README.md new file mode 100644 index 0000000000..2ff4f1aa60 --- /dev/null +++ b/autoinstrumentation/apache-httpd/README.md @@ -0,0 +1,13 @@ +# How to build Apache HTTPD auto-instrumentation docker image + +To build image for Apache HTTPD auto instrumentation, use the following commands + +``` +export REPO_NAME="" +export IMAGE_NAME_PREFIX="autoinstrumentation-apache-httpd" +export IMAGE_VERSION=`cat version.txt` +export IMAGE_NAME=${REPO_NAME}/${IMAGE_NAME_PREFIX}:${IMAGE_VERSION} +docker build --build-arg version=${IMAGE_VERSION} . -t ${IMAGE_NAME} -t ${REPO_NAME}/${IMAGE_NAME_PREFIX}:latest +docker push ${IMAGE_NAME} +docker push ${REPO_NAME}/${IMAGE_NAME_PREFIX}:latest +``` diff --git a/autoinstrumentation/apache-httpd/version.txt b/autoinstrumentation/apache-httpd/version.txt new file mode 100644 index 0000000000..e6d5cb833c --- /dev/null +++ b/autoinstrumentation/apache-httpd/version.txt @@ -0,0 +1 @@ +1.0.2 \ No newline at end of file