Giphy API2.0.1Minimum Jenkins requirement: 2.7.4ID: pipeline-giphy-api

Pipeline Giphy Api plugin

Jenkins Plugin Jenkins Plugin Installs

Table of Contents

Introduction

This plugin expose giphy API within your Jenkins pipeline, both straight forward APIs and some customs.
For more information look here: Giphy for Developers

Configuration

Set your api key in credentials section on Jenkins.

  1. Choose Credentials
    credentials-step-1
  2. Choose System
    credentials-step-2
  3. Choose Global credentials
    credentials-step-3
  4. Choose Add Credentials
    credentials-step-4
  5. Fill the form as follow
    credentials-step-5
    1. Kind: Secret text
    2. Scope: Global
    3. Secret:
    4. ID: The id to use in the pipelines
    5. Description: Write whatever you want

Steps

Giphy Search API Steps

giphySearch - return list of urls matched to the keyword
giphySearchRandomByKeyword - return the url of random gif by the keyword. my custom implementation of Giphy Random API

Search Variables

  • credentialsId required - The credential you saved to jenkins. See here.
  • keyword required - The Keyword to search.
  • rating default - g - MPAA rating filters of the images - Y, G, PG, PG-13 and R.
  • imageSize default - downsized_medium - Image size from giphy. See more details here.

Search Example

Search Declarative pipeline

pipeline {
  agent none
  stages {
    stage("foo") {
      steps {
          echo giphySearch(credentialsId: 'giphy', keyword: 'success', rating: 'g').toString()
      }
    }
  }
}

Output is:

Started by user unknown or anonymous
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] stage
[Pipeline] { (foo)
[Pipeline] giphySearch
[Pipeline] echo
[https://media0.giphy.com/media/l3q2BXqLMnzhVF720/giphy.gif, https://media0.giphy.com/media/3o7TKtsBMu4xzIV808/giphy.gif, https://media3.giphy.com/media/LWVn0cCgpRt8Q/giphy.gif, https://media0.giphy.com/media/V80Bk9rW9ZpVC/giphy.gif, https://media1.giphy.com/media/xNBcChLQt7s9a/giphy.gif, https://media1.giphy.com/media/l3q2Z6S6n38zjPswo/giphy.gif, https://media1.giphy.com/media/GS1VR900wmhJ6/giphy.gif, https://media1.giphy.com/media/yGlu7x5jfWGZi/giphy.gif, https://media1.giphy.com/media/2vA33ikUb0Qz6/giphy.gif, https://media1.giphy.com/media/3ov9jSmllAIKuthAe4/giphy.gif, https://media2.giphy.com/media/3ohhwo4PzDFaz2sADu/giphy.gif, https://media2.giphy.com/media/itVfItoFSikqQ/giphy.gif, https://media0.giphy.com/media/T0WzQ475t9Cw/giphy.gif, https://media3.giphy.com/media/nXxOjZrbnbRxS/giphy.gif, https://media3.giphy.com/media/111ebonMs90YLu/giphy.gif, https://media0.giphy.com/media/uudzUtVcsLAoo/giphy.gif, https://media0.giphy.com/media/4xpB3eE00FfBm/giphy-downsized-medium.gif, https://media1.giphy.com/media/OHZ1gSUThmEso/giphy.gif, https://media1.giphy.com/media/zaqclXyLz3Uoo/giphy.gif, https://media2.giphy.com/media/XreQmk7ETCak0/giphy.gif, https://media0.giphy.com/media/KEVNWkmWm6dm8/giphy.gif, https://media2.giphy.com/media/vtVpHbnPi9TLa/giphy.gif, https://media2.giphy.com/media/oGO1MPNUVbbk4/giphy.gif, https://media0.giphy.com/media/26gsobowozGM9umBi/giphy.gif, https://media3.giphy.com/media/aWRWTF27ilPzy/giphy.gif]
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
Finished: SUCCESS

Search Scripted pipeline

node {
    def gif = giphySearchRandomByKeyword(credentialsId: 'giphy', keyword: "keyword", rating: 'g', imageSize: 
    'downsized_medium')
    echo gif
}

Output is:

Started by user unknown or anonymous
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in D:\GitHub\giphy-plugin\work\jobs\test\workspace
[Pipeline] {
[Pipeline] giphySearchRandomByKeyword
[Pipeline] echo
https://media3.giphy.com/media/1tykcAaWUvIY/giphy-downsized-medium.gif
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

Giphy Translate API Steps

giphyTranslate - return url matched to the keyword

Translate Variables

  • credentialsId required - The credential you saved to jenkins. See here.
  • keyword required - The Keyword to search.
  • imageSize default - downsized_medium - Image size from giphy. See more details here.

Translate Example

Translate Declarative pipeline

pipeline {
  agent none
  stages {
    stage("foo") {
      steps {
          echo giphyTranslate(credentialsId: 'giphy', keyword: 'success').toString()
      }
    }
  }
}

Output is:

Started by user admin
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] stage
[Pipeline] { (foo)
[Pipeline] giphyTranslate
[Pipeline] echo
https://media2.giphy.com/media/2cZlphZGMk4RW/giphy.gif
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
Finished: SUCCESS

Translate Scripted pipeline

node {
    def gif = giphyTranslate(credentialsId: 'giphy', keyword: "keyword", imageSize: 
    'downsized_medium')
    echo gif
}

Output is:

Started by user admin
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/test
[Pipeline] {
[Pipeline] giphyTranslate
[Pipeline] echo
https://media1.giphy.com/media/2t9ASqRNjQTNNXv5ob/giphy-downsized-medium.gif
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

Giphy Trending API Steps

TODO

Giphy Random API Steps

giphyRandom - return random url matched to the keyword

Random Variables

  • credentialsId required - The credential you saved to jenkins. See here.
  • tag required - The tag to search.
  • rating default - g - MPAA rating filters of the images - Y, G, PG, PG-13 and R.
  • imageSize default - downsized_medium - Image size from giphy. See more details here.

Random Example

Random Declarative pipeline

pipeline {
  agent none
  stages {
    stage("foo") {
      steps {
          echo giphyRandom(credentialsId: 'giphy', tag: 'success').toString()
      }
    }
  }
}

Output is:

Started by user admin
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] stage
[Pipeline] { (foo)
[Pipeline] giphyRandom
[Pipeline] echo
https://media2.giphy.com/media/cN1RJVaYCht96/giphy.gif
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
Finished: SUCCESS

Random Scripted pipeline

node {
    def gif = giphyRandom(credentialsId: 'giphy', tag: "tag", rating: 'pg-13', imageSize: 
    'downsized_medium')
    echo gif
}

Output is:

Started by user admin
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/test
[Pipeline] {
[Pipeline] giphyRandom
[Pipeline] echo
https://media0.giphy.com/media/6pipAdjEVrVBK/giphy.gif
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
ArchivesGet past versions
Links
Labels
This plugin has no labels