-
Notifications
You must be signed in to change notification settings - Fork 45
Specification for toolchains file
This is a specification for the toolchains.yaml
file.
toolchains:
language key:
- toolchain key
toolchain key:
default_ivalue: tool
friendlyLabel: true
secureSupport: true
matrix: simple
cleanup:
- cleanup command
- another command
tool key: |-
some bash command
another command
'*': some ${jervis_toolchain_ivalue} command
-
toolchains
- This key name must remaintoolchains
. It will consist of languages and their toolchain order. Validation: This key is required. -
language key
- This key name will change and be one of the values of the list of supported languages in the lifecycles file. For each value in the array in this key it must exist as a top level key because it is a toolchain. Validation: The key name will not be checked against anything. However each value in the array must exist as a top level key because it is a toolchain. -
toolchain key
- This key name will change and can be any arbitrary name that describes the toolchain. Validation: Not required however this key must exist if it is listed in alanguage key
toolchain. -
default_ivalue
- This key name must remaindefault_ivalue
. Validation: Not required. If used then the value must exist as atool key
key or the*
will need to exist. -
friendlyLabel
- This key name must remainfriendlyLabel
. Iftrue
then matrix labels will take the form of a friendly label (e.g.jdk:openjdk7
instead ofjdk0
). Validation: Not required. -
secureSupport
- This key name must remainsecureSupport
. Validation: Not required. -
matrix
- This key name must remainmatrix
. Takes three values:disabled
,simple
,advanced
.disabled
means it is not meant to be in a matrix build configuration at all.simple
is the current behavior which means a list of items in YAML is part of the matrix.advanced
is when there is aglobal
key and amatrix
key in the YAML. Validation: Not required. If it exists it must be of type String and one of three values:disabled
,simple
,advanced
. -
cleanup
- A list of commands that are designed to clean up data left behind from the toolchain. Validation: Not required. If it exists it must be of type String or List containing only Strings. -
tool key
- A key that contains an array or single string of the script to be executed for thistool key
. Validation: Not always required. Ifdefault_ivalue
is set and the*
key does not exist then this key is required. If it exists it must be of type String or List containing only Strings. -
*
- The*
is the default key that gets referenced if a tool index value (ivalue) is not used. Validation: Not always required. Ifdefault_ivalue
is set and thetool key
does not exist for thedefault_ivalue
then this key is required.
toolchains:
groovy:
- env
- jdk
java:
- env
- jdk
python:
- env
- python
ruby:
- env
- rvm
- jdk
compiler:
gcc: |-
export CXX="g++"
export CC="gcc"
clang: |-
export CXX="clang++"
export CC="clang"
env:
secureSupport: true
matrix: advanced
'*': export ${jervis_toolchain_ivalue}
jdk:
default_ivalue: openjdk7
openjdk6: |-
export JAVA_HOME="/usr/lib/jvm/java-6-openjdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
openjdk7: |-
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
oraclejdk7: |-
export JAVA_HOME="/opt/java-7-oraclejdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
oraclejdk8: |-
export JAVA_HOME="/opt/java-8-oraclejdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
python:
default_ivalue: '2.7'
'2.6': |-
source ~/virtualenv/python2.6/bin/activate
python --version
pip --version
'2.7': |-
source ~/virtualenv/python2.7/bin/activate
python --version
pip --version
'3.2': |-
source ~/virtualenv/python3.2/bin/activate
python --version
pip --version
'3.3': |-
source ~/virtualenv/python3.3/bin/activate
python --version
pip --version
'3.4': |-
source ~/virtualenv/python3.4/bin/activate
python --version
pip --version
pypy: |-
source ~/virtualenv/pypy/bin/activate
python --version
pip --version
pypy3: |-
source ~/virtualenv/pypy3/bin/activate
python --version
pip --version
rvm:
default_ivalue: 1.9.3
'*': |-
source "$HOME/.rvm/scripts/rvm"
if ! rvm list | grep -q "${jervis_toolchain_ivalue}";then
rvm install "${jervis_toolchain_ivalue}"
rvm "${jervis_toolchain_ivalue}" do gem install bundler
fi
rvm use ${jervis_toolchain_ivalue}
ruby --version
The toolchains
key expresses which order in which different keys will be written out. For instance, "java": ["env","jdk"]
means that in the shell builder script first the env
toolchain commands will be written out and then the jdk
toolchain commands will be written out. The toolchains
key also determins what is a matrix builder. If the toolchain in the yaml file only contains a single item then it is not a matrix build. If the toolchain in the yaml file only contains multiple items then it is a matrix build job.
If default_ivalue
key exists then the command will automatically be written out as if the user specified that version of the toolchain in their yaml file. If the default_ivalue
key does not exist and the user doesn't specify the toolchain in their yaml file then nothing will be written out.
If secureSupport
key exists and is true
then it means that this toolchain supports secure fields.
As the user specifies toolchains in their yaml file keys inside of the toolchains.yaml
will be looked up. If the toolchain key does not exist then jervis will check if the *
key exists. If the *
key exists then it will use that key for generating commands. If the *
key does not exist then it will simply not write out anything.
If you include the text ${jervis_toolchain_ivalue}
it will be interpolated with the index value of the toolchain being used. For example, if the version of rvm in the yaml file is set to 2.1.5
then all instances of ${jervis_toolchain_ivalue}
will be replaced with 2.1.5
.
A simple ruby yaml file.
language: ruby
Based on the rules above the following would be output as the toolchains portion of the script.
#env toolchain
#rvm toolchain
source "$HOME/.rvm/scripts/rvm"
if ! rvm list | grep -q "1.9.3";then
rvm install "1.9.3"
rvm "1.9.3" do rvm gem install bundler
fi
rvm use 1.9.3
ruby --version
#jdk toolchain
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
Let's look at a slightly more complicated yaml file for Groovy based on Jervis.
language: groovy
env:
- GROOVY_VERSION="2.2.2"
jdk:
- oraclejdk8
Based on the rules the following would be output as the toolchains portion of the script.
#env toolchain
export GROOVY_VERSION="2.2.2"
#jdk toolchain
export JAVA_HOME="/opt/java-8-oraclejdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
A more complicated matrix building yaml file based on issue #7. This should be created by a generator class.
language: groovy
env:
- GROOVY_VERSION="1.8.9"
- GROOVY_VERSION="2.2.2"
- GROOVY_VERSION="2.3.0"
jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
Here's the build matrix based on the rules.
#env toolchain
case ${env}
0)
export GROOVY_VERSION="1.8.9"
;;
1)
export GROOVY_VERSION="2.2.2"
;;
2)
export GROOVY_VERSION="2.3.0"
;;
esac
#jdk toolchain
case ${jdk}
0)
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
;;
1)
export JAVA_HOME="/opt/java-7-oraclejdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
;;
2)
export JAVA_HOME="/opt/java-8-oraclejdk-amd64/"
export PATH="${JAVA_HOME}/bin:${PATH}"
java -version
;;
esac
- Build overview
- Supported languages
- Supported build tools
- Publish results
- Additional topics:
- Quickstart
- Background information
- Knowledge checklist
- Required Jenkins Plugins
- Labels for Jenkins Agents
- Key security concepts
- Operationalize Jenkins
- High availability
- Disaster recovery
- Pipeline support
- Extending support