Skip to content

Commit 574fac9

Browse files
authored
fix: load .env during images build (#123)
1 parent 4bc5b15 commit 574fac9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.github/workflows/component_build-images-elastic.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ jobs:
113113
- uses: actions/checkout@v4
114114
with:
115115
fetch-depth: 0
116+
- name: Load environment variables from .env file
117+
run: |
118+
if [ -f .env ]; then
119+
# Filter out comments and empty lines, then add each variable to $GITHUB_ENV
120+
grep -vE '^\s*#|^\s*$' .env | while read -r line; do
121+
echo "$line" >> $GITHUB_ENV
122+
done
123+
else
124+
echo ".env file not found!"
125+
exit 1
126+
fi
116127
- name: Check for changes and set push options
117128
id: check_changes
118129
run: |
@@ -155,6 +166,10 @@ jobs:
155166
file: ${{ matrix.file_tag.file }}
156167
platforms: linux/amd64,linux/arm64
157168
push: ${{ inputs.push }}
169+
build-args: |
170+
OTEL_JAVA_AGENT_VERSION=${{ env.OTEL_JAVA_AGENT_VERSION }}
171+
OPENTELEMETRY_CPP_VERSION=${{ env.OPENTELEMETRY_CPP_VERSION }}
172+
TRACETEST_IMAGE_VERSION=${{ env.TRACETEST_IMAGE_VERSION }}
158173
tags: |
159174
${{ env.GHCR_REPO }}:${{ inputs.version }}-${{ matrix.file_tag.tag_suffix }}
160175
${{ env.GHCR_REPO }}:latest-${{ matrix.file_tag.tag_suffix }}

0 commit comments

Comments
 (0)