我的代码中包含以下代码 build.gradle
内容version.properties是:
buildVersion=1.2.3
Run Code Online (Sandbox Code Playgroud)
$vGradle构建期间变量的值如下:1.2.3$artifactoryVersionJENKINS构建中变量的值如下:1.2.3.1,1.2.3.2,1.2.3.x ...等等,在Jenkins构建期间,第四位数字是Jenkins BUILD_NUMBER可用于gradle构建脚本.但是,当我build.gradle在我的桌面上运行这个,我没有可用的BUILD_NUMBER变量或在我的环境变量中设置时,我收到一个错误,说trim()无法在null上工作.(因为BUILD_NUMBER桌面/本地版本没有).
我正试图找到一种方式即
我应该在我的脚本中编写什么代码,以便如果BUILD_NUMBER不可用,那么代替gradle构建处理失败的错误,它设置jenkinsBuild = "0"(硬编码)否则,选择它在Jenkins构建期间获得的内容.
例如:在Bash中,我们设置一个变量var1=${BUILD_NUMBER:-"0"},var1如果它可用并设置为一个值,它将设置为有效的Jenkins BUILD编号,否则如果它为NULL,则为var1 = "0".
我不想让每个开发人员/用户BUILD_NUMBER在一些属性文件中设置它.我想要的是,如果这个变量不存在,那么代码应该放在"0"jenkinsBuilds变量中,并且在桌面构建期间不会出错.我知道在Jenkins构建期间,它工作正常.
// Build Script
def fname = new File( 'version.properties' )
Properties props = new Properties()
props.load( new FileInputStream( fname ) )
def v = props.get( 'buildVersion' )
def env = System.getenv()
def jenkinsBuild …Run Code Online (Sandbox Code Playgroud) 我如何每分钟运行一次在詹金斯创建的工作?我错过了什么吗?
PS:我试图不使用:*/1****

