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 write(name, value){ | |
| def instance = Jenkins.getInstance() | |
| def globalProps = hudson.model.Hudson.instance.globalNodeProperties | |
| def props = globalProps.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class) | |
| for (prop in props) { | |
| prop.envVars.put(name,value) | |
| } | |
| instance.save() | |
| } |
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 file_exists(filename){ | |
| try{ | |
| return java.nio.file.Files.exists(java.nio.file.Paths.get(filename.toString())) | |
| } catch(e) { | |
| return false | |
| } | |
| } | |
| def arquivo = "/path/do/meu/arquivo" |
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
| class Files{ | |
| def static read(filename){ | |
| return new java.nio.file.Files.File("${filename}").text | |
| } | |
| def static void write(filename, string){ | |
| new java.nio.file.Files.File(filename).write(string) | |
| } |
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.* | |
| import jenkins.model.* | |
| class Environment{ | |
| def static void write(name, value){ | |
| def instance = Jenkins.getInstance() | |
| def globalProps = hudson.model.Hudson.instance.globalNodeProperties | |
| def props = globalProps.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class) | |
| for (prop in props) { |
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; | |
| class Folders{ | |
| def static all(){ | |
| return Jenkins | |
| .getInstance() | |
| .getAllItems(com.cloudbees.hudson.plugins.folder.Folder.class) | |
| .toArray() | |
| } |
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 | |
| class Yaml{ | |
| def static parse(string){ | |
| return new Snakeyaml().load(string) |
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
| node { | |
| println "OBTENDO SERVICE ACCOUNTS DO PROJETO GCLOUD" | |
| withCredentials ([ | |
| file (credentialsId: 'GCLOUD_SA', variable: "GCLOUD_SA") | |
| ]) { | |
| println "OBTENDO TEMPLATE PARA BUILD DO CONTAINER" | |
| configFileProvider([ | |
| configFile(fileId: 'dockerfile-gcloudsdk', variable: 'GCLOUD_SDK_DOCKERFILE') | |
| ]) { | |
| println "REALIZANDO BUILD DO GCLOUD_SDK_DOCKERFILE GCLOUD_SDK_DOCKERFILE" |
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
| FROM google/cloud-sdk:alpine | |
| RUN apk --update add openjdk7-jre | |
| RUN gcloud components install app-engine-java kubectl |
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
| FROM google/cloud-sdk:alpine | |
| RUN apk --update add openjdk7-jre | |
| RUN gcloud components install app-engine-java kubectl |
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 _provisioningMysqlUser(host, master_username, master_password, new_username, new_username_password) { | |
| docker.image('mysql:5').inside(" --net=host ") { | |
| def sqlCreateUser = "CREATE USER '${new_username}'@'%' IDENTIFIED BY '${new_username_password}';" | |
| sh """ mysql -h ${host} -u ${master_username} --password="${master_password}" -e "${sqlCreateUser}" """ | |
| def sqlGrantAllPriv = "GRANT ALL PRIVILEGES ON *.* TO '${new_username}'@'%';" | |
| sh """ mysql -h ${host} -u ${master_username} --password="${master_password}" -e "${sqlGrantAllPriv}" """ | |
| } | |
| } |