提交 bc0b8505 编写于 作者: K Kohsuke Kawaguchi

Merge branch 'pull-434.2'

......@@ -55,6 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=rfe>
Made the list of environment variables in the help page pluggable
(<a href="https://github.com/jenkinsci/jenkins/pull/434">pull 434</a>)
<li class=rfe>
Added a new hook to enable matrix project axes to change its values per build.
(<a href="https://github.com/jenkinsci/jenkins/pull/449">pull 449</a>)
......
......@@ -157,6 +157,23 @@ public class ExtensionList<T> extends AbstractList<T> {
return ensureLoaded().size();
}
/**
* Gets the read-only view of this {@link ExtensionList} where components are reversed.
*/
public List<T> reverseView() {
return new AbstractList<T>() {
@Override
public T get(int index) {
return ExtensionList.this.get(size()-index-1);
}
@Override
public int size() {
return ExtensionList.this.size();
}
};
}
@Override
public synchronized boolean remove(Object o) {
removeComponent(legacyInstances,o);
......
......@@ -24,8 +24,10 @@
package hudson.model;
import hudson.EnvVars;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.scm.SCM;
import jenkins.model.Jenkins;
import java.io.IOException;
......@@ -38,6 +40,21 @@ import java.io.IOException;
* of the fixed name, a typical strategy is to look for specific {@link JobProperty}s and other similar configurations
* of {@link Job}s to compute values.
*
* <h2>Views</h2>
* <h4>buildEnv.groovy/.jelly</h4>
* <p>
* When Jenkins displays the help page listing all the environment variables available for a build, it does
* so by combining all the {@code buildEnv} views from this extension point. This view should use the &lt;t:buildEnvVar> tag
* to render a variable.
*
* <p>
* In this view, {@code it} points to {@link EnvironmentContributor} and {@code job} points to {@link Job} for which
* the help is being rendered.
*
* <p>
* Jenkins provides other extension points (such as {@link SCM}) to contribute environment variables to builds,
* and for those plugins, Jenkins also looks for {@code /buildEnv.groovy} and aggregates them.
*
* @author Kohsuke Kawaguchi
* @since 1.392
* @see BuildVariableContributor
......@@ -72,4 +89,24 @@ public abstract class EnvironmentContributor implements ExtensionPoint {
public static ExtensionList<EnvironmentContributor> all() {
return Jenkins.getInstance().getExtensionList(EnvironmentContributor.class);
}
/**
* Serves the combined list of environment variables available from this plugin.
*
* Served from "/env-vars.html"
*/
@Extension
public static class EnvVarsHtml implements RootAction {
public String getIconFileName() {
return null;
}
public String getDisplayName() {
return null;
}
public String getUrlName() {
return "env-vars.html";
}
}
}
......@@ -1932,35 +1932,9 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
*/
public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException {
EnvVars env = getCharacteristicEnvVars();
Computer c = Computer.currentComputer();
if (c!=null)
env = c.getEnvironment().overrideAll(env);
String rootUrl = Jenkins.getInstance().getRootUrl();
if(rootUrl!=null) {
env.put("JENKINS_URL", rootUrl);
env.put("HUDSON_URL", rootUrl); // Legacy compatibility
env.put("BUILD_URL", rootUrl+getUrl());
env.put("JOB_URL", rootUrl+getParent().getUrl());
}
env.put("JENKINS_HOME", Jenkins.getInstance().getRootDir().getPath() );
env.put("HUDSON_HOME", Jenkins.getInstance().getRootDir().getPath() ); // legacy compatibility
Thread t = Thread.currentThread();
if (t instanceof Executor) {
Executor e = (Executor) t;
env.put("EXECUTOR_NUMBER",String.valueOf(e.getNumber()));
if(e.getOwner() instanceof MasterComputer) {
env.put("NODE_NAME", "master");
} else {
env.put("NODE_NAME",e.getOwner().getName());
}
Node n = e.getOwner().getNode();
if (n!=null)
env.put("NODE_LABELS",Util.join(n.getAssignedLabels()," "));
}
for (EnvironmentContributor ec : EnvironmentContributor.all())
// apply them in a reverse order so that higher ordinal ones can modify values added by lower ordinal ones
for (EnvironmentContributor ec : EnvironmentContributor.all().reverseView())
ec.buildEnvironmentFor(this,env,log);
return env;
......
package jenkins.model;
import hudson.EnvVars;
import hudson.Extension;
import hudson.Util;
import hudson.model.Computer;
import hudson.model.EnvironmentContributor;
import hudson.model.Executor;
import hudson.model.Node;
import hudson.model.Run;
import hudson.model.TaskListener;
import jenkins.model.Jenkins.MasterComputer;
import java.io.IOException;
/**
* {@link EnvironmentContributor} that adds the basic set of environment variables that
* we've been exposing historically.
*
* @author Kohsuke Kawaguchi
*/
@Extension(ordinal=-100)
public class CoreEnvironmentContributor extends EnvironmentContributor {
@Override
public void buildEnvironmentFor(Run r, EnvVars env, TaskListener listener) throws IOException, InterruptedException {
Computer c = Computer.currentComputer();
if (c!=null)
c.getEnvironment().overrideAll(env);
Jenkins j = Jenkins.getInstance();
String rootUrl = j.getRootUrl();
if(rootUrl!=null) {
env.put("JENKINS_URL", rootUrl);
env.put("HUDSON_URL", rootUrl); // Legacy compatibility
env.put("BUILD_URL", rootUrl+r.getUrl());
env.put("JOB_URL", rootUrl+r.getParent().getUrl());
}
String root = j.getRootDir().getPath();
env.put("JENKINS_HOME", root);
env.put("HUDSON_HOME", root); // legacy compatibility
Thread t = Thread.currentThread();
if (t instanceof Executor) {
Executor e = (Executor) t;
env.put("EXECUTOR_NUMBER", String.valueOf(e.getNumber()));
if (e.getOwner() instanceof MasterComputer) {
env.put("NODE_NAME", "master");
} else {
env.put("NODE_NAME", e.getOwner().getName());
}
Node n = e.getOwner().getNode();
if (n != null)
env.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " "));
}
}
}
import hudson.model.EnvironmentContributor
def st = namespace("jelly:stapler")
html {
head {
title(_("Available Environmental Variables"))
style(type:"text/css", "dt { font-weight: bold; }")
}
body {
p "The following variables are available to shell scripts"
dl {
EnvironmentContributor.all().each { e -> st.include(it:e, page:"buildEnv", optional:true) }
}
}
}
Available\ Environmental\ Variables=Verf\u00FCgbare Umgebungsvariablen
The\ following\ variables\ are\ available\ to\ shell\ scripts=Die folgenden Variablen sind innerhalb von Shell-Skripten sichtbar:
\ No newline at end of file
Available\ Environmental\ Variables=Variables d'environnement disponibles
The\ following\ variables\ are\ available\ to\ shell\ scripts=Les variables suivantes sont mises \u00E0 disposition des scripts shell
\ No newline at end of file
Available\ Environmental\ Variables=\u5229\u7528\u53EF\u80FD\u306A\u74B0\u5883\u5909\u6570
The\ following\ variables\ are\ available\ to\ shell\ scripts=\u30B7\u30A7\u30EB\u30B9\u30AF\u30EA\u30D7\u30C8\u3067\u306F\u3001\u6B21\u306E\u5909\u6570\u3092\u5229\u7528\u3067\u304D\u307E\u3059\u3002
\ No newline at end of file
Available\ Environmental\ Variables=Beschikbare omgevingsparameters
The\ following\ variables\ are\ available\ to\ shell\ scripts=Volgende parameters zijn beschikbaar voor gebruik in uw scripts:
\ No newline at end of file
package jenkins.model.CoreEnvironmentContributor;
def l = namespace(lib.JenkinsTagLib)
// also advertises those contributed by Run.getCharacteristicEnvVars()
["BUILD_NUMBER","BUILD_ID","JOB_NAME","BUILD_TAG","EXECUTOR_NUMBER","NODE_NAME","NODE_LABELS","WORKSPACE","JENKINS_HOME","JENKINS_URL","BUILD_URL","JOB_URL"].each { name ->
l.buildEnvVar(name:name) {
raw(_("${name}.blurb"))
}
}
BUILD_NUMBER.blurb=The current build number, such as "153"
BUILD_ID.blurb=The current build id, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)
JOB_NAME.blurb=Name of the project of this build, such as "foo" or "foo/bar"
BUILD_TAG.blurb=String of "jenkins-<i>$'{'JOB_NAME}</i>-<i>$'{'BUILD_NUMBER}</i>". Convenient to put into a resource file, a jar file, etc for easier identification.
EXECUTOR_NUMBER.blurb=\
The unique number that identifies the current executor \
(among executors of the same machine) that''s \
carrying out this build. This is the number you see in \
the "build executor status", except that the number starts from 0, not 1.
NODE_NAME.blurb=Name of the slave if the build is on a slave, or "master" if run on master
NODE_LABELS.blurb=Whitespace-separated list of labels that the node is assigned.
WORKSPACE.blurb=The absolute path of the directory assigned to the build as a workspace.
JENKINS_HOME.blurb=The absolute path of the directory assigned on the master node for Jenkins to store data.
JENKINS_URL.blurb=Full URL of Jenkins, like <tt>http://server:port/jenkins/</tt>
BUILD_URL.blurb=Full URL of this build, like <tt>http://server:port/jenkins/job/foo/15/</tt>
JOB_URL.blurb=Full URL of this job, like <tt>http://server:port/jenkins/job/foo/</tt>
BUILD_NUMBER.blurb=Die aktuelle Build-Nummer, z.B. "153".
BUILD_ID.blurb=Die aktuelle Build-ID, z.B. "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss).
JOB_NAME.blurb=Projektname des Builds, z.B. "foo".
BUILD_TAG.blurb=Eine Zeichenkette in der Form "jenkins-<i>$'{'JOB_NAME}</i>-<i>$'{'BUILD_NUMBER}</i>". \
Diese Variable l\u00E4\u00DFt sich sehr bequem zur sp\u00E4teren Identifikation in eine \
Resource-Datei, JAR-Datei usw. ablegen.
EXECUTOR_NUMBER.blurb=Die laufende Nummer des Build-Prozessors, der den aktuellen Build ausf\u00FChrt \
(aus den Build-Prozessoren desselben Rechners). \
Dies ist die Nummer, die Sie auch im Build-Prozessor Status sehen - \
mit der Ausnahme, da\u00DF bei der Umgebungsvariable die Z\u00E4hlung bei 0 und nicht \
bei 1 beginnt.
NODE_NAME.blurb=Name des Build-Slaves, wenn auf einem Build-Slave gebaut wird, oder "master" wenn auf dem Master-Server gebaut wird.
NODE_LABELS.blurb=Durch Leerzeichen getrennte Liste von Labels, die dem Knoten zugeordnet sind.
WORKSPACE.blurb=Der absolute Pfad zum Arbeitsbereich.
JENKINS_HOME.blurb=
JENKINS_URL.blurb=Die absolute URL der Jenkins-Instanz, z.B. <tt>http://server:port/jenkins/</tt>.
BUILD_URL.blurb=Die absolute URL dieses Builds, z.B. <tt>http://server:port/jenkins/job/foo/15/</tt>.
JOB_URL.blurb=Die absolute URL dieses Jobs, z.B. <tt>http://server:port/jenkins/job/foo/</tt>.
BUILD_NUMBER.blurb=Le num\u00E9ro du build courant, par exemple "153"
BUILD_ID.blurb=L'identifiant du build courant, par exemple "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)
JOB_NAME.blurb=Nom du projet de ce build, par exemple "foo"
BUILD_TAG.blurb=Le texte "jenkins-<i>$'{'JOB_NAME}</i>-<i>$'{'BUILD_NUMBER}</i>", facile \u00E0 placer dans \
un fichier de ressource, ou un jar, pour identification future.
EXECUTOR_NUMBER.blurb=Le num\u00E9ro unique qui identifie l'ex\u00E9cuteur courant \
(parmi les ex\u00E9cuteurs d'une m\u00EAme machine) qui a contruit ce build. \
Il s'agit du num\u00E9ro que vous voyez dans le "statut de l'ex\u00E9cuteur du build", \
sauf que la num\u00E9rotation commence \u00E0 0 et non \u00E0 1.
NODE_NAME.blurb=
NODE_LABELS.blurb=
WORKSPACE.blurb=Le chemin absolu vers le r\u00E9pertoire de travail.
JENKINS_HOME.blurb=
JENKINS_URL.blurb=L'URL compl\u00E8te de Jenkins, au format <tt>http://server:port/jenkins/</tt>
BUILD_URL.blurb=
JOB_URL.blurb=
BUILD_NUMBER.blurb=\u5F53\u8A72\u30D3\u30EB\u30C9\u306E\u756A\u53F7\u3002\u4F8B "153"
BUILD_ID.blurb=\u5F53\u8A72\u30D3\u30EB\u30C9ID\u3002\u4F8B "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)
JOB_NAME.blurb=\u30D3\u30EB\u30C9\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u540D\u3002\u4F8B "foo"
BUILD_TAG.blurb=\u6587\u5B57\u5217 "jenkins-<i>$'{'JOB_NAME}</i>-<i>$'{'BUILD_NUMBER}</i>"\u3002\
\u7C21\u6613\u306A\u8B58\u5225\u5B50\u3068\u3057\u3066\u3001\u30EA\u30BD\u30FC\u30B9\u30D5\u30A1\u30A4\u30EB\u3084jar\u30D5\u30A1\u30A4\u30EB\u306A\u3069\u306B\u4ED8\u4E0E\u3059\u308B\u306E\u306B\u4FBF\u5229\u3067\u3059\u3002
EXECUTOR_NUMBER.blurb=\u3053\u306E\u30D3\u30EB\u30C9\u3092\u5B9F\u884C\u3057\u3066\u3044\u308B\u73FE\u5728\u306E\u30A8\u30B0\u30BC\u30AD\u30E5\u30FC\u30BF\u30FC\u3092\u8B58\u5225\u3059\u308B(\u540C\u4E00\u30DE\u30B7\u30F3\u306E\u4E2D\u3067)\u30E6\u30CB\u30FC\u30AF\u306A\u756A\u53F7\u3002\
"\u30D3\u30EB\u30C9\u5B9F\u884C\u72B6\u614B"\u306B\u8868\u793A\u3055\u308C\u3066\u3044\u308B\u6570\u5B57\u3067\u3059\u304C\u30011\u3067\u306F\u306A\u304F0\u304B\u3089\u59CB\u307E\u308B\u6570\u5B57\u3067\u3059\u3002
NODE_NAME.blurb=\u30D3\u30EB\u30C9\u304C\u5B9F\u884C\u3055\u308C\u308B\u30B9\u30EC\u30FC\u30D6\u306E\u540D\u79F0\u3002\u30DE\u30B9\u30BF\u30FC\u3067\u5B9F\u884C\u3055\u308C\u308B\u5834\u5408\u306F"master"\u3002
NODE_LABELS.blurb=\u30CE\u30FC\u30C9\u306B\u8A2D\u5B9A\u3055\u308C\u305F\u30E9\u30D9\u30EB\u306E\u30EA\u30B9\u30C8\uFF08\u30B9\u30DA\u30FC\u30B9\u533A\u5207\u308A)\u3002
WORKSPACE.blurb=\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306E\u7D76\u5BFE\u30D1\u30B9\u3002
JENKINS_HOME.blurb=
JENKINS_URL.blurb=Jenkins\u306EURL\u3002\u4F8B <tt>http://server:port/jenkins/</tt>
BUILD_URL.blurb=\u3053\u306E\u30D3\u30EB\u30C9\u306EURL\u3002 \u4F8B <tt>http://server:port/jenkins/job/foo/15/</tt>
JOB_URL.blurb=\u3053\u306E\u30B8\u30E7\u30D6\u306EURL\u3002 \u4F8B <tt>http://server:port/jenkins/job/foo/</tt>
BUILD_NUMBER.blurb=Het nummer van de huidige bouwpoging, v.b. "153"
BUILD_ID.blurb=Het identificatienummer van de huidige bouwpoging, v.b. "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)
JOB_NAME.blurb=Naam van het project dat gebouwd wordt door deze bouwpoging, v.b. "foo"
BUILD_TAG.blurb=Het label :"jenkins-<i>$'{'JOB_NAME}</i>-<i>$'{'BUILD_NUMBER}</i>". Dit label is typisch handig om \
ter identificatie op te nemen in een "resource"-bestand, archieven (zoals jar,war,ear,...), ... .
EXECUTOR_NUMBER.blurb=Het unieke nummer, waarmee uw huidige uitvoerder ge\u00EFdentifieerd kan worden op de server. \
Dit is het nummer dat u terugvindt in de "Status uitvoerders"-tabel op de hoofdpagina. \
Merk wel dat in die tabel geteld wordt vanaf 1. Uitvoerder 1 in de "Status uitvoerders"-tabel \
komt dus overeen met een "EXECUTOR_NUMBER" gelijk aan 0.
NODE_NAME.blurb=
NODE_LABELS.blurb=
WORKSPACE.blurb=Het absolute pad naar de werkplaats.
JENKINS_HOME.blurb=
JENKINS_URL.blurb=Volledige URL voor Jenkins, v.b. <tt>http://server:port/jenkins/</tt>
BUILD_URL.blurb=
JOB_URL.blurb=
BUILD_NUMBER.blurb=
BUILD_ID.blurb=
JOB_NAME.blurb=
BUILD_TAG.blurb=
EXECUTOR_NUMBER.blurb=
NODE_NAME.blurb=
NODE_LABELS.blurb=
WORKSPACE.blurb=
JENKINS_HOME.blurb=
JENKINS_URL.blurb=
BUILD_URL.blurb=
JOB_URL.blurb=
<!--
The MIT License
Copyright (c) 2012, CloudBees, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<st:documentation>
Renders a help entry for one environment variable. See EnvironmentContributor. The body of this tag
renders the content.
<st:attribute name="name" use="required">
Name of the environment variable.
</st:attribute>
</st:documentation>
<dt>${attrs.name}</dt>
<dd>
<d:invokeBody />
</dd>
</j:jelly>
<html>
<head>
<title>Available Environmental Variables</title>
<style type="text/css">
dt { font-weight: bold; }
</style>
</head>
<body>
The following variables are available to shell scripts
<dl>
<dt>BUILD_NUMBER</dt>
<dd>The current build number, such as "153"</dd>
<dt>BUILD_ID</dt>
<dd>The current build id, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)</dd>
<dt>JOB_NAME</dt>
<dd>Name of the project of this build, such as "foo"</dd>
<dt>BUILD_TAG</dt>
<dd>String of "jenkins-<i>${JOB_NAME}</i>-<i>${BUILD_NUMBER}</i>". Convenient to put into
a resource file, a jar file, etc for easier identification.</dd>
<dt>EXECUTOR_NUMBER</dt>
<dd>The unique number that identifies the current executor
(among executors of the same machine) that's
carrying out this build. This is the number you see in
the "build executor status", except that the number starts from 0, not 1.</dd>
<dt>NODE_NAME</dt>
<dd>Name of the slave if the build is on a slave, or "master" if run on master</dd>
<dt>NODE_LABELS</dt>
<dd>Whitespace-separated list of labels that the node is assigned.</dd>
<dt>JAVA_HOME</dt>
<dd>If your job is configured to use a specific JDK, this variable is set to
the JAVA_HOME of the specified JDK. When this variable is set, <tt>PATH</tt>
is also updated to have <tt>$JAVA_HOME/bin</tt>.</dd>
<dt>WORKSPACE</dt>
<dd>The absolute path of the workspace.</dd>
<dt>HUDSON_URL</dt>
<dd>Full URL of Hudson, like <tt>http://server:port/hudson/</tt></dd>
<dt>JENKINS_URL</dt>
<dd>Full URL of Jenkins, like <tt>http://server:port/jenkins/</tt></dd>
<dt>BUILD_URL</dt>
<dd>Full URL of this build, like <tt>http://server:port/jenkins/job/foo/15/</tt></dd>
<dt>JOB_URL</dt>
<dd>Full URL of this job, like <tt>http://server:port/jenkins/job/foo/</tt></dd>
<dt>SVN_REVISION</dt>
<dd>For Subversion-based projects, this variable contains the revision number of the module.</dd>
<dt>CVS_BRANCH</dt>
<dd>For CVS-based projects, this variable contains the branch of the module.
If CVS is configured to check out the trunk, this environment variable will not be set.</dd>
</dl>
<p>
To understand how environmental variables provided by Jenkins can be utilized by
Ant, study the following target:
<pre><xmp
><target name="printinfo">
<property environment="env" />
<echo message="${env.BUILD_TAG}"/>
</target></xmp></pre>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Verfügbare Umgebungsvariablen</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
dt { font-weight: bold; }
</style>
</head>
<body>
Die folgenden Variablen sind innerhalb von Shell-Skripten sichtbar:
<dl>
<dt>BUILD_NUMBER</dt>
<dd>Die aktuelle Build-Nummer, z.B. "153".</dd>
<dt>BUILD_ID</dt>
<dd>Die aktuelle Build-ID, z.B. "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss).</dd>
<dt>JOB_NAME</dt>
<dd>Projektname des Builds, z.B. "foo".</dd>
<dt>BUILD_TAG</dt>
<dd>Eine Zeichenkette in der Form "jenkins-<i>${JOB_NAME}</i>-<i>${BUILD_NUMBER}</i>".
Diese Variable läßt sich sehr bequem zur späteren Identifikation in eine
Resource-Datei, JAR-Datei usw. ablegen.
<dt>EXECUTOR_NUMBER</dt>
<dd>Die laufende Nummer des Build-Prozessors, der den aktuellen Build ausführt
(aus den Build-Prozessoren desselben Rechners).
Dies ist die Nummer, die Sie auch im Build-Prozessor Status sehen -
mit der Ausnahme, daß bei der Umgebungsvariable die Zählung bei 0 und nicht
bei 1 beginnt.</dd>
<dt>NODE_NAME</dt>
<dd>Name des Build-Slaves, wenn auf einem Build-Slave gebaut wird, oder "master" wenn auf dem Master-Server gebaut wird.</dd>
<dt>NODE_LABELS</dt>
<dd>Durch Leerzeichen getrennte Liste von Labels, die dem Knoten zugeordnet sind.</dd>
<dt>JAVA_HOME</dt>
<dd>Falls Ihr Job so konfiguriert ist, daß ein spezielles JDK verwendet werden soll,
wird diese Variable auf den Wert von JAVA_HOME für dieses spezielle JDK
gesetzt. Falls diese Variable gesetzt ist, wird <tt>PATH</tt> ebenfalls so aktualisiert,
daß <tt>$JAVA_HOME/bin</tt> enthalten ist.</dd>
<dt>WORKSPACE</dt>
<dd>Der absolute Pfad zum Arbeitsbereich.</dd>
<dt>HUDSON_URL</dt>
<dd>Die absolute URL der Hudson-Instanz, z.B. <tt>http://server:port/hudson/</tt>.</dd>
<dt>JENKINS_URL</dt>
<dd>Die absolute URL der Jenkins-Instanz, z.B. <tt>http://server:port/jenkins/</tt>.</dd>
<dt>BUILD_URL</dt>
<dd>Die absolute URL dieses Builds, z.B. <tt>http://server:port/jenkins/job/foo/15/</tt>.</dd>
<dt>JOB_URL</dt>
<dd>Die absolute URL dieses Jobs, z.B. <tt>http://server:port/jenkins/job/foo/</tt>.</dd>
<dt>SVN_REVISION</dt>
<dd>Bei Subversion-basierten Projekten enthält diese Variable die Revisionsnummer
des Modules.</dd>
<dt>CVS_BRANCH</dt>
<dd>Bei CVS-basierten Projekten enthält diese Variable den Zweig des Moduls.
Falls CVS so konfiguriert ist, daß der Trunk ausgecheckt wird, wird diese
Variable nicht gesetzt.</dd>
</dl>
<p>
Das folgende Beispiel zeigt, wie von Jenkins bereitgestellte Umgebungsvariablen
in Ant-Skripten verwendet werden können:
<pre><xmp
><target name="printinfo">
<property environment="env" />
<echo message="${env.BUILD_TAG}"/>
</target></xmp></pre>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Variables d'environnement disponibles</title>
<style type="text/css">
dt { font-weight: bold; }
</style>
</head>
<body>
Les variables suivantes sont mises à disposition des scripts shell
<dl>
<dt>BUILD_NUMBER</dt>
<dd>Le numéro du build courant, par exemple "153"</dd>
<dt>BUILD_ID</dt>
<dd>L'identifiant du build courant, par exemple "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)</dd>
<dt>JOB_NAME</dt>
<dd>Nom du projet de ce build, par exemple "foo"</dd>
<dt>BUILD_TAG</dt>
<dd>Le texte "jenkins-<i>${JOB_NAME}</i>-<i>${BUILD_NUMBER}</i>", facile à placer dans
un fichier de ressource, ou un jar, pour identification future.</dd>
<dt>EXECUTOR_NUMBER</dt>
<dd>Le numéro unique qui identifie l'exécuteur courant
(parmi les exécuteurs d'une même machine) qui a contruit ce build.
Il s'agit du numéro que vous voyez dans le "statut de l'exécuteur du build",
sauf que la numérotation commence à 0 et non à 1.</dd>
<dt>JAVA_HOME</dt>
<dd>Si votre job est configuré de façon à utiliser un JDK particulier,
cette variable contient la valeur JAVA_HOME du JDK en question.
Quand cette variable est positionnée, la variable <tt>PATH</tt>
est également mise à jour pour inclure <tt>$JAVA_HOME/bin</tt>.</dd>
<dt>WORKSPACE</dt>
<dd>Le chemin absolu vers le répertoire de travail.</dd>
<dt>HUDSON_URL</dt>
<dd>L'URL complète de Hudson, au format <tt>http://server:port/hudson/</tt></dd>
<dt>JENKINS_URL</dt>
<dd>L'URL complète de Jenkins, au format <tt>http://server:port/jenkins/</tt></dd>
<dt>SVN_REVISION</dt>
<dd>Pour les projets utilisant Subversion, cette variable contient le numéro de révision du module.</dd>
<dt>CVS_BRANCH</dt>
<dd>Pour les projets utilisant CVS, cette variable contient la branche du module.
Si CVS est configuré de façon à récupérer la branche principale de développement (trunk),
cette variable d'environnement ne sera pas positionnée.</dd>
</dl>
<p>
Pour comprendre comment les variables d'environnement fournies par Jenkins peuvent être utilisées
par Ant, consultez le résultat de la target Ant suivante:
<pre><xmp
><target name="printinfo">
<property environment="env" />
<echo message="${env.BUILD_TAG}"/>
</target></xmp></pre>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>利用可能な環境変数</title>
<style type="text/css">
dt { font-weight: bold; }
</style>
</head>
<body>
シェルスクリプトでは、次の変数を利用できます。
<dl>
<dt>BUILD_NUMBER</dt>
<dd>当該ビルドの番号。例 "153"</dd>
<dt>BUILD_ID</dt>
<dd>当該ビルドID。例 "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)</dd>
<dt>JOB_NAME</dt>
<dd>ビルドのプロジェクト名。例 "foo"</dd>
<dt>BUILD_TAG</dt>
<dd>文字列 "jenkins-<i>${JOB_NAME}</i>-<i>${BUILD_NUMBER}</i>"。
簡易な識別子として、リソースファイルやjarファイルなどに付与するのに便利です。</dd>
<dt>EXECUTOR_NUMBER</dt>
<dd>このビルドを実行している現在のエグゼキューターを識別する(同一マシンの中で)ユニークな番号。
"ビルド実行状態"に表示されている数字ですが、1ではなく0から始まる数字です。
<dt>NODE_NAME</dt>
<dd>ビルドが実行されるスレーブの名称。マスターで実行される場合は"master"。</dd>
<dt>NODE_LABELS</dt>
<dd>ノードに設定されたラベルのリスト(スペース区切り)。<dd>
<dt>JAVA_HOME</dt>
<dd>特定のJDKを使用するようにジョブを設定する場合、そのJDKのJAVA_HOMEをこの変数に設定します。
この変数を設定すると、<tt>PATH</tt><tt>$JAVA_HOME/bin</tt>が追加されます。</dd>
<dt>WORKSPACE</dt>
<dd>ワークスペースの絶対パス。</dd>
<dt>HUDSON_URL</dt>
<dd>HudsonのURL。例 <tt>http://server:port/hudson/</tt></dd>
<dt>JENKINS_URL</dt>
<dd>JenkinsのURL。例 <tt>http://server:port/jenkins/</tt></dd>
<dt>BUILD_URL</dt>
<dd>このビルドのURL。 例 <tt>http://server:port/jenkins/job/foo/15/</tt></dd>
<dt>JOB_URL</dt>
<dd>このジョブのURL。 例 <tt>http://server:port/jenkins/job/foo/</tt></dd>
<dt>SVN_REVISION</dt>
<dd>Subversionを使用するプロジェクトにおける、モジュールのリビジョン番号。</dd>
<dt>CVS_BRANCH</dt>
<dd>CVSを使用するプロジェクトにおける、モジュールのブランチ。
CVSがトランクをチェックアウトする場合は設定されません。</dd>
</dl>
<p>
Jenkinsが提供する環境変数のAntでの利用方法については、
次のtargetを参考にしてください。
<pre><xmp
><target name="printinfo">
<property environment="env" />
<echo message="${env.BUILD_TAG}"/>
</target></xmp></pre>
</body>
</html>
<html>
<head>
<title>Beschikbare omgevingsparameters</title>
<style type="text/css">
dt { font-weight: bold; }
</style>
</head>
<body>
Volgende parameters zijn beschikbaar voor gebruik in uw scripts:
<dl>
<dt>BUILD_NUMBER</dt>
<dd>Het nummer van de huidige bouwpoging, v.b. "153"</dd>
<dt>BUILD_ID</dt>
<dd>Het identificatienummer van de huidige bouwpoging, v.b. "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)</dd>
<dt>JOB_NAME</dt>
<dd>Naam van het project dat gebouwd wordt door deze bouwpoging, v.b. "foo"</dd>
<dt>BUILD_TAG</dt>
<dd>Het label :"jenkins-<i>${JOB_NAME}</i>-<i>${BUILD_NUMBER}</i>". Dit label is typisch handig om
ter identificatie op te nemen in een "resource"-bestand, archieven (zoals jar,war,ear,...), ... .
</dd>
<dt>EXECUTOR_NUMBER</dt>
<dd>Het unieke nummer, waarmee uw huidige uitvoerder geïdentifieerd kan worden op de server.
Dit is het nummer dat u terugvindt in de "Status uitvoerders"-tabel op de hoofdpagina.
Merk wel dat in die tabel geteld wordt vanaf 1. Uitvoerder 1 in de "Status uitvoerders"-tabel
komt dus overeen met een "EXECUTOR_NUMBER" gelijk aan 0.
</dd>
<dt>JAVA_HOME</dt>
<dd>Indien uw job geconfigureerd werd om een specifieke JDK te gebruiken, bevat deze
parameter de JAVA_HOME informatie van de specifieke JDK. Indien deze parameter
ingesteld wordt, wordt uw <tt>PATH</tt> eveneens aangepast om <tt>$JAVA_HOME/bin</tt>
te bevatten.</dd>
<dt>WORKSPACE</dt>
<dd>Het absolute pad naar de werkplaats.</dd>
<dt>HUDSON_URL</dt>
<dd>Volledige URL voor Hudson, v.b. <tt>http://server:port/hudson/</tt></dd>
<dt>JENKINS_URL</dt>
<dd>Volledige URL voor Jenkins, v.b. <tt>http://server:port/jenkins/</tt></dd>
<dt>SVN_REVISION</dt>
<dd>Voor Suversion gebaseerde projecten, bevat deze parameter het versienummer van de module.</dd>
<dt>CVS_BRANCH</dt>
<dd>Voor CVS gebaseerde projecten, bevat deze parameter de tak van de module.
Indien CVS geconfigureerd werd om de code op te halen vanaf de stam van uw versiecontroleboom,
zal deze parameter niet ingesteld worden.</dd>
</dl>
<p>
Om beter te begrijpen hoe de beschikbare omgevingsparameters gebruikt kunnen worden
door Ant, kunt u volgend voorbeeld bekijken:
<pre><xmp
><target name="printinfo">
<property environment="env" />
<echo message="${env.BUILD_TAG}"/>
</target></xmp></pre>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Available Environmental Variables</title>
<style type="text/css">
dt { font-weight: bold; }
</style>
</head>
<body>
The following variables are available to shell scripts
<dl>
<dt>BUILD_NUMBER</dt>
<dd>The current build number, such as "153"</dd>
<dt>BUILD_ID</dt>
<dd>The current build id, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)</dd>
<dt>JOB_NAME</dt>
<dd>Name of the project of this build, such as "foo"</dd>
<dt>BUILD_TAG</dt>
<dd>String of "jenkins-<i>${JOB_NAME}</i>-<i>${BUILD_NUMBER}</i>". Convenient to put into
a resource file, a jar file, etc for easier identification.</dd>
<dt>EXECUTOR_NUMBER</dt>
<dd>The unique number that identifies the current executor
(among executors of the same machine) that's
carrying out this build. This is the number you see in
the "build executor status", except that the number starts from 0, not 1.</dd>
<dt>JAVA_HOME</dt>
<dd>If your job is configured to use a specific JDK, this variable is set to
the JAVA_HOME of the specified JDK. When this variable is set, <tt>PATH</tt>
is also updated to have <tt>$JAVA_HOME/bin</tt>.</dd>
<dt>WORKSPACE</dt>
<dd>The absolute path of the workspace.</dd>
<dt>HUDSON_URL</dt>
<dd>Full URL of Hudson, like <tt>http://server:port/hudson/</tt></dd>
<dt>JENKINS_URL</dt>
<dd>Full URL of Jenkins, like <tt>http://server:port/jenkins/</tt></dd>
<dt>SVN_REVISION</dt>
<dd>For Subversion-based projects, this variable contains the revision number of the module.</dd>
<dt>CVS_BRANCH</dt>
<dd>For CVS-based projects, this variable contains the branch of the module.
If CVS is configured to check out the trunk, this environment variable will not be set.</dd>
</dl>
<p>
To understand how environmental variables provided by Jenkins can be utilized by
Ant, study the following target:
<pre><xmp
><target name="printinfo">
<property environment="env" />
<echo message="${env.BUILD_TAG}"/>
</target></xmp></pre>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册