##// END OF EJS Templates
release: merge back stable branch into default
marcink -
r2895:5aa6464f merge default
parent child Browse files
Show More
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,113 b''
1 .. _integrations-jenkins:
2
3 Jenkins integration
4 ===================
5
6 .. important::
7
8 Jenkins integration is only available in |RCEE|.
9
10
11
12 Below are few examples how to use dedicated Jenkins integrations with |RCEE|.
13
14
15
16 Configure Jenkins to check each commit after push
17 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18
19 In order to configure Jenkins to trigger a build on a project after each push we
20 need to create a project that will allow triggering a build from external sources.
21
22 In Jenkins, check `Trigger builds remotely (e.g., from scripts)` option. This gives
23 now ability to trigger builds using an URL.
24
25 .. image:: ../images/jenkins-build-with-parameters.png
26
27 We also need to specify the parameters we're going to build the project with.
28 In this example we'll use build with 3 parameters `COMMIT_ID`, `BRANCH_HEAD` and `BRANCH`.
29 In Jenkins we need to add those 3 parameters, and check an option
30 `This project is parameterised`
31
32 .. image:: ../images/jenkins-adding-build-parameters.png
33
34
35 Our final URL that |RCEE| Jenkins integration would use could look like this:
36
37 This URL will be triggered for each pushed branch, and will include the branch head commit id.
38
39 https://jenkins.server.com/job/test-build-commits/buildWithParameters?token=secret&BRANCH=${branch}&BRANCH_HEAD=${branch_head}
40
41 Or we can also use commit_id in this case URL will be triggered for each pushed commit in the branch, and will include the commit id.
42
43 https://jenkins.server.com/job/test-build-commits/buildWithParameters?token=secret&BRANCH=${branch}&COMMIT_ID=${commit_id}
44
45
46 Now we have all the required information to fetch/checkout and test our project.
47 We can write an example build common in Jenkins.
48
49
50 .. image:: ../images/jenkins-build-command.png
51
52
53 Below is an example of the integration page we used on |RCEE| side.
54
55
56 .. image:: ../images/rhodecode-jenkins-integration-settings.png
57
58
59
60 Configure Jenkins to check each pull-request on creation and updates
61 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62
63 Jenkins integration also allows checking created pull-requests inside |RCCE|. This is
64 somehow a special case compared to testing commits. The pull-requests cannot be cloned
65 from the repository. Instead |RCCE| exposes different links back to CI systems which
66 store information on how to obtain the pull-request code.
67
68 On |RCCE| side we need to create a new integration that would use only two events:
69
70 - pullrequest created
71 - pullrequest commits updated
72
73 This will trigger the builds when pull-request is firstly created, and then each time
74 pull-requests is updated and commits that it stores change.
75
76
77 In Jenkins, we should create at least two new build string parameters.
78 We could use `PR_ID` and `SHADOW_URL`.
79 Using those parameters, we can then create a customized build command to checkout a
80 merged state of pull-request. And later on using rhodecode-api notify about the checks
81 using the `PR_ID`.
82
83
84 .. image:: ../images/jenkins-pr-build-command.png
85
86
87 There's even a helper script we created to send notifications.
88 Here's how the build on success could look like in Jenkins.
89
90 .. code-block:: bash
91
92 # clone the ci-notify script, and save it into our $BUILD_TAG/notify directory
93 hg clone https://code.rhodecode.com/ci-notify $BUILD_TAG/notify
94
95 # execute the script. $RC_TOKEN is auth-token for API
96 # url is your rhodecode instance, repoid is repository project which PR was opened
97 # status could be "approved" or "rejected"
98 python $BUILD_TAG/notify/notify.py \
99 --token $RC_TOKEN \
100 --url https://code.server.com \
101 --repoid my-example-project \
102 --prid $PR_ID \
103 --status "approved" \
104 --message "Build Succeeded: $BUILD_URL"
105
106
107 Below is also an example that we could use on |RCCE| side in the Jenkins integration settings.
108 A Jenkins Trigger url that exposes all required information back to Jenkins CI server:
109
110 .. code-block:: bash
111
112 http://jenkins.server.com/job/my-project-pull-request-tests/buildWithParameters?token=secret&PR_ID=${pull_request_id}&PR_TITLE=${pull_request_title}&SHADOW_URL=${pull_request_shadow_url}&PR_UID=${pull_request_commits_uid}
113
@@ -0,0 +1,47 b''
1 |RCE| 4.12.4 |RNS|
2 ------------------
3
4 Release Date
5 ^^^^^^^^^^^^
6
7 - 2018-07-13
8
9
10 New Features
11 ^^^^^^^^^^^^
12
13
14
15 General
16 ^^^^^^^
17
18
19
20 Security
21 ^^^^^^^^
22
23
24
25 Performance
26 ^^^^^^^^^^^
27
28
29
30 Fixes
31 ^^^^^
32
33 - Repository: fixed problems with mercurial/git url validators.
34 - User Groups: fixed audit log data on user group permissions view.
35 This caused an 500 error when editing user groups.
36 - Authentication: fixed problem with displaying social auth providers in the login page.
37 - Google Authentication: updated google user info api to latest version. The previous
38 endpoint was deprecated and it caused problems with Google authentication.
39 - API: fixed problem with setting recursive permissions changes to repo group.
40 - API: fixed problem with creation of pull request with custom reviewers rules.
41 - API: fixed problem with proper diff calculation with using pull-request API.
42
43
44 Upgrade notes
45 ^^^^^^^^^^^^^
46
47 - Scheduled release addressing reported problems, and improving stability.
@@ -39,3 +39,4 b' b5b30547d90d2e088472a70c84878f429ffbf40d'
39 39 9072253aa8894d20c00b4a43dc61c2168c1eff94 v4.12.1
40 40 6a517543ea9ef9987d74371bd2a315eb0b232dc9 v4.12.2
41 41 7fc0731b024c3114be87865eda7ab621cc957e32 v4.12.3
42 6d531c0b068c6eda62dddceedc9f845ecb6feb6f v4.12.4
@@ -16,7 +16,7 b' General Webhook'
16 16 +++++++++++++++
17 17
18 18 :ref:`integrations-webhook` allows sending a JSON payload information to specified
19 url with GET or POST methods. There are several variables that could be used
19 custom URL with GET or POST methods. There are several variables that could be used
20 20 in the URL greatly extending the flexibility of this type of integration.
21 21
22 22 Most of the modern CI systems such as Jenkins, TeamCity, Bamboo or CircleCi
@@ -50,7 +50,7 b' the url would look like that::'
50 50
51 51 Please note that some variables will result in multiple calls.
52 52 e.g. for |HG| specifying `${branch}` will trigger as many builds as how
53 many branches the suer actually pushed. Same applies to `${commit_id}`
53 many branches the user actually pushed. Same applies to `${commit_id}`
54 54 This will trigger many builds if many commits are pushed. This allows
55 55 triggering individual builds for each pushed commit.
56 56
@@ -66,6 +66,9 b' calling such example url provided in :re'
66 66
67 67 http://server/job/${project_id}/build-branch-${branch}/buildWithParameters?token=TOKEN&PARAMETER=value&PARAMETER2=value2
68 68
69 The |RCEE| includes a custom :ref:`integrations-jenkins` integration. That allows using some
70 of Jenkins added security features. Please check also the above link for more examples.
71
69 72
70 73 Team City
71 74 +++++++++
@@ -19,7 +19,8 b' Type/Name |RC| Edi'
19 19 :ref:`integrations-webhook` |RCCEshort| POST events as `json` to a custom url
20 20 :ref:`integrations-ci` |RCCEshort| Trigger Builds for Common CI Systems
21 21 :ref:`integrations-email` |RCCEshort| Send repo push commits by email
22 :ref:`integrations-redmine` |RCEEshort| Close/Resolve/Reference redmine issues
22 :ref:`integrations-jenkins` |RCEEshort| Trigger Builds for Jenkins CI System
23 :ref:`integrations-redmine` |RCEEshort| Close/Resolve/Reference Redmine issues
23 24 :ref:`integrations-jira` |RCEEshort| Close/Resolve/Reference JIRA issues
24 25 ============================ ============ =====================================
25 26
@@ -53,3 +54,4 b' See pages specific to each type of integ'
53 54 webhook
54 55 email
55 56 ci
57 jenkins
@@ -9,6 +9,7 b' Release Notes'
9 9 .. toctree::
10 10 :maxdepth: 1
11 11
12 release-notes-4.12.4.rst
12 13 release-notes-4.12.3.rst
13 14 release-notes-4.12.2.rst
14 15 release-notes-4.12.1.rst
@@ -124,6 +124,7 b' class EEIntegration(IntegrationTypeBase)'
124 124
125 125
126 126 # Helpers #
127 # updating this required to update the `common_vars` as well.
127 128 WEBHOOK_URL_VARS = [
128 129 ('event_name', 'Unique name of the event type, e.g pullrequest-update'),
129 130 ('repo_name', 'Full name of the repository'),
@@ -134,8 +135,9 b' WEBHOOK_URL_VARS = ['
134 135 ('extra:<extra_key_name>', 'Extra repo variables, read from its settings.'),
135 136
136 137 # special attrs below that we handle, using multi-call
137 ('branch', 'Name of each brach submitted, if any.'),
138 ('commit_id', 'Id of each commit submitted, if any.'),
138 ('branch', 'Name of each branch submitted, if any.'),
139 ('branch_head', 'Head ID of pushed branch (full sha of last commit), if any.'),
140 ('commit_id', 'ID (full sha) of each commit submitted, if any.'),
139 141
140 142 # pr events vars
141 143 ('pull_request_id', 'Unique ID of the pull request.'),
@@ -173,11 +175,13 b' class CommitParsingDataHandler(object):'
173 175 _branch = branch_data[commit_branch] \
174 176 if commit_branch else commit_branch
175 177 branch_commits = {'branch': _branch,
178 'branch_head': '',
176 179 'commits': []}
177 180 branches_commits[commit_branch] = branch_commits
178 181
179 182 branch_commits = branches_commits[commit_branch]
180 183 branch_commits['commits'].append(commit)
184 branch_commits['branch_head'] = commit['raw_id']
181 185 return branches_commits
182 186
183 187
@@ -218,10 +222,17 b' class WebhookDataHandler(CommitParsingDa'
218 222
219 223 branches_commits = self.aggregate_branch_data(
220 224 data['push']['branches'], data['push']['commits'])
221 if '${branch}' in url:
225 if '${branch}' in url or '${branch_head}' in url:
222 226 # call it multiple times, for each branch if used in variables
223 227 for branch, commit_ids in branches_commits.items():
224 228 branch_url = string.Template(url).safe_substitute(branch=branch)
229
230 if '${branch_head}' in branch_url:
231 # last commit in the aggregate is the head of the branch
232 branch_head = commit_ids['branch_head']
233 branch_url = string.Template(branch_url).safe_substitute(
234 branch_head=branch_head)
235
225 236 # call further down for each commit if used
226 237 if '${commit_id}' in branch_url:
227 238 for commit_data in commit_ids['commits']:
General Comments 0
You need to be logged in to leave comments. Login now