Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -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;

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion builds/ops_agent_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion integration_test/agents/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ops_agent_test/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading