Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import groovy.json.JsonSlurper
- @NonCPS
- def parseResponse(response) {
- def list = new JsonSlurper().parseText( response )
- def repositories = []
- for (Map item : list) {
- repositories.push(item.ssh_url)
- //println "${item.ssh_url}"
- }
- return repositories
- }
- podTemplate(label: 'mypod', containers: [
- containerTemplate(name: 'golang', image: 'golang:1.6.3', ttyEnabled: true, command: 'cat')
- ]) {
- node ('mypod') {
- stage 'Find Repositories'
- // make call to GitHub API to list all repositories for Beacon project
- def response = httpRequest "https://api.github.com/teams/xxxx/repos?access_token=xxxx"
- // parse the response and write out a file containing the list of repositories
- def repositories = parseResponse(response.content)
- container('golang') {
- stage 'Checkout Repositories'
- for (String item : repositories) {
- git branch: 'master', credentialsId: '00b7a06b-b621-476f-a147-ec08b70c391e', url: item
- }
- //git branch: 'master', url: '[email protected]:XXXX/activeMqMessageQueueing.git', credentialsId: '00b7a06b-b621-476f-a147-ec08b70c391e'
- sh """
- sleep 600
- """
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment