Jenkins libary:如何在另一个库中使用一个库

时间:2018-05-24 15:58:41

标签: jenkins jenkins-pipeline

我有两个不同的库,一个是CommonLib,一个是项目特定的一个ProjectLib。它们在Jenkins文件中动态加载,如下所示

Sub open_evol()
Dim oUIAutomation As New CUIAutomation8
Dim oUIADesktop As IUIAutomationElement
Dim allChilds As IUIAutomationElementArray
Dim allChildsAxys As IUIAutomationElementArray
Dim axys As IUIAutomationElement
Dim axys2 As IUIAutomationElement
Dim intermed As IUIAutomationElement
Dim boxes As IUIAutomationElementArray
Dim boxes2 As IUIAutomationElementArray
Dim a As IUIAutomationElement


Set oUIADesktop = oUIAutomation.GetRootElement

Debug.Print oUIADesktop.CurrentName

Set allChilds = oUIADesktop.FindAll(TreeScope_Children, oUIAutomation.CreateTrueCondition)

For i = 0 To allChilds.Length - 1
    Debug.Print i & ":=" & allChilds.GetElement(i).CurrentName & vbTab & allChilds.GetElement(i).CurrentClassName
    If Left(allChilds.GetElement(i).CurrentName, 12) = "Axys Reports" Then
    Set axys = allChilds.GetElement(i)
    End If
Next

On Error GoTo escape:
axys.SetFocus
On Error GoTo 0

SendKeys "%cee~", True

time1 = Now
time2 = Now + TimeValue("0:00:01")
    Do Until time1 >= time2
        DoEvents
        time1 = Now()
    Loop

Set allChildsAxys = axys.FindAll(TreeScope_Children, oUIAutomation.CreateTrueCondition)

Set axys2 = allChildsAxys.GetElement(0)
Set boxes = axys2.FindAll(TreeScope_Element, oUIAutomation.CreateTrueCondition)

For i = 0 To boxes.Length - 1
    If Left(boxes.GetElement(i).CurrentName, 8) = "Evol e R" Then
    Set intermed = boxes.GetElement(i)
    Debug.Print "intermet: "; boxes.GetElement(i).CurrentName
    End If
Next i

Set boxes2 = intermed.FindAll(TreeScope_Subtree, oUIAutomation.CreateTrueCondition)

boxes2.GetElement(4).SetFocus

SendKeys "+^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT} +^{LEFT}", True
SendKeys "{DELETE}", True
SendKeys "@5ABE2", True

boxes2.GetElement(9).SetFocus

SendKeys "^{RIGHT} +^{LEFT}", True
SendKeys "{DELETE}", True
SendKeys "033118", True

boxes2.GetElement(13).SetFocus

SendKeys "^{RIGHT} +^{LEFT}", True
SendKeys "{DELETE}", True
SendKeys "043018", True

boxes2.GetElement(26).SetFocus

SendKeys "{ENTER}"

End


escape:
MsgBox ("Open Axys Reports")

End Sub

现在在ProjectLib的vars(vars \ test.groovy)中,我有一个函数,它将从commonLib调用一个函数(vars \ runPowershellResScript.groovy)。我的尝试是这样的:

library identifier: 'CommonLib@master', retriever: modernSCM(
[$class: 'GitSCMSource',
     remote: 'https://bitbucket.intra/scm/common/pipeline-helper.git',
     credentialsId: 'bitbucket.user'
])
library identifier: 'ProjectLib@master', retriever: modernSCM(
[$class: 'GitSCMSource',
   remote: 'https://bitbucket.intra/scm/project/jenkins-pipeline-helper-project.git',
   credentialsId: 'bitbucket.user'
 ])

不幸的是,这不符合我的预期和错误

def call() {
    library 'CommonLib'
    runPowershellResScript('ch/mycompany/common/scripts/test.ps1', "-homeDir 'd:\\projectxy")
}

那么如何在另一个中使用动态加载的库?

0 个答案:

没有答案