This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Grapes( | |
| @Grab(group='org.yaml', module='snakeyaml', version='1.23') | |
| ) | |
| import org.yaml.snakeyaml.Yaml as Snakeyaml | |
| import groovy.json.JsonSlurper | |
| import groovy.json.JsonSlurperClassic | |
| import groovy.json.JsonBuilder | |
| import groovy.json.JsonOutput | |
| import groovy.json.JsonParserType |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jenkins.model.Jenkins; | |
| import com.cloudbees.plugins.credentials.* | |
| import com.cloudbees.plugins.credentials.common.* | |
| import com.cloudbees.plugins.credentials.domains.* | |
| import com.cloudbees.plugins.credentials.impl.* | |
| import com.cloudbees.jenkins.plugins.sshcredentials.impl.* | |
| import org.jenkinsci.plugins.plaincredentials.* | |
| import org.jenkinsci.plugins.plaincredentials.impl.* | |
| import org.apache.commons.io.IOUtils; | |
| import hudson.plugins.sshslaves.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| withCredentials([ | |
| string( | |
| credentialsId: "SECRET_TEXT_EXEMPLE", | |
| variable: "SECRET_TEXT" | |
| ), | |
| usernamePassword( | |
| credentialsId: "SECRET_USERNAME_PASSWORD_EXEMPLE", | |
| usernameVariable: 'SECRET_USERNAME', | |
| passwordVariable: 'SECRET_PASSWORD' | |
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def slackfy(msg){ | |
| def hookURL = "https://hooks.slack.com/services/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" | |
| def payload ="""{"text":"${msg}","username":"Jenkins","icon_emoji":":jenkins:"}""" | |
| sh "curl -s -X POST --data-urlencode \'payload=${payload}\' ${hookURL}" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| URL_API=http://www.minhaapi.com.br/meu-endpoint | |
| TOKEN_NAME=access_token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| "scripts": { | |
| "ng": "ng", | |
| "config": "ts-node ./src/set-env.ts", | |
| "start": "npm run config -- --environment=dev && ng serve", | |
| "build": "npm run config && ng build --output-path=dist", | |
| "test": "ng test", | |
| "lint": "ng lint", | |
| "e2e": "ng e2e" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jenkins.model.Jenkins; | |
| import com.cloudbees.plugins.credentials.* | |
| import org.jenkinsci.plugins.plaincredentials.* | |
| import org.jenkinsci.plugins.plaincredentials.impl.* | |
| def _cred = CredentialsProvider.lookupCredentials( | |
| Credentials.class, | |
| Jenkins.getInstance(), | |
| null, | |
| null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def name = "NOME_DA_NAMESPACE" | |
| def solution = "NOME_DA_SOLUÇÃO" | |
| def existsK8sNamespace = sh (script: """kubectl get namespace --field-selector="metadata.name==${name}" -o jsonpath="{.items[*].metadata.name}" """ , returnStdout: true).trim() == "" ? false : true | |
| def existsK8sService = sh (script: """kubectl get service -n ${name} --field-selector="metadata.name==${solution}" -o jsonpath="{.items[*].metadata.name}" """ , returnStdout: true).trim() == "" ? false : true | |
| def existsK8sIngress = sh (script: """kubectl get ingress -n ${name} --field-selector="metadata.name==${name}" -o jsonpath="{.items[*].metadata.name}" """ , returnStdout: true).trim() == "" ? false : true | |
| def existsK8sDeployment = sh (script: """kubectl get deployment -n ${name} --field-selector="metadata.name==${solution}" -o jsonpath="{.items[*].metadata.name}" """ , returnStdout: true).trim() == "" ? false : true | |
| def existsK8sHPA = sh (script: """kubectl get hpa -n ${name} --field-selector="metadata.name==${solution}" -o jsonpath="{.items[*] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def folders = Jenkins.getInstance().getAllItems(com.cloudbees.hudson.plugins.folder.Folder.class) | |
| for(f in folders){ | |
| println "FOLDER: ${f.name}" | |
| def stores = com.cloudbees.plugins.credentials.CredentialsProvider.lookupStores(f); | |
| for (s in stores) { | |
| switch(s.getContext().getClass()){ | |
| case com.cloudbees.hudson.plugins.folder.Folder: | |
| println " STORE: ${s.getContext().name}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def _jenkins = Jenkins.getActiveInstance(); | |
| def _store = _jenkins.getExtensionList( | |
| org.jenkinsci.plugins.configfiles.GlobalConfigFiles.class | |
| ).get( | |
| org.jenkinsci.plugins.configfiles.GlobalConfigFiles.class | |
| ); | |
| println "CONFIGURAÇÕES GLOBAIS" | |
| def _configs = _store.getConfigs() | |
| for(c in _configs){ |
OlderNewer