我正在尝试从jenkins控制台输出中获取一些URL。我能够在具有其他信息的一行中获取输出,但是无法仅从该输出中获取我需要的网址。
我曾经得到manager.getLogMatcher
来从整个输出中获取整行。我只得到我一直在trim(),drop(),substring()上进行实验的url。在这种情况下我失败了,因为修剪和放下需要通过位置索引,该位置索引可能会因我而异。我想getLastMatcher()可能会解决我的问题,但我确实知道语法或如何使用它。
这是简单的詹金斯文件。
echo "this is test for checking url https://some_fake.com/test"
echo "build number : ${BUILD_NUMber}"
// some other random steps
def x = manager.getLogMatcher('.*checking url.*')
echo "$x" // this will fetch me "this is test for checking url https://some_fake.com/test"
def y = x.matcher.getLastMatcher(https:) // this got failed.
我期望输出为https://some_fake.com/test
我需要一些可以从该特定行获取url的东西。考虑将https
或http
作为关键字