1 .. _lf-global-jjb-release:
3 #######################
4 Self Serve Release Jobs
5 #######################
7 Self serve release jobs allow a project to create a releases directory and then place a release file in it.
8 Jenkins will pick this up and then promote the artifact from the staging log directory (log_dir) and tag the release
9 with the defined version. maven_central_url is optional
13 Example of a project's release file:
17 $ cat releases/1.0.0.yaml
19 distribution_type: 'maven'
21 project: 'example-test-release'
22 log_dir: 'example-test-release-maven-stage-master/17/'
23 maven_central_url: 'oss.sonatype.org'
27 Example of a terse Jenkins job to call global-jjb macro:
32 name: '{project-name}-gerrit-release-jobs'
33 project: 'example-test-release'
34 build-node: centos7-builder-2c-1g
35 project-name: example-test-release
37 - '{project-name}-gerrit-release-jobs'
41 Example of a verbose Jenkins job to call global-jjb macro:
46 name: '{project-name}-releases-verify'
47 project: 'example-test-release'
48 build-node: centos7-builder-2c-1g
49 project-name: example-test-release
51 - 'gerrit-releases-verify'
56 name: '{project-name}-releases-merge'
57 project: 'example-test-release'
58 build-node: centos7-builder-2c-1g
59 project-name: example-test-release
61 - 'gerrit-releases-merge'
65 Release Engineers Please follow the setup guide before adding the job definition:
67 Setup for LFID Nexus Jenkins and Gerrit:
68 ========================================
73 Create an ``lfid`` and an ``ssh-key``
82 ssh-keygen -t rsa -C "collab-it+odl-release@linuxfoundation.org" -f /tmp/odl-release
85 `Create an LFID <https://identity.linuxfoundation.org>`_
90 Create a Nexus account called ``'jenkins-release'`` with promote privileges.
92 .. image:: ../_static/nexus-promote-privs.png
97 Log into your Gerrit with ``RELEASE_USERNAME``, upload the ``ssh-key`` you created earlier.
98 Log out of Gerrit and log in again with your normal account for the next steps.
100 In Gerrit create a new group called ``self-serve-release`` and give it direct push rights via ``All-Projects``
101 ``push - refs/heads/*``
103 1. Add a push reference
104 2. Set the ref as refs/heads/*
105 3. Make sure "force push" is not checked
107 Add ``RELEASE_USERNAME`` to group ``self-serve-release`` and group ``Non-Interactive Users``
109 Give group ``self-serve-release`` Forge Committer rights on ``refs/tags/*``
110 Give group ``self-serve-release`` Allow on ``Create Signed Tag``
111 Give group ``self-serve-release`` Allow on ``Create Annotated Tag``
116 Add a global credential to Jenkins called ``jenkins-release`` and set the ID: ``'jenkins-release'``
117 as its value insert the ``ssh-key`` that you uploaded to Gerrit.
119 Add Global vars in Jenkins:
120 Jenkins configre -> Global properties -> Environment variables
122 ``RELEASE_USERNAME = $RELEASE_USERNAME``
123 ``RELEASE_EMAIL = $RELEASE_EMAIL``
125 Jenkins configre -> Managed Files -> Custom File
128 Name: SIGNING_PUBKEY (optional)
129 Comment: SIGNING_PUBKEY (optional)
132 -----BEGIN PGP PUBLIC KEY BLOCK-----
135 Add or edit the managed file in Jenkins called ``lftoolsini``, appending a nexus section:
136 Jenkins Settings -> Managed files -> Add (or edit) -> Custom file
141 username=jenkins-release
147 upgrade you projects global-jjb if needed
148 add this to your global defaults file (eg: jjb/defaults.yaml)
152 jenkins-ssh-release-credential: 'jenkins-release'
160 Release verify and merge jobs are the same except for their scm, trigger, and
161 builders definition. This anchor is the common template.
172 - sigul-configuration
173 - checkout ref from taglist.log
174 - applies the $PROJECT.bundle
175 - signs, tags and pushes
179 lftools nexus release --server $NEXUS_URL $STAGING_REPO
183 - {project-name}-release-merge-{stream}
185 :Comment Trigger: remerge
187 :Required parameters:
189 :build-node: The node to run build on.
190 :jenkins-ssh-release-credential: Credential to use for SSH. (Generally set
192 :stream: run this job against: master
194 :Optional parameters:
196 :branch: Git branch to fetch for the build. (default: master)
197 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
198 :build-timeout: Timeout in minutes before aborting build. (default: 15)
199 :project-pattern: Project to trigger build against. (default: \*\*)
201 :gerrit_merge_triggers: Override Gerrit Triggers.
202 :gerrit_trigger_file_paths: Override file paths filter which checks which
203 file modifications will trigger a build.
207 pattern: 'releases/*.yaml'
213 Release verify job checks the schema and ensures that the staging-repo.txt.gz
214 is available on the job.
217 - sigul-configuration
218 - checkout ref from taglist.log
219 - applies the $PROJECT.bundle
220 - signs and shows signature
224 - {project-name}-release-verify-{stream}
226 :Comment Trigger: recheck|reverify
228 :Required Parameters:
230 :build-node: The node to run build on.
231 :jenkins-ssh-release-credential: Credential to use for SSH. (Generally set
233 :stream: run this job against: master
235 :Optional Parameters:
237 :branch: Git branch to fetch for the build. (default: master)
238 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
239 :build-node: The node to run build on.
240 :build-timeout: Timeout in minutes before aborting build. (default: 15)
241 :doc-dir: Directory where tox will place built docs.
242 as defined in the tox.ini (default: docs/_build/html)
243 :gerrit-skip-vote: Skip voting for this job. (default: false)
244 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
245 :project-pattern: Project to trigger build against. (default: \*\*)
247 :gerrit_verify_triggers: Override Gerrit Triggers.
248 :gerrit_trigger_file_paths: Override file paths filter which checks which
249 file modifications will trigger a build.
253 pattern: 'releases/*.yaml'