Skip to content

Commit

Permalink
Adding a path to install ops-agent plugin when running nightly build (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelwestphal authored Feb 19, 2025
1 parent dbb67c0 commit 6602f6c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions integration_test/agents/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ func getRestartOpsAgentCmd(imageSpec string) string {
if gce.IsWindows(imageSpec) {
return ""
}
return fmt.Sprintf("grpcurl -plaintext -d '{}' localhost:%s plugin_comm.GuestAgentPlugin/Stop && grpcurl -plaintext -d '{}' localhost:%s plugin_comm.GuestAgentPlugin/Start", OpsAgentPluginServerPort, OpsAgentPluginServerPort)
return fmt.Sprintf("grpcurl -plaintext -d '{}' localhost:%s plugin_comm.GuestAgentPlugin/Stop && sleep 5 && grpcurl -plaintext -d '{}' localhost:%s plugin_comm.GuestAgentPlugin/Start", OpsAgentPluginServerPort, OpsAgentPluginServerPort)
}

if gce.IsWindows(imageSpec) {
Expand Down Expand Up @@ -769,10 +769,12 @@ func InstallOpsAgent(ctx context.Context, logger *log.Logger, vm *gce.VM, locati
if location.artifactRegistryRegion != "" && location.repoSuffix == "" {
return fmt.Errorf("invalid PackageLocation: location.artifactRegistryRegion was nonempty yet location.repoSuffix was empty. location=%#v", location)
}

if IsOpsAgentUAPPlugin() {
return InstallOpsAgentUAPPlugin(ctx, logger, vm, location)
}

if location.packagesInGCS != "" {
if IsOpsAgentUAPPlugin() {
return InstallOpsAgentUAPPluginFromGCS(ctx, logger, vm, location.packagesInGCS)
}
return InstallPackageFromGCS(ctx, logger, vm, location.packagesInGCS)
}

Expand Down Expand Up @@ -932,6 +934,17 @@ func CommonSetupWithExtraCreateArgumentsAndMetadata(t *testing.T, imageSpec stri
return ctx, logger, vm
}

func InstallOpsAgentUAPPlugin(ctx context.Context, logger *log.Logger, vm *gce.VM, location PackageLocation) error {
// Used for manual testing or pre-submits
if location.packagesInGCS != "" {
return InstallOpsAgentUAPPluginFromGCS(ctx, logger, vm, location.packagesInGCS)
}

// Used for nightly builds
artifactBucket := fmt.Sprintf("gs://%s-ops-agent-releases/%s", location.artifactRegistryProject, location.repoSuffix)
return InstallOpsAgentUAPPluginFromGCS(ctx, logger, vm, artifactBucket)
}

// InstallOpsAgentUAPPluginFromGCS installs the Ops Agent plugin tarball from GCS onto the given Linux VM.
//
// gcsPath must point to a GCS Path to a .tar.gz file to install on the testing VMs.
Expand Down

0 comments on commit 6602f6c

Please sign in to comment.