在Ansible(1.9.4)或2.0.0中
我运行了以下操作:
- debug: msg="line1 \n {{ var2 }} \n line3 with var3 = {{ var3 }}"
Run Code Online (Sandbox Code Playgroud)
$ cat roles/setup_jenkins_slave/tasks/main.yml
- debug: msg="Installing swarm slave = {{ slave_name }} at {{ slaves_dir }}/{{ slave_name }}"
tags:
- koba
- debug: msg="1 == Slave properties = fsroot[ {{ slave_fsroot }} ], master[ {{ slave_master }} ], connectingToMasterAs[ {{ slave_user }} ], description[ {{ slave_desc }} ], No.Of.Executors[ {{ slave_execs }} ], LABELs[ {{ slave_labels }} ], mode[ {{ slave_mode }} ]" …Run Code Online (Sandbox Code Playgroud) 我正在运行Ansible playbook,它在一台机器上工作正常.
在我第一次尝试的新机器上,我收到以下错误.
17:04:34 PLAY [appservers] *************************************************************
17:04:34
17:04:34 GATHERING FACTS ***************************************************************
17:04:34 fatal: [server02.cit.product-ref.dev] => {'msg': "FAILED: (22, 'Invalid argument')", 'failed': True}
17:04:34 fatal: [server01.cit.product-ref.dev] => {'msg': "FAILED: (22, 'Invalid argument')", 'failed': True}
17:04:34
17:04:34 TASK: [common | remove old ansible-tmp-*] *************************************
17:04:34 FATAL: no hosts matched or all hosts have already failed -- aborting
17:04:34
17:04:34
17:04:34 PLAY RECAP ********************************************************************
17:04:34 to retry, use: --limit @/var/lib/jenkins/site.retry
17:04:34
17:04:34 server01.cit.product-ref.dev : ok=0 changed=0 unreachable=1 failed=0
17:04:34 server02.cit.product-ref.dev : ok=0 …Run Code Online (Sandbox Code Playgroud) 机器:Window10(64位).
我下载了最新的VirtualBox,Vagrant和初始化的CentOS 6.7 64位图像/网址.
以下在Git-Bash会话中成功运行.
1. vagrant box添加"centos67x64"" https://github.com/CommanderK5/packer-centos-template/releases/download/0.6.7/vagrant-centos-6.7.box "
2. vagrant init
3.更新了Vagrantfile(并转为vb.gui选项,即取消注释文件中的配置部分).
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
Run Code Online (Sandbox Code Playgroud)
之后,我尝试了以下命令,但我收到此错误消息.
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos67x64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vv_default_1466548735200_80300
==> default: Clearing …Run Code Online (Sandbox Code Playgroud) 我要求将我的selenium测试的代码覆盖率捕获到所涵盖的服务器代码(Web应用程序源代码)中的源代码量.
例如,登录功能的测试应该捕获登录功能的Web应用程序中涵盖的代码量.
否则,需要知道它已在Web应用程序代码中触及哪个包或类,以完成所使用的方案.例如登录
我找不到合适的解决方案,虽然我开始了解Jacoco代码覆盖工具并尝试使用Jacoco Jenkins插件的一些示例,但没有成功.
我不知道可能性.请提供给我一个如何实现这一点的建议,在此先感谢
为什么python在安装pip或pip3显示它时没有找到boto3 .
我在Mac机器上.尝试/不使用pip/pip3 sudo.尝试更改PATH变量以及几条路径,但没有运气.
路径:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/arun/.sdkman/candidates/gradle/current/bin:/Users/arun/aks/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
和
$ python -c 'import sys; print sys.path'|tr ',' '\012'
[''
'/Library/Python/2.7/site-packages/RBTools-0.5.7-py2.7.egg'
'/Library/Python/2.7/site-packages/wfawsclitools-0.1-py2.7.egg'
'/Library/Python/2.7/site-packages/PyYAML-3.12-py2.7-macosx-10.12-intel.egg'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old'
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload'
'/Library/Python/2.7/site-packages'
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python'
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']
Run Code Online (Sandbox Code Playgroud)
和
$ python -m site
sys.path = [
'/Users/arun/ubuntu-vagrant-box',
'/Library/Python/2.7/site-packages/RBTools-0.5.7-py2.7.egg',
'/Library/Python/2.7/site-packages/wfawsclitools-0.1-py2.7.egg',
'/Library/Python/2.7/site-packages/PyYAML-3.12-py2.7-macosx-10.12-intel.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/Library/Python/2.7/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
]
USER_BASE: '/Users/arun/Library/Python/2.7' (doesn't exist)
USER_SITE: '/Users/arun/Library/Python/2.7/lib/python/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
Run Code Online (Sandbox Code Playgroud)
到目前为止我跑的步骤:
[arun@ip-10.11.33-65 ~/aks] $ …Run Code Online (Sandbox Code Playgroud) Maven是3.1.0.
我在我的项目的pom.xml中使用了versions-maven-plugin:2.2(如下所示).除了通常的pom.xml文件配置外,我只是在下面显示主代码快照:
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>tools-parent</artifactId>
<version>0.0.7-SNAPSHOT</version>
<packaging>pom</packaging>
<description>
Infrastructure related to the "vapp" and
"deployer" utilities.
</description>
<parent>
<groupId>com.company.product</groupId>
<artifactId>deploy-parent</artifactId>
<version>0.0.6-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9.4</version>
<configuration>
<connectionType>connection</connectionType>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<!-- Make sure that only non-snapshot versions are used for the dependencies. Only active when property 'snapshotDependencyAllowed' is false. -->
<id>enforce-no-snapshots</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<skip>${snapshotDependencyAllowed}</skip>
<rules>
<requireReleaseDeps>
<message>No Snapshots Allowed!</message>
</requireReleaseDeps>
<requireReleaseVersion> …Run Code Online (Sandbox Code Playgroud) release nullpointerexception maven maven-release-plugin versions-maven-plugin
目录结构:
PROJECT1/ABC/FILE1.TXT
我想将上面的ABC文件夹移动/重命名为XYZ(不留ABC).
我怎么能用Gradle做到这一点.似乎在Gradle中:对于一个右手的人来说,用左手搔痒你的右耳,将它从头顶掠过.
我使用了以下示例:但它没有做任何事情:
task renABCToXYZ(type: Copy) << {
copy {
from "Project1"
into "Project1"
include 'ABC'
rename ('ABC', 'XYZ')
}
}
Run Code Online (Sandbox Code Playgroud) Ansible 1.9.2版本.
Ansible在评估变量时是否支持变量内的变量扩展.
我有一个任务是从Artifactory下载3个zip文件.
我没有在角色中编写3个单独的任务,而是在剧本中使用了ansible的循环.在Ansible角色的默认值/ main.yml中,我具有角色定义/可用的所有必需变量,即jtpplugins_extras_artifactory_url和其他(标准/ webdriver)对perf_tests角色可见.
---
#- Download and install JMeterPlugins
# Use get_url when Ansible is 2.0+ is available on the machine (otherwise, we can't use get_url) thus, using wget.
- name: Download JMeterPlugins-*
command: wget {{ jmeterplugins_{{ item.plugin }}_artifactory_url }}
chdir="{{ common_download_dir }}"
creates="{{ common_download_dir }}/{{ jmeterplugins_{{ item.plugin }}_file }}"
with_items:
- { plugin: 'extras' }
- { plugin: 'standard' }
- { plugin: 'webdriver' }
Run Code Online (Sandbox Code Playgroud)
但是使用上面的代码,我收到一个错误(如下所示):
15:58:57 TASK: [perf_tests | Download JMeterPlugins-*] ********************************* …Run Code Online (Sandbox Code Playgroud) ansible ×3
gradle ×2
variables ×2
action ×1
boto3 ×1
build ×1
cron ×1
directory ×1
file ×1
headless ×1
hosts-file ×1
jacoco ×1
java ×1
javascript ×1
jenkins ×1
jinja2 ×1
macos ×1
maven ×1
move ×1
newline ×1
null ×1
pip ×1
python ×1
release ×1
rename ×1
roles ×1
selenium ×1
ssh ×1
vagrant ×1
vagrantfile ×1
virtualbox ×1
windows-10 ×1