Not sure if this is really a bug or did I miss configured something, but it seems that via jcasc plugin it adds one extra slash on repository name after https://github.com/ like bellow:
My configuration is:
multibranchPipelineJob('Automation-CI') {
description('Job generated by DSL')
branchSources {
github {
id('Automation-CI')
scanCredentialsId('token')
repository('myproject/automation')
includes('*')
buildForkPRHead(false)
buildForkPRMerge(false)
buildOriginBranch(true)
buildOriginBranchWithPR(true)
buildOriginPRHead(true)
buildOriginPRMerge(true)
}
}
orphanedItemStrategy {
discardOldItems {
daysToKeep(5)
numToKeep(3)
}
}
}
My environment:
Jenkins version: 2.295
github-branch-source: 2.11.2
For the one that got the same error, to resolve it switch to:
repoOwner('myproject')
repository('automation')
Related
I'm trying to run some jmeter tests in my jenkinsfile pipeline, but I'm getting some errors.
A problem was found with the configuration of task ':jmReport' (type 'TaskJMReports').
- In plugin 'net.foragerr.jmeter' type 'net.foragerr.jmeter.gradle.plugins.TaskJMReports' property 'reportDir' is missing an input or output annotation.
This is how I'm trying to run it.
build.gradle
plugins {
id "net.foragerr.jmeter" version "1.0.5-2.13"
}
apply plugin: 'net.foragerr.jmeter'
jmeter {
jmTestFiles = [file("src/test/jmeter/TestPlan.jmx")]
enableExtendedReports = true //produce Graphical and CSV reports
}
Pipeline
stage('Run Non-Functional tests - Windows'){
when { expression { env.OS == 'BAT' }}
steps {
dir('') {
bat 'gradlew.bat jmReport'
}
}
}
I'm also tried this away.
build.gradle
plugins {
id "de.qualersoft.jmeter" version "2.1.0"
}
tasks.register('jmRun',JMeterRunTask) {
jmxFile.set("TestPlan.jmx")
}
tasks.register("jmReport",JMeterReportTask) {
jmxFile.set("TestPlan.jmx")
dependsOn("jmRun")
deleteResults=true
}
The stage is the same and I'm getting this error.
> Could not get unknown property 'JMeterRunTask' for root project 'flowcrmtutorial' of type org.gradle.api.Project.
Why am I getting this errors?
For the latter, you are missing the import as stated in the project's README:
https://github.com/qualersoft/jmeter-gradle-plugin#user-content-running-a-jmeter-test
Import task package.
import de.qualersoft.jmeter.gradleplugin.task.*
plugins {
id "de.qualersoft.jmeter" version "2.1.0"
}
I've got a multibranch pipeline, defined in a scripted pipeline (from a library) that is coordinating ~100 builds, each build across multiple slaves (different operating systems). One of the Operating systems is Windows, which has a 255 character path limitation. Because some of our jobs have ~200 character paths in them (which we can't control because it is a vendor provided hell), i need to change the step/node workspace on our windows slaves, ideally changing it with the node() step, so that git is automatically checked out only once into the custom workspace.
I've tried all kinds of various styles:
This works in the Declarative Pipeline:
stage('blah') {
node {
label 'win'
customWorkspace "c:\\w\\${JOB_NAME"
}
steps {
...
}
}
But i can't find the equivalent for scripted pipelines:
pipeline {
stage('stage1') {
node('win-node') {
// the git repository is checked out to ${env.WORKSPACE}, but it's unusable due to the path length issue
ws("c:\\w\\${JOB_NAME}") {
// this switches the workspace, but doesn't clone the git repo again
body()
}
}
}
}
Ideally, i'd like something like this:
pipeline {
stage('stage1') {
node('win-node', ws="c:\\w\\${JOB_NAME}") {
body()
}
}
}
Any recommendations?
Not tested (specially define options inside node), but you could try to skip default checkout and do it after changing the workspace, something like this:
pipeline {
stage('stage1') {
node('win-node') {
options {
skipDefaultCheckout true // prevent checkout to default workspace
}
ws("c:\\w\\${JOB_NAME}") {
checkout scm // perform default checkout here
body()
}
}
}
}
I am trying to create pipeline jobs with jenkins dsl. the pipeline job takes the cpsscm if I specify the git url only without branches or credentials. but when I change the brancha nd add credentials, it doesn;t work
pipelineJob("foo"){
definition {
cpsSCM {
git(GIT_URL,BRANCH)
}
}
}
The above works. but the following doesn't work
pipelineJob("foobar"){
definition {
cpsScm {
scm{
git{
branch(BRANCH)
remote{
credentials('kjsks2304-sid34-234')
url(GIT_URL)
}
}
}
scriptPath("JenkinsFile")
}
}
}
}
the credentials is the id in the credentials plugin in jenkins. The git repo I am using is a private bitbucket repository
Try here this might help you achieve it, you can use the playground.
https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.workflow.WorkflowDefinitionContext.cpsScm
Grails console plugin page is not coming up nothing gets rendered on the UI only when application is run on production environment either via run-app or as a war file deployed on embedded tomcat.
Grails version - 3.2.4
build.gradle looks like this:
buildscript {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
....
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.13.1"
...
}
}
version "0.1"
apply plugin: "asset-pipeline"
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "http://repo1.maven.org/maven2" }
}
dependencies {
....
runtime 'org.grails.plugins:grails-console:2.0.9'
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.13.1"
....
}
Any thoughts whats going wrong here?
By default the plugin is disabled in production for obvious reasons (an attacker could do anything to your app) - but if you understand the risk and secure it you can re-enable it. Checkout the documentation here https://github.com/sheehan/grails-console#security
I am reading this:
http://www.gradle.org/docs/current/userguide/artifact_management.html
to understand how to publish/upload my artifact to a network drive/fileshare which is a requirement (we have a maven repo up and running but some artifacts needs to be dumped on a fileshare). The examples I have found are more focused on deploying to repositories, maven, ivy, etc.
I have a simple eclipse java project that I build using gradle 1.2 with the following build.gradle file:
apply plugin: 'java'
sourceSets {
main {
java {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
}
}
}
repositories {
flatDir {
name "fileRepo"
dirs "file://internal.newtwork.drive/folder/test"
}
}
uploadArchives {
repositories {
add project.repositories.fileRepo
}
}
Where in the gradle docs can I read about how to copy resources to a remote fileshare?
I have tried to update the protocol and the dir attribute based on the below answers but I get this error:
What went wrong:
Execution failed for task ':uploadArchives'.
Could not publish configuration ':archives'.
java.io.FileNotFoundException: /internal.newtwork.drive/folder/test/sample-gradle-java-unspecified.jar (No such file or directory)
The destination is correct so does the flatDir repo not support networkdrives?
You should define the following parameters:
archivesBaseName = 'yourappname'
group = 'your.app.package'
version = '1.0.0'
Your URL doesn't mention a scheme (http:, file:, etc.). I don't know if you can get away with using a file: URL, or whether you need to us a different syntax to specify a directory rather than an HTTP URL, but either way, you'll need to correctly form the URI for the Windows UNC path.
See this question for more details.
It looks like you're crossing your wires. The url would only be part of that ivy repository declaration which you're apparently not using. The filesystem repository would be handled by the flatDir block which is then referenced by the add project.repositories.fileRepo statement. I'd suggest trying the full path in the flatDir dir variable, otherwise the path of least resistance may just be to throw together a simple manual file copy (or other transfer) task which is then added on to the main deploy task you're using.
//Try this,
apply plugin: 'java'
apply plugin: 'maven'
repositories {
maven {
url "$archivaUrl"`enter code here`
credentials {
username = "$userName"
password = "$passWord"
}
}
}
// Dependencies
dependencies {
// specify the lib files at compile and run time
compile fileTree(dir: 'lib', include: ['**/*.jar','*.jar'])
runtime fileTree(dir: 'lib', include: ['**/*.jar','*.jar'])
}
// source path
sourceSets {
main {
java {
srcDirs 'src'
}
}
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "$archivaUrl") {
authentication(userName: "$userName", password: "$passWord")
}
pom.version = "1.0-SNAPSHOT"
pom.artifactId = "fd-common"
pom.groupId = "com.somename.common"
}
}
}