Jenkins/vars/lolops.groovy

14 lines
574 B
Groovy

def getRandomDeliveryAttachment(Integer probability = 25) {
def deliveryImages = [
'https://media.giphy.com/media/UtM8DmnahknE4/giphy.gif',
'https://media.giphy.com/media/11VKF3OwuGHzNe/200w_d.gif',
'https://media.giphy.com/media/d5pGYhWb3T1Hyyl8OB/200w_d.gif',
'https://media.giphy.com/media/oTSy3rHigPd9S/giphy.gif'
]
Random rnd = new Random()
if (rnd.nextInt(100) < probability) {
return [];
}
def imageUrl = deliveryImages[rnd.nextInt(deliveryImages.size())]
return [[title: '', imageUrl: imageUrl]];
}