Commit ccd5751e authored by Roscoe A. Bartlett's avatar Roscoe A. Bartlett
Browse files

Automatic snapshot commit from tribits at e96a835

Origin repo remote tracking branch: 'casl-github/master'
Origin repo remote repo URL: 'casl-github = git@github.com:CASL/TriBITS.git'

At commit:

commit e96a8357e1bc6c67c554132ba70d8bca44d526f3
Author:  Baird, Mark L <bairdml@ornl.gov>
Date:    Mon Nov 11 14:26:27 2019 -0500
Summary: Updating README_checkin.md
parent 1992c03e
Loading
Loading
Loading
Loading
+37 −13
Original line number Diff line number Diff line
@@ -2,10 +2,33 @@
Release Notes for TriBITS
----------------------------------------

2108/10/10:

(*) MAJOR: TriBITS Core: Changed minimum CMake version from 2.8.11 to 3.10.0.

2017/09/25:

(*) MINOR: TriBITS CTest Driver: Added cache and enve vars
    CTEST_SUBMIT_RETRY_COUNT and CTEST_SUBMIT_RETRY_DELAY to allow the number
    of ctest_submit() submit attemtps to retry and how how log to pause
    between retries.  Before, these were hard-coded to 25 and 120
    respectively, which means that something like a MySQL insertion error
    could consume as much as 50 minutes befor moving on!  The new defalts are
    set at 5 retries with a 3 sec delay (which appear to be the CTest
    defaults).

2017/09/30:

