I am trying to write a custom notification plugin based on
https://github.com/gocd-contrib/notification-skeleton-plugin and I can't
figure out how to get the repository URL from the StageStatusRequest
request body. May I ask for a quick help?
The URL is located here:
{"pipeline":{"name":"notif-test","counter":"15","group":"My-group","build-cause":[{"material":{"git-configuration":{"shallow-clone":false,"branch":"main","url":"[email protected]:mygroup/dummy.git"}
...
The type of
request.pipeline.buildCause.get(0).material.get("git-configuration") is
com.google.gson.internal.LinkedTreeMap and when I output its contents in
the log it's
{shallow-clone=false, branch=main, [email protected]:mygroup/dummy.git}
but when I further try to get the URL string like this
request.pipeline.buildCause.get(0).material.get("git-configuration").get("url")
the code doesn't compile with:
/plugin/src/main/java/com/example/notification/executors/StageStatusRequestExecutor.java:71:
error: cannot find symbol
LOG.info(String.format("DEBUG in StageStatusRequestExecutor
sendNotification url=%s",
request.pipeline.buildCause.get(0).material.get("git-configuration").get("url")));
symbol: method get(String)
location: class Object
(the error indicator ^ points to the dot next to get("url")). How could I
get the URL value from the map? Do I have to pass something else as the key
to get() ? Not a Java man so may be missiong something very basic here.
Thanks a lot.
--
You received this message because you are subscribed to the Google Groups
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/go-cd/9ee4f486-ba2b-4da1-b20a-418e3d7bd1een%40googlegroups.com.