Skip to content

Commit

Permalink
Apache instrumentation v1.0 (#1236)
Browse files Browse the repository at this point in the history
* Apache Instrumentation - Agent Image Build

* Rename deafult image name

* Github bld action for Apache HTTPD autoinstr img

* Added Apache HTTPD image to publish images act

* Heading change
  • Loading branch information
chrlic authored Nov 26, 2022
1 parent c7c8b05 commit 30561f0
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/publish-autoinstrumentation-apache-httpd.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .github/workflows/publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
26 changes: 26 additions & 0 deletions autoinstrumentation/apache-httpd/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
13 changes: 13 additions & 0 deletions autoinstrumentation/apache-httpd/README.md
Original file line number Diff line number Diff line change
@@ -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="<your-docker-image-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
```
1 change: 1 addition & 0 deletions autoinstrumentation/apache-httpd/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.2

0 comments on commit 30561f0

Please sign in to comment.