Hello community,

here is the log from the commit of package python-python-jenkins for 
openSUSE:Leap:15.2 checked in at 2020-03-23 07:14:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-python-jenkins (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.python-python-jenkins.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-python-jenkins"

Mon Mar 23 07:14:08 2020 rev:12 rq:787284 version:1.7.0

Changes:
--------
--- 
/work/SRC/openSUSE:Leap:15.2/python-python-jenkins/python-python-jenkins.changes
    2020-01-15 15:52:23.163561542 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2/.python-python-jenkins.new.3160/python-python-jenkins.changes
  2020-03-23 07:15:01.918539557 +0100
@@ -1,0 +2,11 @@
+Fri Mar 20 12:14:40 UTC 2020 - [email protected]
+
+- version update to 1.7.0
+  * Include placeholder tasks in get\_running\_builds
+  * Fix reconfig\_credential() to send the xml data
+  * new method: create\_folder (with tests)
+  * new method: check\_jenkinsfile\_syntax (with tests)
+  * Update docs building job
+  * upsert\_job
+
+-------------------------------------------------------------------

Old:
----
  python-jenkins-1.5.0.tar.gz

New:
----
  python-jenkins-1.7.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-python-jenkins.spec ++++++
--- /var/tmp/diff_new_pack.RheK1g/_old  2020-03-23 07:15:02.418539858 +0100
+++ /var/tmp/diff_new_pack.RheK1g/_new  2020-03-23 07:15:02.426539863 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-python-jenkins
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 # Copyright (c) 2014 Thomas Bechtold <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
@@ -19,17 +19,17 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-python-jenkins
-Version:        1.5.0
+Version:        1.7.0
 Release:        0
 Summary:        Python bindings for the remote Jenkins API
 License:        BSD-3-Clause
 Group:          Development/Languages/Python
-URL:            http://opendev.org/jjb/python-jenkins
+URL:            https://opendev.org/jjb/python-jenkins
 Source:         
https://files.pythonhosted.org/packages/source/p/python-jenkins/python-jenkins-%{version}.tar.gz
 BuildRequires:  %{python_module cmd2}
 BuildRequires:  %{python_module mock}
 BuildRequires:  %{python_module multi_key_dict}
-BuildRequires:  %{python_module pbr}
+BuildRequires:  %{python_module pbr >= 0.8.2}
 BuildRequires:  %{python_module requests-mock >= 1.4}
 BuildRequires:  %{python_module requests}
 BuildRequires:  %{python_module stestr >= 2.0}

++++++ python-jenkins-1.5.0.tar.gz -> python-jenkins-1.7.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/.zuul.yaml 
new/python-jenkins-1.7.0/.zuul.yaml
--- old/python-jenkins-1.5.0/.zuul.yaml 2019-07-25 18:52:55.000000000 +0200
+++ new/python-jenkins-1.7.0/.zuul.yaml 2020-03-04 04:06:09.000000000 +0100
@@ -10,7 +10,7 @@
 
 - project:
     templates:
-      - docs-on-readthedocs-failing
+      - build-openstack-docs-pti
       - openstack-cover-jobs
       - openstack-python35-jobs
       - openstack-python36-jobs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/AUTHORS 
new/python-jenkins-1.7.0/AUTHORS
--- old/python-jenkins-1.5.0/AUTHORS    2019-07-25 18:54:14.000000000 +0200
+++ new/python-jenkins-1.7.0/AUTHORS    2020-03-04 04:07:27.000000000 +0100
@@ -34,6 +34,7 @@
 Jan Hruban <[email protected]>
 Jan Priessnitz <[email protected]>
 Jan Zerebecki <[email protected]>
+Jeff Schroeder <[email protected]>
 Jeremy Stanley <[email protected]>
 Jerome Hourquebie <[email protected]>
 Jerry Zhao <[email protected]>
@@ -48,9 +49,11 @@
 Lukas Vacek <[email protected]>
 Marc Abramowitz <[email protected]>
 Marc Abramowitz <[email protected]>
+Marcos Diez <[email protected]>
 Monty Taylor <[email protected]>
 Nickolas Pohilets <[email protected]>
 Ondřej Nový <[email protected]>
+Pascal Hofmann <[email protected]>
 Richard Felkl <[email protected]>
 Richard Pijnenburg <[email protected]>
 Sam Clotfelter <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/ChangeLog 
new/python-jenkins-1.7.0/ChangeLog
--- old/python-jenkins-1.5.0/ChangeLog  2019-07-25 18:54:14.000000000 +0200
+++ new/python-jenkins-1.7.0/ChangeLog  2020-03-04 04:07:27.000000000 +0100
@@ -1,6 +1,20 @@
 CHANGES
 =======
 
+1.7.0
+-----
+
+* Include placeholder tasks in get\_running\_builds
+
+1.6.0
+-----
+
+* Fix reconfig\_credential() to send the xml data
+* new method: create\_folder (with tests)
+* new method: check\_jenkinsfile\_syntax (with tests)
+* Update docs building job
+* upsert\_job
+
 1.5.0
 -----
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/PKG-INFO 
new/python-jenkins-1.7.0/PKG-INFO
--- old/python-jenkins-1.5.0/PKG-INFO   2019-07-25 18:54:14.000000000 +0200
+++ new/python-jenkins-1.7.0/PKG-INFO   2020-03-04 04:07:28.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: python-jenkins
-Version: 1.5.0
+Version: 1.7.0
 Summary: Python bindings for the remote Jenkins API
 Home-page: http://git.openstack.org/cgit/openstack/python-jenkins
 Author: Ken Conley
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/jenkins/__init__.py 
new/python-jenkins-1.7.0/jenkins/__init__.py
--- old/python-jenkins-1.5.0/jenkins/__init__.py        2019-07-25 
18:52:55.000000000 +0200
+++ new/python-jenkins-1.7.0/jenkins/__init__.py        2020-03-04 
04:06:09.000000000 +0100
@@ -110,6 +110,7 @@
 DELETE_JOB = '%(folder_url)sjob/%(short_name)s/doDelete'
 ENABLE_JOB = '%(folder_url)sjob/%(short_name)s/enable'
 DISABLE_JOB = '%(folder_url)sjob/%(short_name)s/disable'
+CHECK_JENKINSFILE_SYNTAX = 'pipeline-model-converter/validateJenkinsfile'
 SET_JOB_BUILD_NUMBER = 
'%(folder_url)sjob/%(short_name)s/nextbuildnumber/submit'
 COPY_JOB = 
'%(from_folder_url)screateItem?name=%(to_short_name)s&mode=copy&from=%(from_short_name)s'
 RENAME_JOB = 
'%(from_folder_url)sjob/%(from_short_name)s/doRename?newName=%(to_short_name)s'
@@ -1170,6 +1171,52 @@
         if not self.job_exists(name):
             raise JenkinsException(exception_message % name)
 
+    def create_folder(self, folder_name, ignore_failures=False):
+        '''Create a new Jenkins folder
+
+        :param folder_name: Name of Jenkins Folder, ``str``
+        :param ignore_failures: if True, don't raise if it was not possible to 
create the folder, ``bool``
+        '''
+        folder_url, short_name = self._get_job_folder(folder_name)
+        url = self._build_url(CREATE_JOB, locals())
+        data = {
+            "name": folder_name,
+            "mode": "com.cloudbees.hudson.plugins.folder.Folder"
+        }
+        try:
+            response = self.jenkins_request(requests.Request('POST', url, 
data=data))
+        except requests.exceptions.HTTPError:
+            if not ignore_failures:
+                raise JenkinsException('Error creating folder [%s]. Probably 
it already exists.' % (folder_name))
+
+    def upsert_job(self, name, config_xml):
+        '''Create a new Jenkins job or reconfigures it if it exists
+
+        :param name: Name of Jenkins job, ``str``
+        :param config_xml: config file text, ``str``
+        '''
+
+        if self.job_exists(name):
+            self.reconfig_job(name, config_xml)
+        else:
+            self.create_job(name, config_xml)
+
+    def check_jenkinsfile_syntax(self, jenkinsfile):
+        '''Checks if a Pipeline Jenkinsfile has a valid syntax
+
+        :param jenkinsfile: Jenkinsfile text, ``str``
+        :returns: List of errors in the Jenkinsfile. Empty list if no errors.
+        '''
+        # https://jenkins.io/doc/book/pipeline/development/#linter
+        # JENKINS_CRUMB=`curl 
"$JENKINS_URL/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)"
+        # curl -X POST -H $JENKINS_CRUMB -F "jenkinsfile=<Jenkinsfile" 
$JENKINS_URL/pipeline-model-converter/val
+        url = self._build_url(CHECK_JENKINSFILE_SYNTAX, locals())
+        the_data = {
+            "jenkinsfile": jenkinsfile
+        }
+        response = self.jenkins_request(requests.Request('POST', url, 
data=the_data))
+        return response.json().get("data", {}).get("errors", [])
+
     def create_job(self, name, config_xml):
         '''Create a new Jenkins job
 
@@ -1414,7 +1461,7 @@
                     raise
             for executor in info['executors']:
                 executable = executor['currentExecutable']
-                if executable and 'PlaceholderTask' not in 
executable.get('_class', ''):
+                if executable and 'number' in executable:
                     executor_number = executor['number']
                     build_number = executable['number']
                     url = executable['url']
@@ -2089,9 +2136,14 @@
         folder_url, short_name = self._get_job_folder(folder_name)
         name = self._get_tag_text('id', config_xml)
         self.assert_credential_exists(name, folder_name, domain_name)
+
+        reconfig_url = self._build_url(CONFIG_CREDENTIAL, locals())
+
         self.jenkins_open(requests.Request(
-            'POST', self._build_url(CONFIG_CREDENTIAL, locals())
-            ))
+            'POST', reconfig_url,
+            data=config_xml.encode('utf-8'),
+            headers=DEFAULT_HEADERS
+        ))
 
     def list_credentials(self, folder_name, domain_name='_'):
         '''List credentials in domain of folder
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-jenkins-1.5.0/python_jenkins.egg-info/PKG-INFO 
new/python-jenkins-1.7.0/python_jenkins.egg-info/PKG-INFO
--- old/python-jenkins-1.5.0/python_jenkins.egg-info/PKG-INFO   2019-07-25 
18:54:14.000000000 +0200
+++ new/python-jenkins-1.7.0/python_jenkins.egg-info/PKG-INFO   2020-03-04 
04:07:27.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: python-jenkins
-Version: 1.5.0
+Version: 1.7.0
 Summary: Python bindings for the remote Jenkins API
 Home-page: http://git.openstack.org/cgit/openstack/python-jenkins
 Author: Ken Conley
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-jenkins-1.5.0/python_jenkins.egg-info/SOURCES.txt 
new/python-jenkins-1.7.0/python_jenkins.egg-info/SOURCES.txt
--- old/python-jenkins-1.5.0/python_jenkins.egg-info/SOURCES.txt        
2019-07-25 18:54:14.000000000 +0200
+++ new/python-jenkins-1.7.0/python_jenkins.egg-info/SOURCES.txt        
2020-03-04 04:07:28.000000000 +0100
@@ -33,6 +33,7 @@
 tests/base.py
 tests/helper.py
 tests/test_build.py
+tests/test_check_jenkinsfile_syntax.py
 tests/test_credential.py
 tests/test_info.py
 tests/test_jenkins.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-jenkins-1.5.0/python_jenkins.egg-info/pbr.json 
new/python-jenkins-1.7.0/python_jenkins.egg-info/pbr.json
--- old/python-jenkins-1.5.0/python_jenkins.egg-info/pbr.json   2019-07-25 
18:54:14.000000000 +0200
+++ new/python-jenkins-1.7.0/python_jenkins.egg-info/pbr.json   2020-03-04 
04:07:27.000000000 +0100
@@ -1 +1 @@
-{"git_version": "35f660a", "is_release": true}
\ No newline at end of file
+{"git_version": "9e66e45", "is_release": true}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/tests/helper.py 
new/python-jenkins-1.7.0/tests/helper.py
--- old/python-jenkins-1.5.0/tests/helper.py    2019-07-25 18:52:55.000000000 
+0200
+++ new/python-jenkins-1.7.0/tests/helper.py    2020-03-04 04:06:09.000000000 
+0100
@@ -104,5 +104,6 @@
     # and accessed by key
     response.headers = real_response.headers
     response.content = text
+    response.json = lambda: json_body
 
     return response
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/tests/test_build.py 
new/python-jenkins-1.7.0/tests/test_build.py
--- old/python-jenkins-1.5.0/tests/test_build.py        2019-07-25 
18:52:55.000000000 +0200
+++ new/python-jenkins-1.7.0/tests/test_build.py        2020-03-04 
04:06:09.000000000 +0100
@@ -432,7 +432,7 @@
 
     @patch.object(jenkins.Jenkins, 'get_node_info')
     @patch.object(jenkins.Jenkins, 'get_nodes')
-    def test_placeholder_task_in_queue(self, nodes_mock, node_info_mock):
+    def test_unnumbered_task_in_queue(self, nodes_mock, node_info_mock):
         nodes_to_return = [{
             'name': "foo-slave", 'offline': False
         }]
@@ -448,13 +448,7 @@
                     "progress": -1
                 },
                 {
-                    'currentExecutable': {
-                        '_class': (
-                            'org.jenkinsci.plugins.workflow.support.steps.'
-                            'ExecutorStepExecution$PlaceholderTask$'
-                            'PlaceholderExecutable'
-                        )
-                    },
+                    'currentExecutable': {},
                     'currentWorkUnit': {},
                     'idle': False,
                     'likelyStuck': False,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-jenkins-1.5.0/tests/test_check_jenkinsfile_syntax.py 
new/python-jenkins-1.7.0/tests/test_check_jenkinsfile_syntax.py
--- old/python-jenkins-1.5.0/tests/test_check_jenkinsfile_syntax.py     
1970-01-01 01:00:00.000000000 +0100
+++ new/python-jenkins-1.7.0/tests/test_check_jenkinsfile_syntax.py     
2020-03-04 04:06:09.000000000 +0100
@@ -0,0 +1,65 @@
+from mock import patch
+
+from tests.base import JenkinsTestBase
+from tests.helper import build_response_mock
+
+
+class JenkinsCheckJenkinsfileSyntax(JenkinsTestBase):
+
+    @patch('jenkins.requests.Session.send', autospec=True)
+    def test_check_syntax_of_a_valid_file(self, session_send_mock):
+
+        valid_jenkinsfile_content = """
+        pipeline {
+            agent any ;
+            stages {
+                stage("blah")
+                {
+                    stexps {
+                        sh("pwd")
+                    }
+                }
+            }
+        }
+        """
+
+        valid_response = {
+            "status": "ok",
+            "data": {
+                "result": "success"
+            }
+        }
+        session_send_mock.side_effect = iter([
+            build_response_mock(200, self.crumb_data),  # crumb
+            build_response_mock(200, valid_response)  # request
+        ])
+        response = self.j.check_jenkinsfile_syntax(valid_jenkinsfile_content)
+        self.assertEqual(response, [])
+
+    @patch('jenkins.requests.Session.send', autospec=True)
+    def test_check_syntax_of_an_invalid_file(self, session_send_mock):
+
+        invalid_jenkinsfile_content = """node {  "pwd" } """
+
+        invalid_response = {
+         "status": "ok",
+         "data": {
+          "result": "failure",
+          "errors": [
+           {
+            "error": [
+             "Unknown stage section \"stexps\". Starting with version 0.5, 
steps in a stage must be" +
+             " in a \"steps\" block. @ line 5, column 9.",
+             "Expected one of \"steps\", \"stages\", or \"parallel\" for stage 
\"blah\" @ line 5, column 9."
+            ]
+           }
+          ]
+         }
+        }
+
+        session_send_mock.side_effect = iter([
+            build_response_mock(200, self.crumb_data),  # crumb
+            build_response_mock(200, invalid_response)  # request
+        ])
+        response = self.j.check_jenkinsfile_syntax(invalid_jenkinsfile_content)
+        self.assertEqual(response, invalid_response["data"]["errors"])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/tests/test_credential.py 
new/python-jenkins-1.7.0/tests/test_credential.py
--- old/python-jenkins-1.5.0/tests/test_credential.py   2019-07-25 
18:52:55.000000000 +0200
+++ new/python-jenkins-1.7.0/tests/test_credential.py   2020-03-04 
04:06:09.000000000 +0100
@@ -332,6 +332,10 @@
             jenkins_mock.call_args_list[2][0][0].url,
             self.make_url('job/Test%20Folder/credentials/store/folder/domain/'
                           '_/credential/Test%20Credential/config.xml'))
+        self.assertEqual(
+            jenkins_mock.call_args_list[2][0][0].data,
+            self.config_xml.encode('utf-8'))
+
         self._check_requests(jenkins_mock.call_args_list)
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-jenkins-1.5.0/tests/test_job_folder.py 
new/python-jenkins-1.7.0/tests/test_job_folder.py
--- old/python-jenkins-1.5.0/tests/test_job_folder.py   2019-07-25 
18:52:56.000000000 +0200
+++ new/python-jenkins-1.7.0/tests/test_job_folder.py   2020-03-04 
04:06:09.000000000 +0100
@@ -2,6 +2,7 @@
 
 import jenkins
 from tests.base import JenkinsTestBase
+from tests.helper import build_response_mock
 
 
 class JenkinsGetJobFolderTest(JenkinsTestBase):
@@ -23,3 +24,38 @@
         folder, name = self.j._get_job_folder('folder1/folder2/my job')
         self.assertEqual(folder, 'job/folder1/job/folder2/')
         self.assertEqual(name, 'my job')
+
+
+class JenkinsCreateFolderTest(JenkinsTestBase):
+
+    @patch('jenkins.requests.Session.send', autospec=True)
+    def test_create_new_folder(self, session_send_mock):
+        session_send_mock.side_effect = iter([
+            build_response_mock(200, self.crumb_data),  # crumb
+            build_response_mock(200, None),  # request
+        ])
+        self.j.create_folder(u'New-Test-Folder')
+
+    @patch('jenkins.requests.Session.send', autospec=True)
+    def test_create_new_folder_that_already_exists(self, session_send_mock):
+        session_send_mock.side_effect = iter([
+            build_response_mock(200, self.crumb_data),  # crumb
+            build_response_mock(400),  # request
+        ])
+
+        folder_name = u'Folder-that-already-exists'
+
+        with self.assertRaises(jenkins.JenkinsException) as context_manager:
+            self.j.create_folder(folder_name)
+        self.assertEqual(
+            str(context_manager.exception),
+            u'Error creating folder [' + folder_name + ']. Probably it already 
exists.')
+
+    @patch('jenkins.requests.Session.send', autospec=True)
+    def test_create_new_folder_that_already_exists_ignoring_errors(self, 
session_send_mock):
+        session_send_mock.side_effect = iter([
+            build_response_mock(200, self.crumb_data),  # crumb
+            build_response_mock(400),  # request
+        ])
+
+        self.j.create_folder(u'Folder-that-already-exists', 
ignore_failures=True)


Reply via email to