#####################
mvn-central: true
+ mvn-global-settings: ''
+ mvn-settings: ''
ossrh-profile-id: ''
#####################
builders:
- lf-maven-central:
mvn-central: '{mvn-central}'
+ mvn-global-settings: '{mvn-global-settings}'
+ mvn-settings: '{mvn-settings}'
ossrh-profile-id: '{ossrh-profile-id}'
--- /dev/null
+---
+- project:
+ name: gerrit-maven-versions-plugin-jobs
+ jobs:
+ - gerrit-maven-stage:
+ maven-versions-plugin: true
+ maven-versions-plugin-set-version: 2.0.0
+ mvn-pom: location/pom.xml
+
+ project-name: gerrit-maven-versions-plugin
+ staging-profile-id: uuddlrlrba
+ mvn-settings: gerrit-maven-project-settings
+ mvn-snapshot-id: fakeproject-snapshots
+ nexus-snapshot-repo: fakeproject-snapshots
.. note::
+ The JJB Deploy Job is configured to trigger only if the Gerrit comment
+ starts with the `jjb-deploy` keyword.
+
+ Example of a valid command in Gerrit comment that triggers the job:
+
+ ``jjb-deploy builder-jjb-*``
+
+ Example of a invalid command in Gerrit comment that would _not_ trigger
+ the job:
+
+ ``Update the job. jjb-deploy builder-jjb-*``
+
JOB_NAME can include the * wildcard character to push multiple jobs
matching the pattern. For example ``jjb-deploy builder-jjb-*`` will push
all builder-jjb-* jobs to the sandbox system.
:Required parameters:
:mvn-central: Whether or not to upload to mvn-central. (true|false)
+ :mvn-global-settings: The name of the Maven global settings to use for
+ Maven configuration. (default: global-settings)
+ :mvn-settings: The name of settings file containing credentials for the
+ project.
:ossrh-profile-id: Nexus staging profile ID as provided by OSSRH.
.. literalinclude:: ../../.jjb-test/lf-macros/lf-maven-central-minimal.yaml
Calls the maven deploy script to push artifacts to Nexus.
+lf-maven-versions-plugin
+------------------------
+
+Conditionally calls Maven versions plugin to set, update and commit the maven `versions:set`.
+
+:Required Parameters:
+
+ :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
+ :mvn-version: Version of Maven to execute Sonar with.
+ :mvn-pom: Location of pom.xml.
+ :maven-versions-plugin-set-version: Version number to upgrade to.
+ :mvn-settings: Maven settings.xml file containing credentials to use.
+
lf-maven-stage
---------------
Calls the maven stage script to push artifacts to a Nexus staging repository.
+:Required Parameters:
+
+ :mvn-global-settings: The name of the Maven global settings to use for
+ Maven configuration.
+ :mvn-settings: The name of settings file containing credentials for the project.
+
lf-update-java-alternatives
---------------------------
:deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
:git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
:java-version: Version of Java to use for the build. (default: openjdk8)
+ :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
:mvn-global-settings: The name of the Maven global settings to use for
Maven configuration. (default: global-settings)
:mvn-opts: Sets MAVEN_OPTS. (default: '')
:mvn-params: Additional mvn parameters to pass to the cli. (default: '')
:mvn-version: Version of maven to use. (default: mvn35)
+ :maven-versions-plugin-set-version: New version to use in Maven versions plugin. (default: '')
:sign-artifacts: Sign artifacts with Sigul. (default: false)
:stream: Keyword that can be used to represent a release code-name.
Often the same as the branch. (default: master)
-The files in this directory are for initializing a Jenkins minion just before
-the cloud plugin hands the minion over to Jenkins.
+The files in this directory are for initializing a Jenkins minion just
+before the cloud plugin hands the minion over to Jenkins.
-init.sh is the entry point script which then calls all other scripts.
+The Jenkins 'init.sh' script will check for a project specific init
+script: '$ciman_root/jenkins-init-scripts/local-init.sh'. If the file
+exits and is executable, it will be executed. Note the local init
+script will be executed before the 'jenkins' user has been created.
+You can also call a project specific script from the Jenkins Manged
+File after the call to 'init.sh'.
-init.sh also provides a local init script entry point by checking for the
-existance of the file CIMAN_ROOT/jenkins-init-scripts/local-init.sh. If this
-file exists it can be used to further customize the server node before handing
-it to Jenkins for job use.
-
-To use this create a managed file in Jenkins with the contents:
+To use this create a Jenkins Managed File with the contents:
#!/bin/bash
- git clone --recurse-submodules https://gerrit.example.org/r/ci-management.git /opt/ciman
- /opt/ciman/jjb/global-jjb/jenkins-init-scripts/init.sh
+
+ gerrit_host=gerrit.example.org
+ ciman_root=/opt/ciman
+
+ until host $gerrit_host &>/dev/null ; do
+ echo "Waiting until $gerrit_host is resolvable..."
+ sleep 1
+ done
+
+ git clone --recurse-submodules https://$gerrit_host/r/ci-management $ciman_root
+
+ # Specify swapspace on the minion
+ # SWAP_SIZE specifies the size of swapspace in GB If set to '0' no
+ # swapspace will be allocated If unset, 1GB swapspace will be
+ # allocated
+ #export SWAP_SIZE=0
+
+ $ciman_root/global-jjb/jenkins-init-scripts/init.sh
+
+ rm -rf $ciman_root
OS=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
OS_RELEASE=$(facter lsbdistrelease | tr '[:upper:]' '[:lower:]')
-if [[ "$OS_RELEASE" == "18.04" ]] && [[ "$OS" == 'ubuntu' ]]
-then
- echo 'PATH=$HOME/.local/bin:$PATH
-export PATH' >> /etc/profile
+if [[ "$OS_RELEASE" == "18.04" && "$OS" == 'ubuntu' ]]; then
+ echo 'export PATH=$HOME/.local/bin:$PATH' >> /etc/profile
fi
useradd -m -s /bin/bash jenkins
fi
mkdir /home/jenkins/.ssh
-cp -r "/home/${OS}/.ssh/authorized_keys" /home/jenkins/.ssh/authorized_keys
+cp "/home/${OS}/.ssh/authorized_keys" /home/jenkins/.ssh/authorized_keys
+chmod 0600 /home/jenkins/.ssh/authorized_keys
# Generate ssh key for use by Robot jobs
echo -e 'y\n' | ssh-keygen -N "" -f /home/jenkins/.ssh/id_rsa -t rsa
chown -R jenkins:jenkins /home/jenkins/.ssh
-chmod 700 /home/jenkins/.ssh
+chmod 0700 /home/jenkins/.ssh
# The '/w' volume may already be part of image
[[ ! -d '/w' ]] && mkdir /w
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
-INIT_SCRIPTS_DIR="/opt/ciman/global-jjb/jenkins-init-scripts"
+ciman_init_scripts=$(readlink -f "$(dirname "$0")"/../../jenkins-init-scripts)
+jjb_init_scripts=$(readlink -f "$(dirname "$0")")
-"$INIT_SCRIPTS_DIR/package-listing.sh"
-"$INIT_SCRIPTS_DIR/basic-settings.sh"
-"$INIT_SCRIPTS_DIR/disable-firewall.sh"
-"$INIT_SCRIPTS_DIR/create-swap-file.sh"
+"$jjb_init_scripts/package-listing.sh"
+"$jjb_init_scripts/basic-settings.sh"
+"$jjb_init_scripts/disable-firewall.sh"
+"$jjb_init_scripts/create-swap-file.sh"
# Entry point for additional local minion customization
-# Eg. OpenDaylight has additional bootstrap scripts depending on minion type.
-if [ -f "/opt/ciman/jenkins-init-scripts/local-init.sh" ]; then
- /opt/ciman/jenkins-init-scripts/local-init.sh
+# Note this is called before the 'jenkins' account is created
+if [ -e "$ciman_init_scripts/local-init.sh" ]; then
+ "$ciman_init_scripts/local-init.sh"
fi
# Create the jenkins user last so that hopefully we DO NOT have to deal with
# guard files
-"$INIT_SCRIPTS_DIR/create-jenkins-user.sh"
+"$jjb_init_scripts/create-jenkins-user.sh"
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
-# Share script with JJB jobs so we only have to maintain it in one place
-JJB_SHELL_DIR="$(dirname $0)/../shell"
+# The 'init' scripts are located in 'jenkins-init-scripts' directory.
+# The 'global-jjb' scripts are located in 'shell' directory. The
+# 'package-listing' script is used by both, this is a simple wrapper
+# for 'shell/package-listing.sh'. Arguments would be quietly discarded.
-# Make sure the script is executable and then run it
-chmod +x "${JJB_SHELL_DIR}/package-listing.sh"
-"${JJB_SHELL_DIR}/package-listing.sh"
+jjb_init_scripts="$(dirname "$0")/../shell"
+
+"$jjb_init_scripts/package-listing.sh"
submodule-timeout: 10
gerrit_jjb_deploy_job_triggers:
- comment-added-contains-event:
- comment-contains-value: 'jjb-deploy[:]* (?!\*+$).+$'
+ comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(jjb-deploy[:]* (?!\*+$).+$)'
#####################
# Job Configuration #
- ../shell/common-variables.sh
- ../shell/maven-deploy.sh
+- builder:
+ name: lf-maven-versions-plugin
+ builders:
+ - conditional-step:
+ condition-kind: boolean-expression
+ condition-expression: '{maven-versions-plugin}'
+ steps:
+ - inject:
+ properties-file: version.properties
+ - maven-target:
+ maven-version: '{mvn-version}'
+ pom: '{mvn-pom}'
+ goals: 'versions:set versions:update-child-modules versions:commit -B'
+ properties:
+ - 'newVersion=${{maven-versions-plugin-set-version}}'
+ settings: '{mvn-settings}'
+ settings-type: cfp
+ global-settings: 'global-settings'
+ global-settings-type: cfp
+
- builder:
name: lf-maven-stage
builders:
git-url: '$GIT_URL/$PROJECT'
github-url: 'https://github.com'
java-version: openjdk8
+ maven-versions-plugin: false
+ maven-versions-plugin-set-version: ''
mvn-central: false
mvn-global-settings: global-settings
mvn-goals: clean deploy
mvn-params: ''
mvn-version: mvn35
ossrh-profile-id: ''
+ mvn-pom: ''
sign-artifacts: false
sign-mode: serial
stream: master
global-settings-file: '{mvn-global-settings}'
settings-file: '{mvn-settings}'
- shell: !include-raw-escape: ../shell/maven-patch-release.sh
+ - lf-maven-versions-plugin:
+ maven-versions-plugin: '{maven-versions-plugin}'
+ mvn-version: '{mvn-version}'
+ mvn-pom: '{mvn-pom}'
+ maven-versions-plugin-set-version: '{maven-versions-plugin-set-version}'
+ mvn-settings: '{mvn-settings}'
- lf-maven-build:
mvn-goals: '{mvn-goals}'
- lf-sigul-sign-dir:
--- /dev/null
+---
+fixes:
+ - |
+ Update the lf-maven-cental macro documentation and example templates with
+ the missing requireed params.
--- /dev/null
+---
+fixes:
+ - |
+ The JJB Deploy Job is configured to trigger only if the Gerrit comment
+ starts with the `jjb-deploy` keyword.
+
+ Without the regex being optimized the job triggers on any occurance
+ of the `jjb-deploy` keyword in a Gerrit comment, with is waste infra
+ resources.
+
+ Example of a valid command in Gerrit comment that triggers the job:
+
+ ``jjb-deploy builder-jjb-*``
+
+ Example of a invalid command in Gerrit comment that would _not_ trigger
+ the job:
+
+ ``Update the job. jjb-deploy builder-jjb-*``
--- /dev/null
+---
+features:
+ - |
+ **jenkiins-init-scripts** The 'ciman' repo is not longer required to be
+ located in '/opt/ciman'.
--- /dev/null
+---
+features:
+ - |
+ lf-maven-set-version conditional step for lf-maven-stage to allow
+ teams to run Maven versions plugin to update their artifact versions.
+ Step will run if maven-versions-plugin is set to true.