Use fallback URL for deploying tools for custom-built .zip 19/34319/4
authorVratko Polak <vrpolak@cisco.com>
Tue, 9 Feb 2016 12:14:51 +0000 (13:14 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 10 Feb 2016 02:43:10 +0000 (02:43 +0000)
NexusKeywords.Deploy_Artifact was assuming that ${BUNDLE_URL}
points to a full Nexus installation.
But if the bundle under test comes from another source
(most notably patch test job on Jenkins, either RelEng or Sandbox)
there are no test tools on similar URLs.

In that case, fall back to default ODL Nexus (snapshot repository).

Change-Id: Icdd09da8ca219d26b42ca60e6aee0520220e9c31
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
csit/libraries/NexusKeywords.robot

index 145bb66afe27fda470a2849e6cdacd7529b6f914..90178aa3313b78db82a0f7e3973f960642c55636 100644 (file)
@@ -16,6 +16,9 @@ Library           SSHLibrary
 Library           String
 Resource          SSHKeywords.robot
 
+*** Variables ***
+${NEXUS_FALLBACK_URL}    http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot
+
 *** Keywords ***
 Initialize_Artifact_Deployment_And_Usage
     [Arguments]    ${tools_system_connect}=True
@@ -60,13 +63,16 @@ NexusKeywords__Detect_Version_To_Pull
     [Return]    ${version}    ${location}
 
 Deploy_Artifact
-    [Arguments]    ${component}    ${artifact}    ${name_prefix}    ${name_suffix}=-executable.jar
+    [Arguments]    ${component}    ${artifact}    ${name_prefix}    ${name_suffix}=-executable.jar    ${fallback_url}=${NEXUS_FALLBACK_URL}
     [Documentation]    Deploy the specified artifact from Nexus to the cwd of the machine to which the active SSHLibrary connection points.
     ...    Must have ${BUNDLE_URL} variable set to the URL from which the
     ...    tested ODL distribution was downloaded and this place must be
     ...    inside a repository created by a standard distribution
-    ...    construction job.
+    ...    construction job. If this is detected to ne be the case, fallback URL is used.
     ${urlbase}=    String.Fetch_From_Left    ${BUNDLE_URL}    /org/opendaylight
+    # If the BUNDLE_URL points somewhere else (perhaps *patch-test* job in Jenkins),
+    # ${urlbase} is the whole ${BUNDLE_URL}, in which case we use the ${fallback_url}
+    ${urlbase}=    BuiltIn.Set_Variable_If    '${urlbase}' != '${BUNDLE_URL}'    ${urlbase}    ${fallback_url}
     ${version}    ${location}=    NexusKeywords__Detect_Version_To_Pull    ${component}
     # TODO: Use RequestsLibrary and String instead of curl and bash utilities?
     ${url}=    BuiltIn.Set_Variable    ${urlbase}/${location}/${artifact}/${version}