Merge "Add a script to tag a release"
[docs.git] / docs / release-process / project-release.rst
1 **************************
2 Project Standalone Release
3 **************************
4
5 This page explains how a project can release independently outside of the
6 OpenDaylight simultanious release.
7
8 Preparing your project for release
9 ==================================
10
11 A project can produce a staging repository by clicking "build" for their
12 {project-name}-maven-release-{stream} job. This job performs the following
13 duties:
14
15 1. Removes -SNAPSHOT from all pom files
16 2. Produces a taglist.log, project.patch, and project.bundle files
17 3. Runs a `mvn clean deploy` to a local staging repo
18 4. Pushes the staging repo to a Nexus staging repo
19    https://nexus.opendaylight.org/content/repositories/<REPO_ID>
20    (REPO_ID is saved to staging-repo.txt on the log server)
21 5. Archives taglist.log, project.patch, and project.bundle files to log server
22
23 The files taglist.log and project.bundle can be used later at release time to
24 reproduce a byte exact commit of what was built by the Jenkins job. This can
25 be used to tag the release at release time.
26
27 Releasing your project
28 ======================
29
30 Once testing against the staging repo has been completed and project has
31 determined that the staged repo is ready for release. A release can the be
32 performed as follows:
33
34 1. Ask helpdesk to sign the artifacts in staging repo
35 2. Ask helpdesk to promote the staging repo
36 3. Download taglist.log and project.bundle
37 4. Read taglist.log and checkout the commit hash listed
38 5. Merge the project.bundle patches
39 6. Git tag the release
40 7. Push release tag to Gerrit
41
42 Steps 4-7 as bash:
43
44 .. code:: bash
45
46     PATCH_DIR=/tmp/patches
47     PROJECT=odlparent
48     VERSION=1.2.3
49     git checkout $(awk '{print $NF}' "$PATCH_DIR/taglist.log")
50     git fetch "$PATCH_DIR/$PROJECT.bundle"
51     git merge --ff-only FETCH_HEAD
52     git tag -asm "$PROJECT $VERSION" "v$VERSION"
53     git push origin "v$VERSION"
54
55 Once complete the Git tag should be available in Gerrit and the Artifacts should
56 appear in the Nexus opendaylight.release repo.
57
58 The following shell script will do this for you:
59
60 .. code:: bash
61
62     #!/bin/sh
63
64     set -e
65
66     if [ $# != 3 ]; then
67         echo Usage: $0 project version log-URL
68         echo fetches a project release\'s logs from log-URL and tags the git repository
69         exit 1
70     fi
71
72     PROJECT=$1
73     VERSION=$2
74     PATCH_DIR=/tmp/patches
75
76     mkdir -p $PATCH_DIR
77     cd $PATCH_DIR
78     rm -f ${PROJECT}.bundle taglist.log{,.gz}
79     wget ${3}/patches/{${PROJECT}.bundle,taglist.log.gz}
80     gunzip taglist.log.gz
81     cd -
82     git checkout $(awk '{print $NF}' "$PATCH_DIR/taglist.log")
83     git fetch "$PATCH_DIR/$PROJECT.bundle"
84     git merge --ff-only FETCH_HEAD
85     git tag -asm "$PROJECT $VERSION" "v$VERSION"
86     git push origin "v$VERSION"
87
88 You need to run it from a clone git repository of your project,
89 and give it as arguments the project’s short name, the newly-
90 released version, and the URL of the release build’s logs; for
91 example:
92
93 .. code:: bash
94
95     sign-odl-release odlparent 4.0.0 https://logs.opendaylight.org/releng/vex-yul-odl-jenkins-1/odlparent-maven-release-master/11/