diff --git a/.github/workflows/component_build-images-elastic.yml b/.github/workflows/component_build-images-elastic.yml index 2cc8190a3d..7c0d2633a6 100644 --- a/.github/workflows/component_build-images-elastic.yml +++ b/.github/workflows/component_build-images-elastic.yml @@ -113,6 +113,17 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Load environment variables from .env file + run: | + if [ -f .env ]; then + # Filter out comments and empty lines, then add each variable to $GITHUB_ENV + grep -vE '^\s*#|^\s*$' .env | while read -r line; do + echo "$line" >> $GITHUB_ENV + done + else + echo ".env file not found!" + exit 1 + fi - name: Check for changes and set push options id: check_changes run: | @@ -155,6 +166,10 @@ jobs: file: ${{ matrix.file_tag.file }} platforms: linux/amd64,linux/arm64 push: ${{ inputs.push }} + build-args: | + OTEL_JAVA_AGENT_VERSION=${{ env.OTEL_JAVA_AGENT_VERSION }} + OPENTELEMETRY_CPP_VERSION=${{ env.OPENTELEMETRY_CPP_VERSION }} + TRACETEST_IMAGE_VERSION=${{ env.TRACETEST_IMAGE_VERSION }} tags: | ${{ env.GHCR_REPO }}:${{ inputs.version }}-${{ matrix.file_tag.tag_suffix }} ${{ env.GHCR_REPO }}:latest-${{ matrix.file_tag.tag_suffix }}