Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / jenkins-admin / set_global_properties.groovy
1 /*
2  * SPDX-License-Identifier: EPL-1.0
3  * Copyright (c) 2018 The Linux Foundation and others.
4  *
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  */
10
11 /**
12  * Manage Jenkins Global Properties by injecting configuration defined here
13  *
14  * In LFCI a Jenkins job script will replace the JENKINS_URL line below and
15  * inject the managed list of global variables.
16  */
17
18 def global_vars = [
19     'JENKINS_URL': 'https://localhost:8080',
20 ]
21
22 def gnode_prop = Jenkins.getInstance().getGlobalNodeProperties()
23 def properties = new hudson.slaves.EnvironmentVariablesNodeProperty()
24 gnode_prop.replace(properties)
25 env_vars = properties.getEnvVars()
26
27 env_vars.clear()
28 global_vars.each{ k, v -> env_vars.put(k, v) }
29 Jenkins.instance.save()