diff --git a/Dockerfile.windows b/Dockerfile.windows index bbbe0c8ba8..aff635cada 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -352,8 +352,8 @@ COPY . /work ARG WINDOWS_VERSION ARG BUILD_DISTRO=windows-$WINDOWS_VERSION RUN Get-Content VERSION | Where-Object length | ForEach-Object { Invoke-Expression "`$env:$_" }; ` - go build -o bin/plugin.exe -ldflags \"-X github.com/GoogleCloudPlatform/ops-agent/internal/version.BuildDistro=$env:BUILD_DISTRO -X github.com/GoogleCloudPlatform/ops-agent/internal/version.Version=$env:PKG_VERSION\" ./cmd/ops_agent_uap_plugin; ` - Copy-Item -Path bin/plugin.exe -Destination /work/out/bin/; ` + go build -o bin/ops_agent.exe -ldflags \"-X github.com/GoogleCloudPlatform/ops-agent/internal/version.BuildDistro=$env:BUILD_DISTRO -X github.com/GoogleCloudPlatform/ops-agent/internal/version.Version=$env:PKG_VERSION\" ./cmd/ops_agent_uap_plugin; ` + Copy-Item -Path bin/ops_agent.exe -Destination /work/out/bin/; ` $env:PKG_VERSION | Out-File -FilePath /work/out/bin/OPS_AGENT_VERSION -Encoding UTF8; ############################################################################### diff --git a/builds/ops_agent_plugin.sh b/builds/ops_agent_plugin.sh index 9e6ac33a06..d191621c9a 100755 --- a/builds/ops_agent_plugin.sh +++ b/builds/ops_agent_plugin.sh @@ -17,5 +17,5 @@ set -x -e DESTDIR=$1 source VERSION && echo $PKG_VERSION > "$DESTDIR/OPS_AGENT_VERSION" mkdir -p "$DESTDIR/opt/google-cloud-ops-agent" -go build -buildvcs=false -ldflags "-s -w" -o "$DESTDIR/opt/google-cloud-ops-agent/plugin" \ +go build -buildvcs=false -ldflags "-s -w" -o "$DESTDIR/opt/google-cloud-ops-agent/ops_agent" \ github.com/GoogleCloudPlatform/ops-agent/cmd/ops_agent_uap_plugin \ No newline at end of file diff --git a/integration_test/agents/agents.go b/integration_test/agents/agents.go index ee4a04beb8..117025e068 100644 --- a/integration_test/agents/agents.go +++ b/integration_test/agents/agents.go @@ -52,6 +52,9 @@ const TrailingQueryWindow = 2 * time.Minute // OpsAgentPluginServerPort defines the port on which the Ops Agent UAP Plugin gRPC server runs. const OpsAgentPluginServerPort = "1234" +// OpsAgentPluginEntryPointName is the name of the entry point binary for the Ops Agent UAP Plugin. +const OpsAgentPluginEntryPointName = "ops_agent" + //go:embed testdata var scriptsDir embed.FS @@ -867,7 +870,7 @@ func StartOpsAgentPluginServer(ctx context.Context, logger *log.Logger, vm *gce. return nil } - if _, err := gce.RunRemotely(ctx, logger, vm, fmt.Sprintf("sudo nohup ~/plugin --address=localhost:%s --errorlogfile=errorlog.txt --protocol=tcp > ~/uap_plugin_out.log 2>&1 &", port)); err != nil { + if _, err := gce.RunRemotely(ctx, logger, vm, fmt.Sprintf("sudo nohup ~/%s --address=localhost:%s --errorlogfile=errorlog.txt --protocol=tcp > ~/uap_plugin_out.log 2>&1 &", OpsAgentPluginEntryPointName, port)); err != nil { return fmt.Errorf("StartOpsAgentPluginServer() failed to start the ops agent plugin: %v", err) } return nil diff --git a/integration_test/agents/testdata/start-uap-plugin-server.ps1 b/integration_test/agents/testdata/start-uap-plugin-server.ps1 index 48f093fdec..a591d5e648 100644 --- a/integration_test/agents/testdata/start-uap-plugin-server.ps1 +++ b/integration_test/agents/testdata/start-uap-plugin-server.ps1 @@ -1,7 +1,7 @@ $ErrorActionPreference = 'Stop' $taskName = "UAPWindowsPlugin" if (-not(Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue)) { - $action = New-ScheduledTaskAction -Execute "C:\plugin.exe" -Argument "-address localhost:1234 -errorlogfile errorlog.txt -protocol tcp" -WorkingDirectory "C:\" + $action = New-ScheduledTaskAction -Execute "C:\ops_agent.exe" -Argument "-address localhost:1234 -errorlogfile errorlog.txt -protocol tcp" -WorkingDirectory "C:\" $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) $principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest Register-ScheduledTask -TaskName $taskName -Action $action -Principal $principal diff --git a/integration_test/ops_agent_test/main_test.go b/integration_test/ops_agent_test/main_test.go index 53de10d2af..d814ebe532 100644 --- a/integration_test/ops_agent_test/main_test.go +++ b/integration_test/ops_agent_test/main_test.go @@ -917,7 +917,7 @@ func TestKillChildJobsWhenPluginServerProcessTerminates(t *testing.T) { t.Error("expected the plugin to report that the Ops Agent is running") } - _, processName, err := fetchPIDAndProcessName(ctx, logger, vm, []string{"plugin"}) + _, processName, err := fetchPIDAndProcessName(ctx, logger, vm, []string{agents.OpsAgentPluginEntryPointName}) if err != nil { t.Fatal(err) } diff --git a/pkg/plugin/build.ps1 b/pkg/plugin/build.ps1 index 10ea153691..3903ecc96e 100644 --- a/pkg/plugin/build.ps1 +++ b/pkg/plugin/build.ps1 @@ -60,7 +60,7 @@ $FilesToInclude = @( "opentelemetry-java-contrib-jmx-metrics.jar", "google-cloud-metrics-agent_windows_${GoArch}.exe", "google-cloud-ops-agent-wrapper.exe" - "plugin.exe" + "ops_agent.exe" "THIRD_PARTY_LICENSES" "OPS_AGENT_VERSION" ) diff --git a/pkg/plugin/build.sh b/pkg/plugin/build.sh index cfc3985141..bcffb8be2e 100755 --- a/pkg/plugin/build.sh +++ b/pkg/plugin/build.sh @@ -31,7 +31,7 @@ mkdir -p ${PLUGIN_DIR}/THIRD_PARTY_LICENSES touch ${PLUGIN_DIR}/THIRD_PARTY_LICENSES/license.txt cp /work/google_cloud_ops_agent_engine ${PLUGIN_DIR}/libexec/google_cloud_ops_agent_engine -cp $WS/opt/google-cloud-ops-agent/plugin ${PLUGIN_DIR}/plugin +cp $WS/opt/google-cloud-ops-agent/ops_agent ${PLUGIN_DIR}/ops_agent cp $WS/opt/google-cloud-ops-agent/libexec/google_cloud_ops_agent_wrapper ${PLUGIN_DIR}/libexec/google_cloud_ops_agent_wrapper cp $WS/opt/google-cloud-ops-agent/subagents/opentelemetry-collector/otelopscol ${PLUGIN_DIR}/subagents/opentelemetry-collector/otelopscol