Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud Profiles "Events" #230

Open
Super8film87 opened this issue Nov 15, 2023 · 4 comments
Open

Cloud Profiles "Events" #230

Super8film87 opened this issue Nov 15, 2023 · 4 comments

Comments

@Super8film87
Copy link

Hey,

I was asking myself what would be needed to send "events" if e.g.

  • buildConfigurations change/add
  • Projects change/add
  • CloudProfiles change/add

By today handling all agents with a mix of cloud profiles is really complicated. Once somebody did a change it is hard to monitor so I proposed to have a look to use the webhooks maybe in the future.
Do you have any thoughts about that?

@netwolfuk
Copy link
Member

@netwolfuk
Copy link
Member

Every event is quite a lot of work to implement for me.
You might be able to get the same information from watching the log files on the server, and pushing that to Elastic.

@Super8film87
Copy link
Author

I found some information that I want to use:

## "cloudprofil" : [
## #foreach ($feature in $project.getAvailableFeatures())    
##         #if ($feature.getType() == 'CloudImage' && $feature.getParameters().get("image-name-prefix").startsWith("AGENT_"))
##             ##if ($feature.getParameters().get("image-name-prefix").startsWith("AGENT_"))
##             {
##                 #foreach ($param in $feature.getParameters().keySet())
##                     #if (!$param.startsWith("user-script"))
##                     "$param" : "$feature.getParameters().get($param)" #if( $foreach.hasNext ),#end
##                     #end
##                 #end
##             }#if( $foreach.hasNext ),#end
##             #end
##         #end
## #end
## ],
....

problem is that I dont understand how to identified latest item :(

@netwolfuk
Copy link
Member

Hi @Super8film87 I don't have any cloud profiles enabled, so I am unsure what information you get.

How do you define "latest item"? Do you just mean the first matching item in the keyset? Or the last matching item in the keySet?

Having a quick look at this code above I have the following suggestions:

  1. Trying using getAvailableFeaturesOfType​('cloudImage'), then you can remove the first statement in the if where it checks with getType().
  2. The problem as I see it is that the last value in the foreach might not be user-script, so you can't assume that hasNext will behave as you want it. You might be more successful creating a new array, and putting the user-script items into it when you find them. Then iterate over that array when building the JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants