Skip to content

Instantly share code, notes, and snippets.

View Malinskiy's full-sized avatar

Anton Malinski Malinskiy

View GitHub Profile
kubernetesClient = new DefaultKubernetesClient() 
updateFlag = new AtomicBoolean(true)  
void watch() { 
println("Start watching")  
kubernetesClient.events().inNamespace(namespaceName).watch(new Watcher < Event > () { 
@Override  void eventReceived(Action action, Event resource) { 
// println("Event " + action.name() + " " + resource.toString())
updateFlag.set(true) 
}
String calculateConfig(Map configData) { 
def brothers = []  
Endpoints endpoints = kubernetesClient.endpoints()
.inNamespace(namespaceName)
.withName(serviceName)
.get() 
List < EndpointSubset > endpointItems = endpoints.getSubsets()  
endpointItems.each {
subset ->  
def brotherPort = subset.getPorts().find { it.name == 'http'}.port 
meta:
 boss-nexus: http://nexus.devops/repository/
 pod-nexus: http://localhost:8081
 service-namespace: devops
 service-name: nexus-proxy
config:
 maven2:
- name: maven-public
hosted:
- name: maven-releases
FROM groovy:3.0-alpine
 
ADD src/main/groovy/local.groovy /home/groovy/
ADD src/main/groovy/remote.groovy /home/groovy/
ADD src/main/groovy/run.sh /home/groovy/
ADD src/main/groovy/grapeConfig.xml /home/groovy/.groovy/
# repeating the command is a hacky way for http retrying
RUN groovy -Dgrape.root=/home/groovy/grapes -Dgroovy.grape.report.downloads=true -Divy.message.logger.level=4 local.groovy -do_nothing || \
groovy -Dgrape.root=/home/groovy/grapes -Dgroovy.grape.report.downloads=true -Divy.message.logger.level=4 local.groovy -do_nothing || \
#!/usr/bin/env sh
 
# fail if anything errors
set -e
# fail if a function call is missing an argument
set -u
username=$(cat /nexus-password/username)
password=$(cat /nexus-password/password)
ip=$POD_IP
@Malinskiy
Malinskiy / Device.kt
Created February 22, 2019 06:07
Marathon: Device interface
interface Device {
val operatingSystem: OperatingSystem
val serialNumber: String
val model: String
val manufacturer: String
val networkState: NetworkState
val deviceFeatures: Collection<DeviceFeature>
val healthy: Boolean
val abi: String
@Malinskiy
Malinskiy / DeviceProvider.kt
Created February 22, 2019 06:12
Marathon: Device Provider
interface DeviceProvider {
sealed class DeviceEvent {
class DeviceConnected(val device: Device) : DeviceEvent()
class DeviceDisconnected(val device: Device) : DeviceEvent()
}
val deviceInitializationTimeoutMillis: Long
suspend fun initialize(vendorConfiguration: VendorConfiguration)
suspend fun terminate()
fun subscribe() : Channel<DeviceEvent>
@Malinskiy
Malinskiy / TestParser.kt
Created February 22, 2019 06:15
Marathon: TestParser
interface TestParser {
fun extract(configuration: Configuration) : List<Test>
}
data class TestBatch(val tests: List<Test>)
data class TestShard(
val tests: Collection<Test>,
val flakyTests: Collection<Test> = emptyList()
)