Commit c4afc3b7 authored by Antoine Regimbeau's avatar Antoine Regimbeau
Browse files

Main script for cdash url

No related merge requests found
Showing with 59 additions and 12 deletions
+59 -12
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
import os.path import os.path
import requests import requests
import glob import glob
import sys
import re import re
import unittest import unittest
...@@ -70,8 +69,11 @@ class Handler: ...@@ -70,8 +69,11 @@ class Handler:
def GetName (self , build_dir = ""): def GetName (self , build_dir = ""):
""" """
This function is looking for the name information in the build tree This function is looking for the name information in the build tree:
which is BuildName
""" """
if ( build_dir == ""):
build_dir = self.build_dir
if self.configure_path == "" and not self.GetConfigureFile( build_dir ): if self.configure_path == "" and not self.GetConfigureFile( build_dir ):
print ("Error in GetName function, could not find Configure.xml") print ("Error in GetName function, could not find Configure.xml")
return False return False
...@@ -94,6 +96,8 @@ class Handler: ...@@ -94,6 +96,8 @@ class Handler:
""" """
This function is looking for the stamp information in the build tree This function is looking for the stamp information in the build tree
""" """
if ( build_dir == ""):
build_dir = self.build_dir
if self.configure_path == "" and not self.GetConfigureFile( build_dir ): if self.configure_path == "" and not self.GetConfigureFile( build_dir ):
print ("Error in GetStamp function, could not find Configure.xml") print ("Error in GetStamp function, could not find Configure.xml")
return False return False
...@@ -149,32 +153,35 @@ class Handler: ...@@ -149,32 +153,35 @@ class Handler:
print("Error in recovering buildid") print("Error in recovering buildid")
return False return False
def GetBuildUrl (self): def GetBuildUrl (self , buildid ="" ):
""" """
This function is returning the build url. It can be called only when This function is returning the build url. It can be called only when
everything is set everything is set
""" """
if ( buildid == "" ):
buildid = self.buildid
if ( buildid == "" ):
print( "Not enougth argument given to build url")
# TODO
return
build_url = self.url build_url = self.url
build_url +="/buildSummary.php?" build_url +="/buildSummary.php?"
build_url += "buildid=" + self.buildid build_url += "buildid=" + self.buildid
return build_url return build_url
#TODO #TODO
class TestHandler(unittest.TestCase): # class TestHandler(unittest.TestCase):
def test_GetConfigureFile (self): # def test_GetConfigureFile (self):
def test_GetName (self): # def test_GetName (self):
def test_GetStamp (self):
def test_GetBuildId (self):
def test_GetBuildUrl (self): # def test_GetStamp (self):
# def test_GetBuildId (self):
# def test_GetBuildUrl (self):
if __name__ == "__main__":
""" """
TODO : TODO :
documentation, header, test if it is possible. documentation, header, test if it is possible.
......
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import cdash_handler
import sys
if __name__ == "__main__":
if ( len(sys.argv) < 5 ):
print("Usage : "+sys.argv[0]+" commit_sha1 project_id site_name build_directory")
handler = cdash_handler.Handler()
handler.site = sys.argv[3]
handler.build_dir = sys.argv[4]
handler.GetName()
handler.GetStamp()
handler.GetBuildId()
cdash_url = handler.GetBuildUrl()
print ( cdash_url )
gitlab_url = "https://gitlab.orfeo-toolbox.org/api/v4/projects/"
gitlab_url += sys.argv[2] + "/statuses/" + sys.argv[1]
gitlab_url += "?name=cdash:" + handler.name +"&state=success&target_url="
gitlab_url += cdash_url
print (handler.name)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment