Skip to content

Commit

Permalink
Updated based on Jeff's comments
Browse files Browse the repository at this point in the history
- Update download URLs for consistency
- Remove unecessary data copies
- Fix file permissions
  • Loading branch information
crobert-1 committed Jun 30, 2023
1 parent 2bde497 commit 1764627
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitlab/update-openjdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ create_collector_pr() {
if [[ -n "$version" ]]; then
echo ">>> Updating openjdk version to $version ..."
sed -i "s|^ARG JDK_VERSION=.*|ARG JDK_VERSION=${version}|" internal/signalfx-agent/bundle/Dockerfile
sed -i "s|^ARG JDK_VERSION=.*|ARG JDK_VERSION=${version}|" cmd/otelcol/Dockerfile.windows
else
echo "ERROR: Failed to get version from tag name '${tag}'!" >&2
exit 1
Expand Down
12 changes: 6 additions & 6 deletions cmd/otelcol/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ RUN Remove-Item agent-bundle_windows_amd64.zip -force
# Download JMX Metric Gatherer
ARG JMX_METRIC_GATHERER_RELEASE
RUN New-Item -Path "C:\\" -Name "opt" -ItemType "directory"
RUN Invoke-WebRequest -Uri "https://repo1.maven.org/maven2/io/opentelemetry/contrib/opentelemetry-jmx-metrics/$env:JMX_METRIC_GATHERER_RELEASE/opentelemetry-jmx-metrics-$env:JMX_METRIC_GATHERER_RELEASE.jar" -Outfile "c:\opt\opentelemetry-java-contrib-jmx-metrics.jar"
RUN Invoke-WebRequest -Uri "https://github.com/open-telemetry/opentelemetry-java-contrib/releases/download/v$env:JMX_METRIC_GATHERER_RELEASE/opentelemetry-jmx-metrics.jar" -Outfile "c:\opt\opentelemetry-java-contrib-jmx-metrics.jar"

ARG JAVA_VERSION="11.0.13_8"
ARG OPENJDK_BASE_URL="https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download"
ARG JAVA_HOME="C:\java\openjdk-${JAVA_VERSION}\bin"
RUN Set-Variable -Name "ENCODED_VER" -Value "\"$env:JAVA_VERSION\".replace(\"_\", \"%2B\")"; \
Invoke-WebRequest -Uri "$env:OPENJDK_BASE_URL/jdk-$ENCODED_VER/OpenJDK11U-jdk_x64_windows_$env:JAVA_VERSION.zip" -OutFile "openjdk.zip" ; \
ARG JDK_VERSION="11.0.13_8"
ARG OPENJDK_BASE_URL="https://github.com/adoptium/temurin11-binaries/releases/download"
ARG JAVA_HOME="C:\java\openjdk-${JDK_VERSION}\bin"
RUN Set-Variable -Name "ENCODED_VER" -Value "\"$env:JDK_VERSION\".replace(\"_\", \"%2B\")"; \
Invoke-WebRequest -Uri "$env:OPENJDK_BASE_URL/jdk-$ENCODED_VER/OpenJDK11U-jdk_x64_windows_$env:JDK_VERSION.zip" -OutFile "openjdk.zip" ; \
Expand-Archive "openjdk.zip" -DestinationPath "C:\java" ;
RUN setx PATH "$env:JAVA_HOME;$env:PATH"

Expand Down
8 changes: 7 additions & 1 deletion internal/buildscripts/packaging/fpm/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ download_jmx_metric_gatherer() {
local version="$1"
local buildroot="$2"

JMX_METRIC_GATHERER_RELEASE_DL_URL="https://repo1.maven.org/maven2/io/opentelemetry/contrib/opentelemetry-jmx-metrics/$version/opentelemetry-jmx-metrics-$version.jar"
JMX_METRIC_GATHERER_RELEASE_DL_URL="https://github.com/open-telemetry/opentelemetry-java-contrib/releases/download/v$version/opentelemetry-jmx-metrics.jar"
mkdir -p "$buildroot/opt"

echo "Downloading ${JMX_METRIC_GATHERER_RELEASE_DL_URL}"
Expand Down Expand Up @@ -113,4 +113,10 @@ setup_files_and_permissions() {
sudo chown -R $SERVICE_USER:$SERVICE_GROUP "$buildroot/$BUNDLE_BASE_DIR"
sudo chmod -R 755 "$buildroot/$BUNDLE_BASE_DIR"
fi

JMX_INSTALL_PATH="$buildroot/opt/opentelemetry-java-contrib-jmx-metrics.jar"
if [[ -e "$JMX_INSTALL_PATH"]]; then
sudo chown root:root "$JMX_INSTALL_PATH"
sudo chmod 755 "$JMX_INSTALL_PATH"
fi
}
8 changes: 5 additions & 3 deletions internal/buildscripts/packaging/msi/msi-builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,13 @@ download_jmx_metric_gatherer() {
local version="$1"
local build_dir="$2"
local output_dir="$3"
JMX_METRIC_GATHERER_RELEASE_DL_URL="https://repo1.maven.org/maven2/io/opentelemetry/contrib/opentelemetry-jmx-metrics/$version/opentelemetry-jmx-metrics-$version.jar"
jmx_filename="opentelemetry-java-contrib-jmx-metrics.jar"
JMX_METRIC_GATHERER_RELEASE_DL_URL="https://github.com/open-telemetry/opentelemetry-java-contrib/releases/download/v$version/opentelemetry-jmx-metrics.jar"
echo "Downloading ${JMX_METRIC_GATHERER_RELEASE_DL_URL}..."

curl -sL "$JMX_METRIC_GATHERER_RELEASE_DL_URL" -o "${build_dir}/opentelemetry-java-contrib-jmx-metrics.jar"
mv "${build_dir}/opentelemetry-java-contrib-jmx-metrics.jar" "$output_dir"
curl -sL "$JMX_METRIC_GATHERER_RELEASE_DL_URL" -o "${build_dir}/"
mv "${build_dir}/${jmx_filename}" "$output_dir"
cp "${output_dir}/${jmx_filename}" "/opt/${jmx_filename}"

# Delete unnecessary files.
rm -f "${build_dir}/opentelemetry-java-contrib-jmx-metrics.jar"
Expand Down
2 changes: 0 additions & 2 deletions internal/buildscripts/packaging/msi/splunk-otel-collector.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@
<!-- Copy the default agent config file to ProgramData if it does not already exist -->
<CustomAction Id="CopyConfig" ExeCommand="xcopy /y &quot;[INSTALLDIR]agent_config.yaml&quot; &quot;[CommonAppDataFolder]Splunk\OpenTelemetry Collector\agent_config.yaml*&quot;" Directory="INSTALLDIR" Impersonate="no" Execute="deferred" Return="check" />
<!-- Copy the JMX Metric Gatherer JAR to opt if it does not already exist -->
<CustomAction Id="CopyJMXJAR" ExeCommand="xcopy /y &quot;[INSTALLDIR]opentelemetry-java-contrib-jmx-metrics.jar&quot; &quot;[WindowsVolume]\opt\opentelemetry-java-contrib-jmx-metrics.jar*&quot;" Directory="INSTALLDIR" Impersonate="no" Execute="deferred" Return="check" />
<InstallExecuteSequence>
<Custom Action="CopyConfig" After="InstallFiles">NOT CONFIG_FILE_EXISTS AND NOT Installed</Custom>
<Custom Action="CopyJMXJAR" After="InstallFiles">UPGRADINGPRODUCTCODE OR NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>

0 comments on commit 1764627

Please sign in to comment.