groovy

Using groovy to parse JSON object in shell scripts for Jenkin

北战南征 提交于 2020-12-12 12:07:50
问题 Say I have a JSON as following: {"id":"1.0.0-6", "version":"1.0.0", "build":6, "tag":"android-v1.0.0-6", "commitHash":"5a78c4665xxxxxxxxxxe1b62c682f84", "dateCreated":"2020-03-02T08:11:29.912Z"} I want to take out the version id from it in Jenkins Groovy file and pass the version id to a JIRA Plugin called XRAY so that it will create a build version as Label in JIRA. stage('Get App version') { steps { container('devicefarm') { steps { sh "LATEST_VERSION=$(curl ${APP_ARTIFACTORY_URL}/${XRAY

Python接口测试实战|特殊字符集自动化测试

天涯浪子 提交于 2020-12-12 02:43:40
在当前互联网产品更新迭代的快节奏下,回归测试的时间被严重压缩,在金融领域和其他互联网应用场景下,支付、转账、清算往往是核心功能,为了确保资金安全和快速到账,接口在对用户名、账户名中的特殊字符的正确处理显得尤为重要。 特殊字符极其丰富,手工测试往往需要耗费大量成本,接口自动化测试因其实现简单、维护成本低、容易提高覆盖率等特点,越来越受重视。 Python由于可移植性好、第三方库丰富、上手简单而成为一种便捷高效的接口自动化测试工具。使用python向接口发送请求,一般包含以下步骤: 1. 请求的组装:请求信息一般包含接口的URL,以及一些其他可能需要的信息,比如headers,post请求需要用的data等; 2. 请求的发送:请求组装好后进行请求的发送,一般分为GET和POST方法,如果需要向接口传输数据,可以在data中传输,并获取返回数据; 3. 响应的解析:接收返回的数据并进行解析。 Python实现了成熟的请求方法,目前新版的python3版本较好地支持第三方库requests,灵活组装请求,发送请求,获取响应信息,支持JSON、文件等多种数据传输格式。 安装好requests后,导入,并简单组装一个get请求: #导入requests包 import requests #接口URL,这里以一个虚拟网址为例 url = ‘http://test.org’ response =

Jenkins RCE漏洞分析汇总

孤人 提交于 2020-12-12 02:36:49
No.1 声明 由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,雷神众测以及文章作者不为此承担任何责任。 雷神众测拥有对此文章的修改和解释权。如欲转载或传播此文章,必须保证此文章的完整性,包括版权声明等全部内容。未经雷神众测允许,不得任意修改或者增减此文章内容,不得以任何方式将其用于商业目的。 No.2 前言 之前针对Jenkins没注意看过,看到廖师傅kcon会议上讲的Java沙箱逃逸就涉及到了Jenkins,包括今年开年时候orange发的Jenkins的组合拳,拖拖拉拉到了年底还没看,所以准备开始看。 这里根据Jenkins的漏洞触发点做了一个归类,一种是通过cli的方式触发,一种是通过我们常见的http方式触发。 No.3 环境搭建 在catalina.sh添加,或者catalina.bat内容不动用如下命令开启,默认是开启8000端口 用如下命令开启 catalina.bat jpda start(Windows) catalina.sh jpda start(linux) No.4 漏洞分析 1.Cli方式触发 CVE-2015-8103 最早开始公开Java 反序列化的时候,何使用 Apache Commons Collections 这个常用库来构造 POP 链(类ROP链),这个在Jenkins上的例子就是这个编号

Groovy: Lombok @NoArgsConstructor not creating default constructor

心已入冬 提交于 2020-12-10 08:49:27
问题 I am using lombok 1.18.6 in my spring boot project and I have @NoArgsConstructor but still am getting org.springframework.orm.jpa.JpaSystemException: No default constructor for entity: : com.validation.entity.Client; nested exception is org.hibernate.InstantiationException: No default constructor for entity: : com.validation.entity.Client] with root cause Below is my Client entity import lombok.AccessLevel import lombok.Data import lombok.NoArgsConstructor import org.hibernate.annotations

Is there any way to list latest Nexus Artifacts in Jenkins?

和自甴很熟 提交于 2020-12-07 08:10:12
问题 I am using Acive Choice Reactive Parameter plugin to list down Nexus Artifacts. This is the groovy script which I'm currently using. import groovy.json.* def targetUrl = "https://nexus.xxxx.lk/service/rest/v1/search?repository=snapshots&format=maven2&group=com.org.pro&name=pro-service" def jsonSlupper = new JsonSlurper().parse(URI.create(targetUrl).toURL()) def list = jsonSlupper["items"]["version"].collect().sort().reverse() I want to display only latest artifact in the list. Does anyone

using groovy-postbuild-plugin in my Jenkins pipeline

淺唱寂寞╮ 提交于 2020-12-07 06:50:32
问题 I'm trying to use the groovy-postbuild-plugin in my Jenkins pipeline, I can get it to work for displaying plain text, But I can't use it with parameters. So this is working: stage('postbuild disply service built') { currentBuild.rawBuild.getActions().add(GroovyPostbuildAction.createShortText("test")); } But this one doesn't: stage('postbuild disply service built') { manager.addShortText("${manager.build.buildVariables.get('REPO_NAME')}"); } This is the error I get: org.jenkinsci.plugins

using groovy-postbuild-plugin in my Jenkins pipeline

为君一笑 提交于 2020-12-07 06:48:48
问题 I'm trying to use the groovy-postbuild-plugin in my Jenkins pipeline, I can get it to work for displaying plain text, But I can't use it with parameters. So this is working: stage('postbuild disply service built') { currentBuild.rawBuild.getActions().add(GroovyPostbuildAction.createShortText("test")); } But this one doesn't: stage('postbuild disply service built') { manager.addShortText("${manager.build.buildVariables.get('REPO_NAME')}"); } This is the error I get: org.jenkinsci.plugins

好好说说Java中的常量池之Class常量池

家住魔仙堡 提交于 2020-12-06 19:13:52
好好说说Java中的常量池之Class常量池 在Java中,常量池的概念想必很多人都听说过。这也是面试中比较常考的题目之一。在Java有关的面试题中,一般习惯通过String的有关问题来考察面试者对于常量池的知识的理解,几道简单的String面试题难倒了无数的开发者。所以说,常量池是Java体系中一个非常重要的概念。 谈到常量池,在Java体系中,共用三种常量池。分别是字符串常量池、Class常量池和运行时常量池。 本文是《好好说说Java中的常量池》系列的第一篇,先来介绍一下到底什么是Class常量池。 什么是Class文件 在Java代码的编译与反编译那些事儿中我们介绍过Java的编译和反编译的概念。我们知道,计算机只认识0和1,所以程序员写的代码都需要经过编译成0和1构成的二进制格式才能够让计算机运行。 我们在深入分析Java的编译原理中提到过,为了让Java语言具有良好的跨平台能力,Java独具匠心的提供了一种可以在所有平台上都能使用的一种中间代码——字节码(ByteCode)。 有了字节码,无论是哪种平台(如Windows、Linux等),只要安装了虚拟机,都可以直接运行字节码。 同样,有了字节码,也解除了Java虚拟机和Java语言之间的耦合。这话可能很多人不理解,Java虚拟机不就是运行Java语言的么?这种解耦指的是什么? 其实

Groovy program to connect mongo db

谁说我不能喝 提交于 2020-12-06 12:06:07
问题 I am trying to connect mongodb using Groovy language but i am getting error like this (which is posted below) and i have added necessary jar file.I am using mongodb verion : mongodb-driver-3.2.2.jar . Please help me to solve this problem Exception in thread "main" java.lang.NoClassDefFoundError: com/mongodb/operation/OperationExecutor at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class

Groovy program to connect mongo db

倾然丶 夕夏残阳落幕 提交于 2020-12-06 12:05:35
问题 I am trying to connect mongodb using Groovy language but i am getting error like this (which is posted below) and i have added necessary jar file.I am using mongodb verion : mongodb-driver-3.2.2.jar . Please help me to solve this problem Exception in thread "main" java.lang.NoClassDefFoundError: com/mongodb/operation/OperationExecutor at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class