(*) MINOR: TriBITS Core: Added TEST_<IDX> COPY_FILES_TO_TEST_DIR block for
    TRIBITS_ADD_ADVANCED_TEST().  This was added in such a way so to avoid
    clashing with existing usages of the script (since the new arguments
    SOURCE_DIR and DEST_DIR are only parsed if COPY_FILES_TO_TEST_DIR is
    listed in the TEST_<IDX> block.

2017/09/05:

(*) MINOR: Unparsed and otherwise ignored arguments are now flagged (see
    developers guide documentation for
(*) MINOR: TriBITS Core: Unparsed and otherwise ignored arguments are now
    flagged (see developers guide documentation for
    ${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS).  The default value is
    'WARNING' which results in simply printing a warning but allow configure
    to complete.  This allows one to see the warnings but for the project to
@@ -14,8 +37,8 @@ Release Notes for TriBITS

2017/06/24:

(*) MINOR: Add new all-at-once more for CTest -S driver scripts using
    TRIBITS_CTEST_DRIVER() by setting the variable
(*) MINOR: TriBITS CTest Driver: Add new all-at-once more for CTest -S driver
    scripts using TRIBITS_CTEST_DRIVER() by setting the variable
    ${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE=TRUE.  This works with older versions
    of CMake/CTest and CDash but, by default, will just return a single glob
    of results, not breaking results out package-by-package.  Therefore, this
@@ -33,27 +56,27 @@ Release Notes for TriBITS

2017/05/25:

(*) MINOR: PARSE_ARGUMENTS() has been deprecated and replaced by
(*) MINOR: TriBITS Core: PARSE_ARGUMENTS() has been deprecated and replaced by
    CMAKE_PARSE_ARGUMENTS() everywhere in TriBITS. Any call to
    PARSE_ARGUMENTS() will warn users and tell them to use
    CMAKE_PARSE_ARGUMENTS() instead.

2017/05/17:

(*) MAJOR: TriBITS now unconditionally sets
(*) MAJOR: TriBITS Core: TriBITS now unconditionally sets
    ${PROJECT_NAME}_ENABLE_Fortran_DEFAULT to ON.  Projects will now need to
    put in special logic to set to OFF or ON for certain platforms.

2017/01/11:

(*) MINOR: TriBITS now correctly sets the default value for
(*) MINOR: TriBITS Core: TriBITS now correctly sets the default value for
    DART_TESTING_TIMEOUT to 1500 seconds and will scale it by
    <Project>_SCALE_TEST_TIMEOUT even if DART_TESTING_TIMEOUT is not
    explicitly set.

2016/12/07:

(*) MAJOR: The long deprecated variable
(*) MAJOR: TriBITS Core: The long deprecated variable
    ${PROJECT_NAME}_ENABLE_SECONDARY_STABLE_CODE has been removed.  Upgrading
    existing TriBITS projects just requires a simple string replacement of
    _ENABLE_SECONDARY_STABLE_CODE with _ENABLE_SECONDARY_TESTED_CODE in all
@@ -63,11 +86,12 @@ Release Notes for TriBITS

2016/11/02:

(*) MAJOR: gitdist now accepts --dist-repos and --dist-not-repos arguments and
    requires that the base repo '.' be explicitly listed in the
    .gitdist[.default] files and in --dist-repos.  The arguments
    --dist-extra-repos, --dist-not-extra-repos and --dist-not-base-repo are
    not longer supported.  See gitdist --help for more details.
(*) MAJOR: TriBITS Python Utils: gitdist now accepts --dist-repos and
    --dist-not-repos arguments and requires that the base repo '.' be
    explicitly listed in the .gitdist[.default] files and in --dist-repos.
    The arguments --dist-extra-repos, --dist-not-extra-repos and
    --dist-not-base-repo are not longer supported.  See gitdist --help for
    more details.

(*) MINOR: TriBITS projects now install with full RPATH set by default (see
    "Setting install RPATH" in build reference guide).
+2047 −0

File added.

Preview size limit exceeded, changes collapsed.

+0 −249
Original line number Diff line number Diff line
# @HEADER
# ************************************************************************
#
#            TriBITS: Tribal Build, Integrate, and Test System
#                    Copyright 2013 Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ************************************************************************
# @HEADER

try:
  # Python 2
  from urllib2 import urlopen
except ImportError:
  # Python 3
  from urllib.request import urlopen

import json
import datetime
import pprint

from FindGeneralScriptSupport import *

pp = pprint.PrettyPrinter()


# Validate a date format
def validateYYYYMMDD(dateText):
  try:
    return datetime.datetime.strptime(dateText, '%Y-%m-%d')
  except ValueError:
    raise ValueError("Incorrect data format for '"+dateText+"', should be YYYY-MM-DD")


# Construct the full query URL given the pieces
def getCDashIndexQueryUrl(cdashUrl, projectName, date, filterFields):
  return cdashUrl+"/api/v1/index.php?project="+projectName+"&date="+date \
    + "&"+filterFields


# Given a CDash query URL, return the full Python CDash data-structure
def extractCDashApiQueryData(cdashApiQueryUrl):
  response = urlopen(cdashApiQueryUrl)
  return json.load(response)


# Collect CDash index.php build summary fields
def collectCDashIndexBuildSummaryFields(fullCDashIndexBuild):
  summaryBuild = {
    u('buildname') : fullCDashIndexBuild.get('buildname', 'missing_build_name'),
    u('update') : \
      fullCDashIndexBuild.get('update', {'errors':9999,'this_field_was_missing':1}),
    u('configure') : \
      fullCDashIndexBuild.get('configure', {'error':9999,'this_field_was_missing':1}),
    u('compilation') : \
      fullCDashIndexBuild.get('compilation', {'error':9999,'this_field_was_missing':1}),
    u('test') : \
     fullCDashIndexBuild.get('test', {'fail':9999, 'notrun':9999,'this_field_was_missing':1} ),
    }
  return summaryBuild


# Given the full Python CDash API builds data-structure returned from the
# CDash index.php page and query, return an reduced data-structure to be used
# for pass/fail examination.
#
# This function takes in the data-structre directly returned from:
#
#   <cdash-url>/api/v1/index.php?project=<project>&date=<YYYY-MM-DD>&<filter-fields>
#
# The input full CDash API collapsed builds data-structure that has the
# following structure and fields of interest:
#
#  fullCDashIndexBuilds =
#  {
#    'all_buildgroups': [ {'id':1,'name:"Nightly"}, ...],
#    'buildgroups': [
#      {
#        'builds":[
#          {
#            'buildname':"???",
#            'update': {'errors':???, ...},
#            'configure':{'error': ???, ...},
#            'compilation':{'error': ???, ...},
#            'test': {'fail':???, 'notrun':???, 'pass':???, ...},
#            ...
#            },
#            ...
#          ]
#        },
#        ...
#      ...
#      ]
#      },
#      ...
#    }
#
# This function gets the data from *all* of the collapsed builds and returns
# the reduced data-structure:
#
#   [
#     {
#       'buildname':"???",
#       'update': {'errors':???, ...},
#       'configure':{'error': ???, ...},
#       'compilation':{'error': ???, ...},
#       'test': {'fail':???, 'notrun':???, 'pass':???, ...},
#       ...
#       },
#       ...
#       }
#
# This collects *all* of the builds from all of the build groups, not just the
# 'Nighlty' build group.  Therefore, if you want to only consider on set of
# build groups, you need to add that to the CDash query URL
# (e.g. group='Nighlty').
#
def getCDashIndexBuildsSummary(fullCDashIndexBuilds):
  summaryCDashIndexBuilds = []
  for buildgroup in fullCDashIndexBuilds["buildgroups"]:
    for build in buildgroup["builds"]:
      summaryBuild = collectCDashIndexBuildSummaryFields(build)
      summaryCDashIndexBuilds.append(summaryBuild)
  return summaryCDashIndexBuilds
  

# Return if a CDash Index build passes
def cdashIndexBuildPasses(cdashIndexBuild):
  if cdashIndexBuild['update']['errors'] > 0:
    return False
  if cdashIndexBuild['configure']['error'] > 0:
    return False
  if cdashIndexBuild['compilation']['error'] > 0:
    return False
  if (cdashIndexBuild['test']['fail'] + cdashIndexBuild['test']['notrun'])  > 0:
    return False
  return True
  

# Return if a list of CDash builds pass or fail and return error string if
# they fail.
def cdashIndexBuildsPass(summaryCDashIndexBuilds):
  buildsPass = True
  buildFailedMsg = ""
  for build in summaryCDashIndexBuilds:
    if not cdashIndexBuildPasses(build):
      buildsPass = False
      buildFailedMsg = "Error, the build " + sorted_dict_str(build) + " failed!"
      break
  return (buildsPass, buildFailedMsg)


# Extract the set of build names from a list of build names
def getCDashIndexBuildNames(summaryCDashIndexBuilds):
  buildNames = []
  for build in summaryCDashIndexBuilds:
    buildNames.append(build['buildname'])
  return buildNames


# Return if all of the expected builds exist and an error message if they
# don't.
def doAllExpectedBuildsExist(buildNames, expectedBuildNames):
  allExpectedBuildsExist = True
  errMsg = ""
  for expectedBuildName in expectedBuildNames:
    if findInSequence(buildNames, expectedBuildName) == -1:
      allExpectedBuildsExist = False
      errMsg = "Error, the expected build '"+expectedBuildName+"'" \
        +" does not exist in the list of builds "+str(buildNames) 
      break
  return (allExpectedBuildsExist, errMsg)    


# Return if a list of summary CDash index.php builds pass and has all of the
# expected builds.
def cdashIndexBuildsPassAndExpectedExist(summaryCDashIndexBuilds, 
  expectedBuildNames \
  ):
  cdashIndexBuildsPassAndExpectedExist_pass = True
  errMsg = ""
  # Check that all of the builds pass!
  if cdashIndexBuildsPassAndExpectedExist_pass:
    (buildsPass, buildFailedMsg) = cdashIndexBuildsPass(summaryCDashIndexBuilds)
    if not buildsPass:
      cdashIndexBuildsPassAndExpectedExist_pass = False
      errMsg = buildFailedMsg
  # Check that all of the expected builds are listed
  if cdashIndexBuildsPassAndExpectedExist_pass:
    buildNames = getCDashIndexBuildNames(summaryCDashIndexBuilds)
    (allExpectedBuildsExist, errMsg) = \
      doAllExpectedBuildsExist(buildNames, expectedBuildNames)
    if not allExpectedBuildsExist:
      cdashIndexBuildsPassAndExpectedExist_pass = False
      errMsg = errMsg
  return (cdashIndexBuildsPassAndExpectedExist_pass, errMsg)


# Determine if CDash index.php query builds all pass and has all expected
# builds.
def queryCDashAndDeterminePassFail(cdashUrl, projectName, date, filterFields,
  expectedBuildNames, printCDashUrl=True,
  extractCDashApiQueryData_in=extractCDashApiQueryData \
  ):
  # Get the query data
  cdashQueryUrl = getCDashIndexQueryUrl(cdashUrl, projectName, date, filterFields)
  if printCDashUrl:
    print("Getting data from:\n\n  " + cdashQueryUrl )
  fullCDashIndexBuilds = extractCDashApiQueryData_in(cdashQueryUrl)
  summaryCDashIndexBuilds = getCDashIndexBuildsSummary(fullCDashIndexBuilds)
  # Determine pass/fail
  (cdashIndexBuildsPassAndExpectedExist_pass, errMsg) = \
    cdashIndexBuildsPassAndExpectedExist(summaryCDashIndexBuilds, expectedBuildNames)
  if not cdashIndexBuildsPassAndExpectedExist_pass:
    return (False, errMsg)
  return (True, "")
    


+187 −114
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import os
import time
import pprint
import re
import subprocess

checkinTestBasePath = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))

@@ -281,7 +282,6 @@ def getRepoStats(inOptions, gitRepo_inout):
  finally:
    os.chdir(pwd)


def getReposStats(inOptions, tribitsGitRepos):
  hasChangesToPush = False
  repoStatTable = gitdist.RepoStatTable()
@@ -293,7 +293,7 @@ def getReposStats(inOptions, tribitsGitRepos):
    repoStatTableDirName = getRepoStatTableDirName(inOptions, gitRepo.repoDir)
    repoStatTable.insertRepoStat(repoStatTableDirName, gitRepo.gitRepoStats, repoIdx)
    repoIdx += 1
  print(gitdist.createAsciiTable(repoStatTable.getTableData()))
  print(gitdist.createTable(repoStatTable.getTableData()))
  return hasChangesToPush
  # NOTE: Above, we could just call 'gitdist dist-repo-status' but by
  # printing the table here with the actualy gitRepoStat data, we ensure
@@ -334,6 +334,7 @@ def executePull(gitRepo, inOptions, baseTestDir, outFile, pullFromRepo=None,
  :
  cmnd = inOptions.git+" pull"
  if pullFromRepo:
    print(pullFromRepo.remoteBranch)
    repoSpaceBranch = pullFromRepo.remoteRepo+" "+pullFromRepo.remoteBranch
    print("\nPulling in updates to local repo '" + gitRepo.repoName + "'" +
          " from '" + repoSpaceBranch + "' ...\n")
@@ -359,6 +360,11 @@ def executePull(gitRepo, inOptions, baseTestDir, outFile, pullFromRepo=None,
    else:
      print("\n  ==> '" + gitRepo.repoName +
            "': Did not pull any changes from this repo!")
  else:
    print("repoSpaceBranch is: "+gitRepo.gitRepoStats.trackingBranch+"...better not be master")
    if  gitRepo.gitRepoStats.trackingBranch != 'origin/master':
      print("\n  ==> '" + gitRepo.repoName + "': Successful testing will create merge request for '" + gitRepo.gitRepoStats.trackingBranch + "' branch" )
      pullGotChanges = False
    else:
      print("\n  ==> '" + gitRepo.repoName + "': Pull failed!")
      pullGotChanges = False
@@ -846,7 +852,7 @@ def getCurrentDiffOutputAndLogModified(inOptions, gitRepo, baseTestDir):

def extractPackageEnablesFromChangeStatus(changedFileDiffOutputStr, inOptions_inout,
  gitRepo, enablePackagesList_inout, verbose=True,
  projectDependenciesLocal=None ) \
  projectDependenciesLocal=None, projectChangeLogic=DefaultProjectCiFileChangeLogic() ) \
  :

  if not projectDependenciesLocal:
@@ -859,7 +865,7 @@ def extractPackageEnablesFromChangeStatus(changedFileDiffOutputStr, inOptions_in

    # Only look for global rebuild files in the master repo (not in extra repos)
    if gitRepo.repoName == '' and \
      isGlobalBuildFileRequiringGlobalRebuild(modifiedFileFullPath) \
      projectChangeLogic.isGlobalBuildFileRequiringGlobalRebuild(modifiedFileFullPath) \
      :
      if inOptions_inout.enableAllPackages == 'auto':
        if verbose:
@@ -1326,6 +1332,8 @@ def getEnablesLists(inOptions, validPackageTypesList, isDefaultBuild,
  cmakePkgOptions = []
  enablePackagesList = []
  gitRepoList = tribitsGitRepos.gitRepoList()
  projectChangeLogic=getProjectCiFileChangeLogic(inOptions.srcDir)

  enableAllPackages = False

  if inOptions.enableAllPackages == "on":
@@ -1349,8 +1357,8 @@ def getEnablesLists(inOptions, validPackageTypesList, isDefaultBuild,
      if os.path.exists(diffOutFileName):
        changedFileDiffOutputStr = open(diffOutFileName, 'r').read()
        #print("\nchangedFileDiffOutputStr:\n", changedFileDiffOutputStr)
        extractPackageEnablesFromChangeStatus(changedFileDiffOutputStr, inOptions, gitRepo,
          enablePackagesList, verbose)
        extractPackageEnablesFromChangeStatus(changedFileDiffOutputStr, inOptions,
          gitRepo, enablePackagesList, verbose, projectChangeLogic=projectChangeLogic)
      else:
        if verbose:
          print("\nThe file " + diffOutFileName + " does not exist!\n")
@@ -1460,9 +1468,10 @@ def runBuildTestCase(inOptions, tribitsGitRepos, buildTestCase, timings):
    # A.1) Set the base options

    cmakeBaseOptions = []
    if inOptions.useNinja:
      cmakeBaseOptions.append("-GNinja")
    if inOptions.extraCmakeOptions:
      cmakeBaseOptions.extend(commandLineOptionsToList(inOptions.extraCmakeOptions))
  
    cmakeBaseOptions.append(cmakeScopedDefine(projectName,
    "TRIBITS_DIR:PATH", inOptions.tribitsDir))
    cmakeBaseOptions.append(cmakeScopedDefine(projectName,
@@ -1576,6 +1585,9 @@ def runBuildTestCase(inOptions, tribitsGitRepos, buildTestCase, timings):

    if inOptions.doBuild and configurePassed:

      if inOptions.useNinja:
        cmnd = "ninja"
      else:
        cmnd = "make"
      if inOptions.makeOptions:
        cmnd += " " + inOptions.makeOptions
@@ -1701,6 +1713,28 @@ def cleanBuildTestCaseOutputFiles(runBuildTestCaseBool, inOptions, baseTestDir,
      removeIfExists(getEmailSuccessFileName())
      echoChDir("..")

def cleanBuildTestCaseSuccessFiles(runBuildTestCaseBool, inOptions, baseTestDir, \
  buildTestCaseName \
  ):

  removeIfExists(buildTestCaseName+"/"+getConfigureSuccessFileName())
  removeIfExists(buildTestCaseName+"/"+getBuildSuccessFileName())
  removeIfExists(buildTestCaseName+"/"+getTestSuccessFileName())
  removeIfExists(buildTestCaseName+"/"+getEmailSuccessFileName())
  removeIfExists(buildTestCaseName+"/"+getEmailBodyFileName())
  # NOTE: ABove, we need to delete the 'email.out' file otherwise it will get
  # picked up in a later run of just a status check.  But this info is not
  # really last because it is duplicated in the file
  # commitStatusEmailBody.out.


def cleanSuccessFiles(buildTestCaseList, inOptions, baseTestDir):
  print("\nRemoving *.success files ...\n")
  removeIfExists(getInitialPullSuccessFileName())
  for buildTestCase in buildTestCaseList:
    cleanBuildTestCaseSuccessFiles(
      buildTestCase.runBuildTestCase, inOptions, baseTestDir, buildTestCase.name)


def runBuildTestCaseDriver(inOptions, tribitsGitRepos, baseTestDir, buildTestCase, timings):

@@ -2084,6 +2118,8 @@ def checkinTest(tribitsDir, inOptions, configuration={}):

  success = True

  didAtLeastOnePush = False

  timings = Timings()

  subjectLine = None
@@ -2296,6 +2332,10 @@ def checkinTest(tribitsDir, inOptions, configuration={}):
            print("\nPull failed!\n")
            pullPassed = False
            break
#          if gitRepo.gitRepoStats.trackingBranch == 'origin/master':
#            print("\nYou can not push changes to Master!\n")
#            pullPassed = False
#            break
          repoIdx += 1
      else:
        print("\nSkipping initial pull from remote tracking branch!\n")
@@ -2401,7 +2441,7 @@ def checkinTest(tribitsDir, inOptions, configuration={}):

    # Determine if we will run the build/test cases or not

    # Set runBuildCases flag and other logic
    # Set runBuildCases flag and other logic/
    abortGracefullyDueToNoUpdates = False
    abortGracefullyDueToNoChangesToPush = False
    if not performAnyBuildTestActions(inOptions):
@@ -2652,6 +2692,7 @@ def checkinTest(tribitsDir, inOptions, configuration={}):
              doFinalRebase )

          if pull2Rtn != 0:
            print("\nPull failed!\n")
            pullFinalPassed = False
            break

@@ -2697,6 +2738,12 @@ def checkinTest(tribitsDir, inOptions, configuration={}):
              lastCommitMessageStr = getLastCommitMessageStr(inOptions, gitRepo)
              localCommitSHA1ListStr = getLocalCommitsSHA1ListStr(inOptions, gitRepo)

              #if commits on master fail
              if gitRepo.gitRepoStats.trackingBranch == "origin/master":
                print("\nYou can not push to master branch!\n")
                amendFinalCommitPassed = False
                break

              # Get then final commit message
              finalCommitEmailBodyStr = lastCommitMessageStr
              finalCommitEmailBodyStr += getAutomatedStatusSummaryHeaderStr()
@@ -2779,9 +2826,9 @@ def checkinTest(tribitsDir, inOptions, configuration={}):
        #print("debugSkipPush =", debugSkipPush)
        #debugSkipPush = True

        didAtLeastOnePush = False

        repoIdx = 0
        PrivateToken = os.environ["PRIVATE_TOKEN"]
        GitLabUserId = os.environ["GITLAB_USER_ID"]
        for gitRepo in tribitsGitRepos.gitRepoList():

          print("\n7.c." + str(repoIdx) + ") Git Repo: '" + gitRepo.repoName +
@@ -2795,6 +2842,27 @@ def checkinTest(tribitsDir, inOptions, configuration={}):
                workingDir=getGitRepoDir(inOptions.srcDir, gitRepo.repoDir),
                outFile=os.path.join(baseTestDir, getPushOutputFileName(gitRepo.repoName)),
                throwExcept=False, timeCmnd=True )
              if gitRepo.repoName == '' or gitRepo.repoName  == '0':
                BaseSrcDirCmnd = "echo " + inOptions.srcDir + " | sed 's@.*/@@'"
                BaseProjDirOut = subprocess.check_output(BaseSrcDirCmnd, shell=True).strip()
                GitLabHostOutCmnd = "grep '" + BaseProjDirOut + " ' " +inOptions.srcDir+ "/.cipackage.default | sed 's/\s.*$//'"
                GitLabHost = subprocess.check_output(GitLabHostOutCmnd, shell=True).strip()
              else:
                GitLabHostOutCmnd = "grep '" + gitRepo.repoName + "' " +inOptions.srcDir+ "/.cipackage.default | sed 's/\s.*$//'"
                GitLabHost = subprocess.check_output(GitLabHostOutCmnd, shell=True).strip()

              if gitRepo.repoName == '' or gitRepo.repoName  == '0':
                BaseSrcDirCmnd = "echo " + inOptions.srcDir + " | sed 's@.*/@@'"
                BaseProjDir = subprocess.check_output(BaseSrcDirCmnd, shell=True).strip()
                GitLabProjIdCmnd = "grep '"+BaseProjDir+" ' "+inOptions.srcDir+"/.cipackage.default | sed 's/[^ ]* //'"
                GitLabProjId = subprocess.check_output(GitLabProjIdCmnd, shell=True).strip()
              else:
                GitLabProjIdCmnd = "grep "+gitRepo.repoName+" "+inOptions.srcDir+"/.cipackage.default | sed 's/[^ ]* //'"
                GitLabProjId = subprocess.check_output(GitLabProjIdCmnd, shell=True).strip()
              SepTex = "/CASL"
              BaseHost = GitLabHost.split(SepTex, 1)[0]
              print("env HOST=" + BaseHost + " CI_PROJECT_ID=" + GitLabProjId + " CI_COMMIT_REF_NAME=" + gitRepo.gitRepoStats.branch + " GITLAB_USER_ID=" + GitLabUserId + " PRIVATE_TOKEN=" + PrivateToken + " " + inOptions.srcDir + "/autoMergeRequest.sh")
              echoRunSysCmnd("env HOST="+BaseHost+" CI_PROJECT_ID="+GitLabProjId+" CI_COMMIT_REF_NAME="+gitRepo.gitRepoStats.branch+" GITLAB_USER_ID="+GitLabUserId+" PRIVATE_TOKEN="+PrivateToken+" "+inOptions.srcDir+"/autoMergeRequest.sh")
              didAtLeastOnePush = True
            else:
              print("\nSkipping push due to debug override ...")
@@ -2922,9 +2990,13 @@ def checkinTest(tribitsDir, inOptions, configuration={}):
          success = False
      else:
        if okayToPush:
          subjectLine = "READY TO PUSH"
          subjectLine = "PASSED (READY TO PUSH)"
        else:
          subjectLine = "NOT READY TO PUSH"
          if success:
            subjectLine = "PASSED"
          else:
            subjectLine = "FAILED"
          subjectLine += " (NOT READY TO PUSH)"

      #
      print("\n9.b) Create and send out push (or readiness status) notification email ...")
@@ -2945,7 +3017,6 @@ def checkinTest(tribitsDir, inOptions, configuration={}):
      summaryCommitEmailBodyFileName = getCommitStatusEmailBodyFileName()

      writeStrToFile(summaryCommitEmailBodyFileName, emailBodyStr)

      if inOptions.sendEmailTo and abortGracefullyDueToNoUpdates:

        print("\nSkipping sending final email because there were no updates"
@@ -2985,6 +3056,8 @@ def checkinTest(tribitsDir, inOptions, configuration={}):
      print("\nNot performing push or sending out push readiness status on "
            "request!")

    if pushPassed and didAtLeastOnePush and didPush:
      cleanSuccessFiles(buildTestCaseList, inOptions, baseTestDir)

    print("\n***")
    print("*** 10) Run execute extra command on ready to push  ...")
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import sys
ciSupportDir = os.path.dirname(os.path.abspath(__file__))
tribitsDir = os.path.abspath(os.path.join(ciSupportDir, ".."))
pythonUtilsDir = os.path.join(tribitsDir, "python_utils")
defaultProjectDir = os.path.abspath(os.path.join(tribitsDir, "../.."))

sys.path = [pythonUtilsDir] + sys.path

Loading