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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright 2020 - 2022 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epam.drill.agent.transport

import com.epam.drill.agent.common.transport.AgentMessage
import kotlinx.serialization.Serializable

@Serializable
class BuildPayload(
val groupId: String,
val appId: String,
val commitSha: String? = null,
val buildVersion: String? = null,
val branch: String? = null,
val commitDate: String? = null,
val commitMessage: String? = null,
val commitAuthor: String? = null
) : AgentMessage()
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2020 - 2022 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epam.drill.agent.transport

import com.epam.drill.agent.common.transport.AgentMessage
import kotlinx.serialization.Serializable

@Serializable
class InstancePayload(
val groupId: String,
val appId: String,
val instanceId: String,
val commitSha: String? = null,
val buildVersion: String? = null,
val envId: String? = null,
): AgentMessage()
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.epam.drill.agent.common.transport.AgentMessageSender
import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable

Check warning on line 32 in java-agent/src/jvmMain/kotlin/com/epam/drill/agent/transport/JvmModuleMessageSender.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import.

See more on https://sonarcloud.io/project/issues?id=Drill4J_java-agent&issues=AZsNZ5eoVeUoCtH_KBED&open=AZsNZ5eoVeUoCtH_KBED&pullRequest=197

actual object JvmModuleMessageSender : AgentMessageSender {

Expand All @@ -43,16 +44,28 @@
actual fun sendAgentMetadata() {
messageSender.send(
AgentMessageDestination("PUT", "instances"),
Configuration.agentMetadata,
AgentMetadata.serializer()
InstancePayload(
groupId = Configuration.agentMetadata.groupId,
appId = Configuration.agentMetadata.appId,
instanceId = Configuration.agentMetadata.instanceId,
commitSha = Configuration.agentMetadata.commitSha,
buildVersion = Configuration.agentMetadata.buildVersion,
envId = Configuration.agentMetadata.envId
),
InstancePayload.serializer()
)
}

fun sendBuildMetadata() {
messageSender.send(
AgentMessageDestination("PUT", "builds"),
Configuration.agentMetadata,
AgentMetadata.serializer()
BuildPayload(
groupId = Configuration.agentMetadata.groupId,
appId = Configuration.agentMetadata.appId,
commitSha = Configuration.agentMetadata.commitSha,
buildVersion = Configuration.agentMetadata.buildVersion
),
BuildPayload.serializer()
)
}

Expand Down Expand Up @@ -81,6 +94,7 @@
"DIRECT" -> SimpleAgentMessageSender(transport, serializer, mapper).also {
logger.info { "Using DIRECT message sending mode." }
}

"QUEUED" -> QueuedAgentMessageSender(
transport, serializer, mapper, queue,
maxRetries = Configuration.parameters[ParameterDefinitions.MESSAGE_MAX_RETRIES]
Expand Down
Loading