环境:Linux/Windows7,Java 1.6.0.03/37或1.7
我下载了jenkins.war并在使用以下脚本/命令进行初始设置后,我下载了一些插件(10-15)并尝试重新启动Jenkins,它工作正常.然后,我得到了一些插件(总共30-40个),我选择安装或下载+然后+安装,詹金斯没有出现.
即使用startJenkins.sh(仅限Linux).注意:在Windows7上,Jenkins作为Windows服务启动.
#!/bin/bash
export JAVA_HOME=/production/jenkinsAKS/java/jdk1.6.0_03
export JENKINS_HOME=/production/jenkinsAKS
export PATH=${JAVA_HOME}/bin:${PATH}
export JENKINS_HTTP_PORT=9040
export JENKINS_AJP13_PORT=9949
now=`date +%Y%m%d_%H%M%S`
echo $0 begins ${now}
echo " java-home=${JAVA_HOME}, jenkins-home=${JENKINS_HOME}, path=${PATH}"
java -jar ${JENKINS_HOME}/lib/jenkins.war -XX:MaxPermSize=4096m --logfile=${JENKINS_HOME}/log/jenkins.log${now} --httpPort=${JENKINS_HTTP_PORT} --ajp13Port=${JENKINS_AJP13_PORT} &
Run Code Online (Sandbox Code Playgroud)
最初我没有使用"-XX:MaxPermSize = 4096m"参数,但是当我看到以下错误消息时,我尝试了各种值,如128/512/1024,2048,4096m等,没有帮助解决错误.
INFO: Beginning extraction from war file
Jenkins home directory: /production/jenkinsAKS found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Aug 1, 2013 1:17:15 PM winstone.Logger logInternal
INFO: HTTP Listener started: port=9040
Aug 1, 2013 1:17:15 PM winstone.Logger logInternal
INFO: AJP13 Listener started: port=9949
Aug 1, 2013 1:17:15 PM winstone.Logger …Run Code Online (Sandbox Code Playgroud) Gradle 1.6 Linux.
Java构建项目结构
我有以下全局配置/ build.gradle文件:
apply plugin: 'java'
apply plugin: 'pmd'
apply plugin: 'findbugs'
apply plugin: 'checkstyle'
apply plugin: 'code-quality'
apply plugin: 'jacoco'
tasks.withType(Compile) {
options.debug = true
options.compilerArgs = ["-g"]
}
checkstyle {
configFile = new File(rootDir, "config/checkstyle.xml")
ignoreFailures = true
}
findbugs {
ignoreFailures = true
}
pmd {
ruleSets = ["basic", "braces", "design"]
ignoreFailures = true
}
jacoco {
toolVersion = "0.6.2.201302030002"
reportsDir = file("$buildDir/customJacocoReportDir")
}
sourceSets { …Run Code Online (Sandbox Code Playgroud) 在运行基于Gradle的构建和集成测试后,我在"build/jacoco"文件夹中成功生成了Jacoco的2个.exec文件.
Gradle命令:"gradle clean build integrationTest"
完成后,它会在build/jacoco文件夹下生成以下.exec文件.
以下是我的sonar-project.properties文件.什么时候,我从Linux运行"sonar-runner"它完成但是在SonarQube仪表板上完成了这个项目,我看到单元测试说有34.5%,但集成测试说0.0%.两个.exec文件都有有效的大小.我也在.exec文件上做了"cat",并在Linux中将输出管道输出到"strings"命令,看到IntegrationTest.exec确实命中了测试函数 - 我只有1个.java文件.
当我运行"gradle clean build IntegrationTest sonarRunner -Dxxx.xxx = yyy -Dyyy.xx = zzz"时,即通过使用-D选项传递sonar-project.properties文件中提到的所有声纳变量,它可以工作,但结果相同SonarQube项目的仪表板.Project的声纳仪表板有两个配置为单元/集成测试的小部件,我还包括用于显示整体覆盖范围的IT测试.总体覆盖率显示为34.5%(单位测试%值).Sonar确实看到了test.exec,integrationTest.exec,并且在此操作过程中也自动生成了total-xxx.exec文件.
注意:我不在哪里 - 在Gradle构建脚本中的单独putty/linux控制台-OR上启动tomcat,为Jacoco提供任何值或设置JAVA Agent.我已经获得了integrationTest.exec文件和test.exec文件,所以不确定在IT测试完成运行后是否需要停止JVM.我不认为我需要那些,因为我有.exec文件的有效文件大小.
我的?: - 为什么声纳没有在仪表板上获得IT覆盖,即使我正确设置/传递以下变量:
sonar.jacoco.itReportPath=build/jacoco/integrationTest.exec
Run Code Online (Sandbox Code Playgroud)
-bash-3.2 $ cat sonar-project.properties
# Root project information
sonar.projectKey=com:company:product:ProjectA
sonar.projectName=ProjectA
sonar.projectVersion=1.0
# optional description
sonar.projectDescription=ProjectA Service
#Tells SonarQube that the code coverage tool by unit tests is JaCoCo
sonar.java.coveragePlugin=jacoco
#Tells SonarQube to reuse existing reports for unit tests execution and coverage reports
sonar.dynamicAnalysis=reuseReports
# Some properties that will be …Run Code Online (Sandbox Code Playgroud) 我在我的项目中有很多JUnit单元测试.构建系统是Gradle.操作系统:Windows/Linux.
测试(单元测试)在Gradle中免费,即如果你运行" gradle clean build ",Gradle也会运行"测试"任务(运行你的单元测试).我知道如何在命令行的特定测试的测试文件夹中运行所有测试.例如:请参阅Gradle用户指南中的23.13.3和23.13.4部分:http://www.gradle.org/docs/current/userguide/java_plugin.html#sec:java_test
我的问题:
我想运行除一个或一些以外的所有测试.如何在命令行的Gradle中执行此操作(而不是在build.gradle或更高级别.gradle文件中的test {...}部分中使用exclude).
环境是:Ansible 1.9.2,CentOS 6.5
我创建了一个角色,可以从Artifactory下载3种不同JAVA版本的JAVA(.tar.gz)工件文件.我正在尝试使用Ansible的with_dict功能(而不是使用with_items).
创建了以下文件:
$ cat roles/java/defaults/main.yml
---
java_versions:
java7_60:
version: 1.7.60
group_path: com/oracle/jdk
classifier: linux-x64
ext: tar.gz
dist_file: "jdk-{{ version }}-{{ classifier }}-{{ ext }}"
# dist_file: "jdk-{{item.value.version }}-{{ item.value.classifier }}-{{ item.value.ext }}"
dist_url: "{{ artifactory_url }}/{{ group_path }}/{{ version }}/{{ dist_file }}"
# dist_url: "{{ artifactory_url }}/{{ item.value.group_path }}/{{ item.value.version }}/{{ dist_file }}"
java7_67:
version: 1.7.67
group_path: com/oracle/jdk
classifier: linux-x64
ext: tar.gz
dist_file: "jdk-{{item.value.version }}-{{ item.value.classifier }}-{{ item.value.ext }}"
dist_url: "{{ artifactory_url }}/{{ item.value.group_path }}/{{ item.value.version }}/{{ …Run Code Online (Sandbox Code Playgroud) 我正在使用Ansible:2.2.0.0
两个无聊的盒子(一个CentOS 7.x和一个Ubuntu 14.04)和
第三个盒子是EC2 Amazon Linux实例(Amazon Linux AMI版本2016.03)。
在这些框中,我正在运行以下命令并获得有效的输出(如下所示):
CentOS的:
[vagrant@myvagrant ~] $ ansible all -m setup -i "`hostname`," --connection=local -a "filter=ansible_distribution*"
myvagrant | SUCCESS => {
"ansible_facts": {
"ansible_distribution": "CentOS",
"ansible_distribution_major_version": "7",
"ansible_distribution_release": "Core",
"ansible_distribution_version": "7.2.1511"
},
"changed": false
}
Run Code Online (Sandbox Code Playgroud)
Ubuntu的:
vagrant@myubuntuvagrant:~$ ansible all -m setup -i "`hostname`," --connection=local -a "filter=ansible_distribution*"
myubuntuvagrant | SUCCESS => {
"ansible_facts": {
"ansible_distribution": "Ubuntu",
"ansible_distribution_major_version": "14",
"ansible_distribution_release": "trusty",
"ansible_distribution_version": "14.04"
},
"changed": false
}
vagrant@myubuntuvagrant:~$
Run Code Online (Sandbox Code Playgroud)
Amazon …
yum amazon-ec2 amazon-web-services ansible-2.x ansible-facts
我正在尝试查找 JSON 文件是否支持定义变量并在该 JSON 文件中使用它们?
{
"artifactory_repo": "toplevel_virtual_NonSnapshot",
"definedVariable1": "INSTANCE1",
"passedVariable2": "${passedFromOutside}",
"products": [
{ "name": "product_${definedVariable1}_common",
"version": "1.1.0"
},
{ "name": "product_{{passedVariable2}}_common",
"version": 1.5.1
}
]
}
Run Code Online (Sandbox Code Playgroud)
我知道 YAML 文件允许这种行为,但现在确定 JSON 文件是否允许这种行为。我的计划是用户将从 Jenkins 传递“defineVariable”值,我将创建一个目标 JSON 文件(在替换后)
我在构建文件夹下有以下文件夹结构(在Gradle构建期间可以获得):
CDROM/disk1 CDROM/disk1/disk1file1a.txt CDROM/disk1/disk1file1b.txt CDROM/disk2/disk2file2a.txt CDROM/disk2/disk2file2btxt CDROM/disk2/disk2folder2x CDROM/disk2/disk2folder2y CDROM/disk3 CDROM/disk3/disk3 CDROM/disk3/disk33 CDROM/disk3/disk33/disk3 CDROM/folder1 CDROM/file1.txt
我怎么能告诉Gradle告诉我以下内容:
仅打印文件夹"CDROM"中的顶级/直接子文件夹(仅限),
即它应仅打印disk1,disk2,disk3和folder1
仅打印具有磁盘模式[0-9]的顶级/直接子文件夹(仅),即diskX,其中X是数字.
即它应该只打印disk1,disk2和disk3
以下将会这样做,但我认为应该有一种有效的方法来实现相同的,并且可以定义模式,并且不必使用我在下面使用的"IF"语句.
FileTree dirs = fileTree (dir: "$buildDir/CDROM", include: "disk*/**")
dirs.visit { FileVisitDetails fd ->
if (fd.directory && fd.name.startsWith('disk')){
println "------ $buildDir/CDROM_Installers/${fd.name} ---------------"
}
}
Run Code Online (Sandbox Code Playgroud) 安塞布尔 1.9.2 / 1.9.4
CentOS 6.7
在我的库存文件中,我有:
[zabbix_server]
zabbix.dev-white.projectname.jenkins
[some_other_zabbix_server]
someotherzabbix.dev-blue.project.jenkins ansible_ssh_host=10.120.133.11
Run Code Online (Sandbox Code Playgroud)
当我跑步时:
ansible -m setup -i hosts zabbix.dev-white.projectname.jenkins
Run Code Online (Sandbox Code Playgroud)
它给了我以下错误:
zabbix.dev-white.projectname.jenkins | zabbix.dev-white.projectname.jenkins | zabbix.dev-white.projectname.jenkins FAILED => FAILED:没有可用的身份验证方法
在我的剧本中,我试图获取 zabbix 服务器的域值,即 dev-white.projectname.jenkins。我尝试了以下但用于显示域值的变量为空白/空,为什么?
注意: inventory_hostname 的值显示正确!但 ansible_domain /facter_domain 的域值作为空白/空值。
- debug: msg="My server is= {{ hostvars[groups['zabbix_server'][0]].inventory_hostname }} and domain is= {{ hostvars[groups['zabbix_server'][0]].ansible_domain }} --- {{ hostvars[groups['zabbix_server'][0]]['inventory_hostname'] }} -- {{ hostvars[groups['zabbix_server'][0]]['ansible_domain'] }} -- -- {{ hostvars[groups['zabbix_server'][0]]['facter_domain'] }}"
Run Code Online (Sandbox Code Playgroud)
尝试了 some_other_zabbix_server 组变量(其中设置了 ansible_ssh_host 变量)的上述代码,仍然没有值来显示其域。PS: ansible_ssh_host 属性将在较新的 Ansible 版本中被弃用。
詹金斯 1.6 - 2.x
我有一个每分钟或每 2 分钟运行一次的工作,有时构建失败并且下一个构建通过。对于构建失败,我在 Jenkins 中使用了可编辑电子邮件通知插件。
使用此插件或任何其他插件/方式,我可以以某种方式配置 Jenkins 作业以仅在最近 3 个连续构建失败时向我发送失败构建通知吗?看着这些构建失败然后在下一次运行中成功并不有趣,所以我试图减少此类失败通知的频率或使其更智能。
我在这里提到了对新功能请求的评论:https : //wiki.jenkins.io/display/JENKINS/Email-ext+Template+Plugin?focusedCommentId=132940540# comment- 132940540但看看是否有人尝试过/取得了一些成就相似的。
gradle ×3
ansible ×2
ansible-2.x ×2
jenkins ×2
amazon-ec2 ×1
checkstyle ×1
command-line ×1
depth ×1
directory ×1
domain-name ×1
findbugs ×1
groovy ×1
ignore ×1
integration ×1
jacoco ×1
java-opts ×1
json ×1
linux ×1
pmd ×1
roles ×1
sonarqube ×1
space ×1
structure ×1
testing ×1
unit-testing ×1
variables ×1
yaml ×1
yum ×1