Trigger a job for every Jenkins update automatically

2021-09-13 Thread touseef
I am trying to run a  job in Jenkins automatically every time my Jenkins 
restarts or update my Jenkins instance. Any insight of how to do would be 
appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8e0a8e20-ae8a-41be-b04f-014af6b27572n%40googlegroups.com.


Re: Non-lightweight git checkout of Jenkinsfile fails if node parameter is provided

2021-02-26 Thread touseef
not sure if it helps

There is a known issue with the integration of Jenkins and Bitbucket v7 
that if the PR is not having any changes to the Jenkinsfile, the Jenkins 
will fall back to heavyweight checkout.


On Wednesday, 24 February 2021 at 21:55:10 UTC+5:30 Martin Schmude wrote:

> Hello all,
> I am experiencing the following issue.
> I have a pipeline job (not multibranch). In the job configuration the 
> Jenkinsfile is checked out from git. The checkout is not lightweight (there 
> is a tick "Lightweight checkout", which is not set).
> A node job parameter is configured.
> When starting the job the git checkout of the Jenkinsfile fails with
>
> Caused by: hudson.plugins.git.GitException: Command "git fetch --tags 
> --progress -- https://gitlab.XXX.com/project.git 
>  
> +refs/heads/*:refs/remotes/origin/*" returned status code 128:
> ...
> fatal: could not read Username for 'https://gitlab.XXX.com 
> ': terminal prompts disabled
>
> Note that the Jenkinsfile has not started to be executed at that moment, 
> since Jenkins failed to check it out.
> The error does not occur if
>
>- if the selected node is master, or
>- if the "Lightweight checkout" is selected.
>
> It does also not occur if no node parameter is configured at all.
>
> Is this expected behaviour or an bug? Should I file a ticket in 
> https://issues.jenkins.io? I haven't found a ticket there that exactly 
> matches my issue.
> This 
> https://groups.google.com/g/jenkinsci-users/c/hg4OUmlS9T8/m/Lg8UYopCBAAJ
> looks related. But the root cause there was a file permissions issue, 
> which is surely not the case in my setup.
>
> My Jenkins instance is 2.222.4, running in a container derived from the 
> Jenkins base image jenkins/jenkins:2.222.4.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/00f008cb-097c-40f1-9970-4adef67125b7n%40googlegroups.com.


Using label field while declaring Kubernetes agent gives a deprecation warning even when using yaml format

2021-02-25 Thread touseef
 [WARNING] label option is deprecated. To use a static pod template, use 
the 'inheritFrom' option.
 Is there a workaround or different way to specify the agent labels

Below is the pipeline script 
```
pipeline { 
 agent {  
 kubernetes {
* label 'sample-label' *
* yaml** '''*
apiVersion: v1 
kind: Pod
spec: 
  containers:
- name: shell
  image: ubuntu 
  command: 
 - sleep 
   args: 
 - infinity
 ''' 
   } 
 } 
 stages { 
 stage('Main') {
 steps {
 sh 'hostname' 
 }
 }  } }

   



```

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/122a5dff-1402-4f93-8087-9d82300a7aa6n%40googlegroups.com.


Re: How to get container logs in kubernetes if user has no admin access to execute kubectl commands

2020-10-30 Thread touseef

The issue is  i run my application on kubernetes  infrastructure which is 
not mainatined by me.However in case of issue i want some logs to debug It 
would have been straight forward if i had an access to the cluster via 
kubectl commands but that not the case, i.e why i some how want to get the 
log of the containers in which my application run in case i need it to 
debug  

On Thursday, 29 October 2020 at 21:20:42 UTC+5:30 davidmic...@gmail.com 
wrote:

> In general, it would be pretty silly if anyone could get access to the 
> internals of a pod if they didn't have the proper authentication.
>
> Is your enterprise using Jenkins to build the applications that you deploy 
> to kubernetes?  Are those builds using kubectl to do those deployments?  If 
> you can see the command lines in the build output, you can see how 
> authentication is done. If that information is visible, then the enterprise 
> likely considers anyone who can see that information to be trusted to 
> access those pods for diagnostic information, so you should be able to do 
> the same thing.
>
> On Thursday, October 29, 2020 at 7:50:32 AM UTC-7 Kari Atari wrote:
>
>> Not sure if this would help, since I'm using Docker, not K8, but I bet 
>> there's a similar option - when I a start a container I use a -v flag to 
>> specify to copy the logs to the server it's running on.  This allows me to 
>> have a persistent log that won't just go away if I remove and restart the 
>> container.
>>
>> example:
>> -v /path/to/server/log/directory:/path/from/container/logs/directory
>>
>>
>> On Wed, Oct 28, 2020 at 11:43 PM touseef  wrote:
>>
>>> Can anyone provide pointer on  how do i get the logs of the containers 
>>> running in kubernetes without using Kubectl because i dont have an access 
>>> to the kubernetes cluster.
>>> Is there any loging mechanism by which i can get the logs or stdout in 
>>> the container to jenkins ? Help would be greatly appreciated.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to jenkinsci-use...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/3b38d046-c55e-4e55-b9c3-7bc1d333a821n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/3b38d046-c55e-4e55-b9c3-7bc1d333a821n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c2911e42-b06a-462c-98fc-60ed18dd31dan%40googlegroups.com.


Re: How to get container logs in kubernetes if user has no admin access to execute kubectl commands

2020-10-30 Thread touseef

The issue is  i run my application on kubernetes  infrastructure which is 
not mainatined by me.However in case of issue i want some logs to debug the 
issue.It would have been straight forward if i had an access to the cluster 
via kubectl commands but that not the case, thats why i some how want to 
get the log of the contianers in which my application run in case i need it 
to bebug
On Thursday, 29 October 2020 at 21:20:42 UTC+5:30 davidmic...@gmail.com 
wrote:

> In general, it would be pretty silly if anyone could get access to the 
> internals of a pod if they didn't have the proper authentication.
>
> Is your enterprise using Jenkins to build the applications that you deploy 
> to kubernetes?  Are those builds using kubectl to do those deployments?  If 
> you can see the command lines in the build output, you can see how 
> authentication is done. If that information is visible, then the enterprise 
> likely considers anyone who can see that information to be trusted to 
> access those pods for diagnostic information, so you should be able to do 
> the same thing.
>
> On Thursday, October 29, 2020 at 7:50:32 AM UTC-7 Kari Atari wrote:
>
>> Not sure if this would help, since I'm using Docker, not K8, but I bet 
>> there's a similar option - when I a start a container I use a -v flag to 
>> specify to copy the logs to the server it's running on.  This allows me to 
>> have a persistent log that won't just go away if I remove and restart the 
>> container.
>>
>> example:
>> -v /path/to/server/log/directory:/path/from/container/logs/directory
>>
>>
>> On Wed, Oct 28, 2020 at 11:43 PM touseef  wrote:
>>
>>> Can anyone provide pointer on  how do i get the logs of the containers 
>>> running in kubernetes without using Kubectl because i dont have an access 
>>> to the kubernetes cluster.
>>> Is there any loging mechanism by which i can get the logs or stdout in 
>>> the container to jenkins ? Help would be greatly appreciated.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to jenkinsci-use...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/3b38d046-c55e-4e55-b9c3-7bc1d333a821n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/3b38d046-c55e-4e55-b9c3-7bc1d333a821n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e0ad601f-b720-449b-b909-9b92b0fa9051n%40googlegroups.com.


How to get container logs in kubernetes if user has no admin access to execute kubectl commands

2020-10-28 Thread touseef
Can anyone provide pointer on  how do i get the logs of the containers 
running in kubernetes without using Kubectl because i dont have an access 
to the kubernetes cluster.
Is there any loging mechanism by which i can get the logs or stdout in the 
container to jenkins ? Help would be greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3b38d046-c55e-4e55-b9c3-7bc1d333a821n%40googlegroups.com.


How do i get logs of docker containers in Kubernetes running in jenkins?

2020-10-28 Thread touseef
Can anyone provide me point me,  on  how do i get the logs of the 
containers running in kubernetes without using Kubectl because i dont have 
an access to the kubernetes cluster.
Is there any loging mechanism by which i can get the logs or stdout in the 
container to jenkins ? Help would be greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/132bf806-e234-4f1f-9d6b-c952453dee0an%40googlegroups.com.


Is it possible to change the service IP range of an already initialized kubernetes cluster?

2020-06-22 Thread touseef
I want to change the CIDR of services ( replace the kubeadm ip alloc range) 
i.e cluster ip.I have the cluster already up and running.
Is it possible to switch teh cluster to different cluster ip rangfe without 
re initializing it from scratch?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/af522b6b-90c7-4fc7-9351-1bfa139c6596o%40googlegroups.com.


How to automate the versioning of images in jenkins pipeline using semantic versioning

2020-02-06 Thread touseef
I would like to have the deployed image and versions automatically 
managed.Help would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7df9c5f7-670f-4b06-9241-e118b8881fd4%40googlegroups.com.


hardware tests using jenkins pipeline without using typical labels for nodes

2020-02-03 Thread touseef
Can anyone help how Can i run the tests on actual hardware by making use of 
jenkins pipeline and docker.Traditionaly i am aware we can label the slaves 
connected to hardware and the tests will be executed accordingly.

Any help in of running the tests using docker and the pipeline will be 
appreciated/

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/297d081b-c003-4aaf-a807-7dc29f044b01%40googlegroups.com.


Re: Perform actual hardware tests using jenkins pipeline and kubernetes

2020-01-26 Thread touseef
Thanks for the reply .It would work fine if the master and the nodes are on 
the same cluster under the same network.
However my use case is my nodes can be in different network and it will not 
work with kubernetes.
is there any other way without using kubernets perhaps

On Monday, 20 January 2020 22:07:31 UTC+5:30, Andrey Babushkin wrote:
>
>
> Hi,
> As far as I understood you're using Jenkins Kubernetes plugin and you have 
> your own Kubernetes cluster with a few physical nodes connected to it.
> In that case you should label your Kubernetes nodes like this (assuming 
> you have working kubectl setup):
> kubectl label node node1.example.com hw_type=type1
>
> kubectl label node node2.example.com hw_type=type2
>
> Then you should specify label you need in podTemplate section of your 
> Jenkins pipeline (I slightly changed code from examples folder in 
> Kubernetes plugin repo - 
> https://github.com/jenkinsci/kubernetes-plugin/blob/master/examples/maven.groovy
> )
>
> podTemplate(nodeSelector: 'hw_type=type1', containers: [
> containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine',
>   ttyEnabled: true, command: 'cat',
>
> )
>   ]) {
>
>   node(POD_LABEL) {
> stage('Tests on hardware type 1') {
>   git 'https://github.com/jenkinsci/kubernetes-plugin.git'
>   container('maven') {
>   sh 'mvn -B clean package'
>   }
> }
>   }
> }
>
>
> On Monday, January 20, 2020 at 9:19:00 AM UTC+3, touseef wrote:
>>
>> Can anyone point me in right direction,
>>
>> I have a use case as follow:
>>
>> Kubernetes master running the jenkins and i have n number of physical 
>> machine connected with different hardwares,So what i want to achieve is 
>> when a specific job is triggered in jenkins to execute a test on hardware , 
>> k8's(kubernetes master) should route and connect to that machine in a pool 
>> which has requiste hardware and execute the tests.
>>
>> Any pointer how to achieve is appreciated
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/03ae521e-c73e-4761-8b7f-c682d1defddf%40googlegroups.com.


Perform actual hardware tests using jenkins pipeline and kubernetes

2020-01-19 Thread touseef
Can anyone point me in right direction,

I have a use case as follow:

Kubernetes master running the jenkins and i have n number of physical 
machine connected with different hardwares,So what i want to achieve is 
when a specific job is triggered in jenkins to execute a test on hardware , 
k8's(kubernetes master) should route and connect to that machine in a pool 
which has requiste hardware and execute the tests.

Any pointer how to achieve is appreciated

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/28cda197-21e5-4ad3-8b31-eebed9e42039%40googlegroups.com.


Re: Integrating jira issue creator in jenkins pipeline

2019-11-11 Thread touseef
Thanks Anish for the reply.

while runing the script provided ,i ended up in

Error when executing always post condition:
java.lang.NoSuchMethodError: No such DSL method 'jiraNewIssue' found among 
steps 

i am new bee.I tried debugging but could not trace back



pipeline {
 agent any
stages {
stage('build') {
steps {
echo "build steps"
}
}
stage('testing') {
steps {
echo "unit testing"
}
}
}


  post {
always {
echo 'I will always say Hello again!'
create_newjira_issue()
  script {
def mailRecipients = 'x...@gmail.com'
emailext body: '${SCRIPT, template="email.groovy"}',
mimeType: 'text/html',
subject: "[Jenkins] ",
to: "${mailRecipients}",
replyTo: "${mailRecipients}"

}

}
}
}
void create_newjira_issue() {
node {
  stage('JIRA') {
def NewJiraIssue = [fields: [project: [key: 'JIT'],
summary: 'Build Failed : Summary.',
description: 'Description of JIRA ticket ',
issuetype: [id: '3']]]

response = jiraNewIssue issue: NewJiraIssue, site: 'THAT CAN BE SET IN 
JENKINS CONFIGURATION OR CAN DIRECTLY WRITE HERE'

echo response.successful.toString()
echo response.data.toString()
}
  }
}


On Monday, 11 November 2019 21:27:33 UTC+5:30, Anish Choudhary wrote:
>
> Hi Touseef,
>
> As excepted JIRA issue can be created in pipeline projects, using 
> Jenkinsfile (assuming you are known of Jenkinsfile [pipeline steps written 
> in groovy language]). Anyway we can use the following syntax (code Snippet) 
> to implement it :
>
> //--
>
> pipeline { agent any
>
> stages {stage('build') {steps {echo 
> "build steps"}}
> stage('testing') {steps {echo "unit 
> testing"}}
> }
> } 
>
>  post {success {emailext (to: 
> 'bangar...@gmail.com ',mimeType: 'text/html',
> subject: "*** As excepted***",
> body: "** As excepted **")}   
>  failure {emailext (to: 'bangar...@gmail.com 
> ',mimeType: 'text/html',subject: 
> "*** As excepted***",body: 
> "** As excepted **")
> create_newjira_issue()}}
>
> void create_newjira_issue() {node {  stage('JIRA') {def 
> NewJiraIssue = [fields: [project: [key: 'PROJETC_NAME : can be taken from 
> JIRA website'],summary: 'Build Failed : Summary.',
> description: 'Description of JIRA ticket ',issuetype: [id: 
> 'PROJECT ID : can get using JIRA API']]]response = jiraNewIssue issue: 
> NewJiraIssue, site: 'THAT CAN BE SET IN JENKINS CONFIGURATION OR CAN DIRECTLY 
> WRITE HERE'echo response.successful.toString()echo 
> response.data.toString()}  }}
> //--
>
> Note : To get the JIRA fields you should have admin access of JIRA else get 
> above information from JIRA admin.
>
>
> Regards,
> Anish Choudhary
>
>
> On Mon, Nov 11, 2019 at 10:01 AM touseef  > wrote:
>
>> I want to Create Jira Issue on Build Failure through *Jenkins pipeline*.I 
>> am able to achive this help in freestyle projects.
>> Can anyone help me in integrating the create jira issue in jira 
>> automatically via pipeline syntax when jenkins build fails.
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkins...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/e3fbcd13-9e9d-4eab-b3b9-222e9864d6b6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/e3fbcd13-9e9d-4eab-b3b9-222e9864d6b6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/54397b05-f2b0-415a-8b02-34a996425c84%40googlegroups.com.


Integrating jira issue creator in jenkins pipeline

2019-11-10 Thread touseef
I want to Create Jira Issue on Build Failure through *Jenkins pipeline*.I 
am able to achive this help in freestyle projects.
Can anyone help me in integrating the create jira issue in jira 
automatically via pipeline syntax when jenkins build fails.



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e3fbcd13-9e9d-4eab-b3b9-222e9864d6b6%40googlegroups.com.


Re: How to pass a class instance in a jenkins pipeline script?

2019-04-09 Thread touseef


On Wednesday, 10 April 2019 09:44:31 UTC+5:30, touseef wrote:
>
> I have a pipeline  compliant test plugin.in a  @databoundConstructor i 
> have to pass an instance of another class *Input (*consisting of n number 
> of variables to be taken as input*)*
>
>
> @Symbol("forget")
> @Extension
> public class ForgetBuilder extends Builder implements SimpleBuildStep {
> private final String what;
> @CheckForNull
> public String stuff;
> public Boolean checkbox;
> public Input Input;
> @DataBoundConstructor
> public ForgetBuilder(String what,String stuff,boolean checkbox, *Input 
> Input*) {
> this.what = what;
> this.stuff=stuff;
> this.checkbox=checkbox;
> this.Input=Input;
> }
>
> public Input getInput() {
> return Input;
> }
>
> public Boolean getCheckbox() {
> return checkbox;
> }
>
> public String getWhat() {
> return what;
> }
> @Nonnull
> public String getStuff() {
> return stuff == null ? DescriptorImpl.defaultStuff : stuff;
> }
>
>
> @Override
> public void perform(Run build,
> FilePath workspace,
> Launcher launcher,
> TaskListener listener) throws 
> InterruptedException, IOException {
> listener.getLogger().println("What was " + what + "?");
> listener.getLogger().println("stuff was " + stuff + "?");
> listener.getLogger().println("checkbox was " + checkbox + "?");
>   
> 
> 
> }
> 
> I an able to write the pipeline script by which i can pass the arguments 
> like string ,boolean etc.But im not sure how to pass the instance of 
> another class in script
>
>
> //script works fine with primitive variable ,can any please help me in how 
> to pass the instance of another class after setting it variable to the 
> below script
> step([$class: 'ForgetBuilder', what: 'first string arg', stuff: 'Secong 
> string arg' ,checkbox:true])
>




*I figured it out.Posting the solution*


*step([$class: 'ForgetBuilder', what: 'first string arg', stuff: 
'Secong string arg' ,checkbox:true,Input: [$class: 
'Input',ideSelectionToUse:"value from instance class"]])  *

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e2426331-1417-41de-9720-b3290f6b19d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to pass a class instance in a jenkins pipeline script?

2019-04-09 Thread touseef
I have a pipeline  compliant test plugin.in a  @databoundConstructor i have 
to pass an instance of another class *Input (*consisting of n number of 
variables to be taken as input*)*


@Symbol("forget")
@Extension
public class ForgetBuilder extends Builder implements SimpleBuildStep {
private final String what;
@CheckForNull
public String stuff;
public Boolean checkbox;
public Input Input;
@DataBoundConstructor
public ForgetBuilder(String what,String stuff,boolean checkbox, *Input 
Input*) {
this.what = what;
this.stuff=stuff;
this.checkbox=checkbox;
this.Input=Input;
}

public Input getInput() {
return Input;
}

public Boolean getCheckbox() {
return checkbox;
}

public String getWhat() {
return what;
}
@Nonnull
public String getStuff() {
return stuff == null ? DescriptorImpl.defaultStuff : stuff;
}


@Override
public void perform(Run build,
FilePath workspace,
Launcher launcher,
TaskListener listener) throws InterruptedException, 
IOException {
listener.getLogger().println("What was " + what + "?");
listener.getLogger().println("stuff was " + stuff + "?");
listener.getLogger().println("checkbox was " + checkbox + "?");
  


}

I an able to write the pipeline script by which i can pass the arguments 
like string ,boolean etc.But im not sure how to pass the instance of 
another class in script


//script works fine with primitive variable ,can any please help me in how 
to pass the instance of another class after setting it variable to the 
below script
step([$class: 'ForgetBuilder', what: 'first string arg', stuff: 'Secong 
string arg' ,checkbox:true])

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/51788720-561e-4dfb-9ab8-1b95da35785d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Making the jenkins scm checkout smart

2018-10-29 Thread touseef
Hi ,

I have a source code repository having multiple branches say branch1, 
branch2 and so on.

Currently i have a jenkins jobs which builds the master or whatever i 
specify in job configuration.Now what i wish to achieve is if i commit my 
changes to branch 1 , my jenkins job should automatically context switch 
from master to branch1 and build that, and in the next step if i commit on 
branch2 it should  build branch 2.

i am able to make rest calls via DSL script to get the branch names and 
then use job dsl  to create  the jobs  as the number of branches are 
present.
However i don't want multiple jobs. What i am looking is having a single 
intelligent job to do the context switching between jobs.
 
Any idea or help will be appreciated.

Thanks,
Touseef

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3543d8da-3c80-4764-bc7c-092053f8c103%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


usage of log4j in jenkins plugin

2016-11-13 Thread touseef
i want to use the log 4j for logging in my jenkins plugins.However my 
plugin is unable to find the properties file even when i placeit in 
resource folder of plugin.
However when i do it using simple java program it creates log file as 
expected.

Following is the content of properties file

# Root logger option
log4j.rootLogger=INFO, file

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender



log4j.appender.file.File=C:\\logigng.log   
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} %-5p 
%c{1}:%L - %m%n

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fe7d306f-4c24-4349-8512-c87a5a2e2dce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Config.xml of the job gets lost/deleted randomnly on jenkins restart or saving the configuration after changing it

2016-10-26 Thread touseef yousuf
Even in some cases jenkins doesnot allow me to change the name of already
existing job?


On Thu, Oct 6, 2016 at 11:04 AM, touseef yousuf 
wrote:

> Im currently facing an issue where the config.xml of my created jobs gets
> deleted randomly on Jenkins restart and the job is no longer available on
> the view,even the job folder is present on file system *but without
> config.xml *.I have no idea what leads to this randomn disappearance of
> the config.xml file
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jenkinsci-users/Z4ZLIm1fK1k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/6205536d-53ad-4000-89c5-376c83f7e0c2%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/6205536d-53ad-4000-89c5-376c83f7e0c2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANsHL-XrxF8eBn5fb874%3DfjzaKzgrr27jUMMzrLdpRLUJivRVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Moving from http://localhost:port to https://localhost:port on windows

2016-10-24 Thread touseef
May I know, how to perform below task:

Step 4: Use the contents of the 'certreq.csr' file to generate a 
certificate from your certificate provider. Request a SHA-1 certificate 
(SHA-2 is untested but will likely work). If using DigiCert, download the 
resulting certificate as Other format  "a .p7b bundle of all the certs in a 
.p7b file"

[https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins]

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a1e82059-6ebb-43ae-99c5-aebab16247f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Moving jenkins from http to https on windows

2016-10-23 Thread touseef
May I know, how to perform below task:

Step 4: Use the contents of the 'certreq.csr' file to generate a 
certificate from your certificate provider. Request a SHA-1 certificate 
(SHA-2 is untested but will likely work). If using DigiCert, download the 
resulting certificate as Other format  "a .p7b bundle of all the certs in a 
.p7b file"

[https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins]

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/032e4e69-ff15-4e79-b671-20fe347c06eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Loosing All jobs after upgrade

2016-10-19 Thread touseef
In job folder ,are the config.xml files present? if so take a back of the 
config files first and then try to install the previous version of the 
jenkins you were using.

On Thursday, 20 October 2016 06:08:51 UTC+5:30, slide wrote:
>
> You probably want to look at the Jenkins logs and see why they are not 
> loading. There are probably some errors in there that would give you a clue 
> as to what the issue is.
>
> On Wed, Oct 19, 2016, 16:57 Azi > wrote:
>
>> Hi,
>>
>> We have lost all jobs created 3 years ago after upgrading to 2.19.1, 
>>
>> We have updated Jenkins one month ago to the latest version available at 
>> that time without any issue  ( not sure about the version number)  so we 
>> thought it should be fine to upgrade to 2.19.1 but we have lost all jobs. 
>>
>> I could see the job folders still exist but they are not listed in the 
>> Jenkins dashboard list.
>>
>> How can we get the jobs back? some of them are critical. please give us a 
>> solution.
>>
>> Thanks
>>
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/f1734b15-ed21-4670-a77e-360ef674ee2b%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/22ab9f30-edc7-4d36-ac05-2a8748853b83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Master Goes to 100% (at random?)

2016-10-19 Thread touseef
you can increase the heap size in the jenkins config.xml file, that will 
increase the availability of heap size for jenkins ,this might help u.Other 
thing is u can ugrade to 2.7.4 latest stable version of jenkins
 

On Tuesday, 18 October 2016 01:59:10 UTC+5:30, Eric Crahen wrote:
>
> Hi,
>
>   We're running Jenkins master with a bunch of slaves. Typical load on the 
> master is around 5-10% which is not very much. Several times now, we've 
> gotten into spikes where the CPU goes to 100% and stays there until we 
> restart it, and this usually only helps a little.
>
>   We dump the stack, and typically we find a whole bunch of threads 
> sitting there marshaling XML aggressively. Usually, we can connect this to 
> a plugin via the stack trace, and we'll uninstall that plugin, and that 
> tends to help. 
>
>   So far, the plugins I can remember include:
>
> * audit-trail
> * build-timer
> * log-parser
>
>   That's just the most recent ones that I can remember. We must be going 
> on the 5th or 6th plugin now. I'm afraid it's starting to shake peoples 
> confidence in Jenkins, I'd rather not have to replace it with a different 
> build system because it generally works, but when it doesn't - it's bad. We 
> actually keep a CircleCI system around because we haven't been able to 
> build enough confidence in Jenkins.
>
>   I have a couple general questions:
>
>   1) We're on Jenkins 2.18 - so, why does this keep happening? We've seen 
> other bugs about threads getting stuck hammering the CPU. Seems like the 
> issues were marked as resolved, but we end up having to uninstall these 
> plugins all together.
>
>   2) Is there a list of known "bad" plugins?
>
>   3) Why not cache more and guard against this? It's easy to blame the 
> plugins as the thing triggering this, but why not make Jenkins core more 
> resilient to this, and assume people can't/won't write perfect plugins? 
> Getting to be a fool me once type of situation here
>
>
> -- 
> - Eric
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/06b260e1-7a69-4fa7-b2b3-9b9b841622c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: gitlab-plugin causing freestyle job configuration to crash

2016-10-19 Thread touseef
Can u install the one version less than the current installed version of 
*GITLAB,*to check whether the problem still exists for u.

On Wednesday, 19 October 2016 15:17:53 UTC+5:30, Eddard wrote:
>
> -gitlab Version: 8.12
> -jenkins version: 2.16
> -gitlab-plugin version: 1.4.2
>
>
>
> Everytime we try to setup the triggers for the gitlabplugin (Build when a 
> change is pushed to GitLab.) on a freestyle job and save it, the 
> configuration fail with the following stack trace.
>
>
>
> javax.servlet.ServletException: java.lang.Error: Failed to instantiate class 
> com.dabsquared.gitlabjenkins.GitLabPushTrigger from 
> {"triggerOnPush":true,"triggerOnMergeRequest":true,"triggerOpenMergeRequestOnPush":"never","triggerOnNoteRequest":true,"noteRegex":"Jenkins
>  please retry a 
> build","ciSkip":true,"skipWorkInProgressMergeRequest":true,"setBuildDescription":true,"includeBranchesSpec":"","excludeBranchesSpec":"","targetBranchRegex":""}
>
>
> at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
>   at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
>   at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
>   at 
> org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
>   at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
>   at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
>   at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
>   at 
> org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
>   at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
>   at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
>   at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
>   at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
>   at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
>   at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
>   at 
> hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
>   at 
> com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47)
>   at 
> hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
>   at 
> hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)
>   at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>   at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
>   at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>   at 
> hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
>   at 
> hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
>   at 
> hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
>   at 
> jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
>   at 
> hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
>   at 
> org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
>   at 
> hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
>   at 
> org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
>   at 
> hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
>   at 
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
>   at 
> hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
>   at 
> jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
>   at 
> hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
>   at 
> org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
>   at 
> hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
>   at 
> hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
>   at 
> hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
>   at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
>   at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>   at 
> org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
>   at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>   at 
> hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
>   at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>  

Re: emailext jelly template access changetSet

2016-10-19 Thread touseef


May be this code might helped u as i had similar requirement but i implemented 
it in groovy script



<% changeSet = build.changeSet
if (changeSet != null) {
hadChanges = false %>
Changes

<% changeSet.each { cs ->
hadChanges = true
aUser = cs.author %>
Commit ${cs.revision} by <%= aUser != null ? aUser.displayName :  
it.author.displayName %>: (${cs.msg})

<% cs.affectedFiles.each { %>
${it.editType.name}: ${it.path}   
<%  } %> <%  }

 if (!hadChanges) { %>  
  No Changes !!
 <%  } %><% } %>


*And regarding the count u cant use this*

*def size= build.changeSet.items.length*


On Monday, 17 October 2016 20:36:33 UTC+5:30, jer...@bodycad.com wrote:
>
> Hi,
> I have use the Jelly template to re enable most of our email content, 
> except 2 things I still cannot do, the revision change set and the warnings 
> counts (the later is not too bad, we are moving to warnings as errors 
> anyway).
>
> Any body have a way to access the scm changeSet into the pipeline emailext 
> template?
>
> I tried without any luck:
>
>- ${build.changeSet}
>- ${build.changeSets}
>- ${currentBuild.changeSets}
>- ${manager.build.changeSets}
>- ${manager.build.changeSet}
>
> the console log are accessible with ${build.getLog()}
> the artifacts are with ${build.artifacts}
>
> The warning were:
> ${WARNINGS_RESULT()}
> ${WARNINGS_COUNT()}
> ${WARNINGS_NEW()}
> ${WARNINGS_FIXED()}
>
> but now if used they generate a jelly parsing error.
>
> if any body have any tips or info on this I would be glad,
> Thanks
> Jerome
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/565f9013-59e1-4cea-b75f-57c712b130d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing jenkins.model.Jenkins class from Custom Jars in Jenkins env.

2016-10-19 Thread touseef
import hudson.model.*

It worked fine for me in my groovy scripts and i was able to able use 
access jenkins classes.Can i know which version of jenkins are you using.As 
far i now in jewnkins 2.7.4 ,there are some security updates

On Tuesday, 18 October 2016 01:10:01 UTC+5:30, ZT wrote:
>
> Hello,
>
> I have written some custom groovy scripts (bundled as Jars) which need to 
> access the class jenkins.model.Jenkins
>
> I have my custom JARS installed into Jenkins and they are loaded properly 
> (verified through the Jenkins Script Console). However, When my script 
> imports jenkins.model.Jenkins, it fails with a NoClassDef error.
>
> I can see the jenkins core jar in /var/jenkins_home/war/WEB-INF/lib but 
> they do not seem to be visible to my scripts. 
>
> I am guessing this is either a classloader or a security restriction. 
>
> Any pointers to resolve this would be appreciated.
>
> Regards,
> Rahul
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8ca6f934-86a7-4b2b-90a6-ff666d6c5a5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


store jenkins configuration of jenkins in git via script

2016-10-18 Thread touseef
i want to schedule a task in windows task scheduler that will take the 
backup of job config.xml and store it in git repo..Any idea how to do it  

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2f470531-68ac-459d-ab25-4ef95656d66f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: moving jenkins_home

2016-10-06 Thread touseef
Install the Jenkins at the new place and just *copy the jobs folder *from 
previously installed jenkins folder to the new installation folder.This way 
u will retain all your previously created jobs.
The other thing you can  use is *Job Import plugin.*May be that will 
suffice your requirement.

On Friday, 7 October 2016 05:04:06 UTC+5:30, vishad alekh wrote:
>
> Hi all,
>
> I have installed Jenkins at /home/user path. My. Jenkins folder is also at 
> same path. Now because of space issue I need to move my setup at some other 
> location. 
> Can anyone please help on how to do the same. 
>
> Thanks in Advance 
>
>
> Thanks and Regards
> Vishad Alekh
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/12b4e132-0fe3-4643-bbd7-2f5cce86a6d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Config.xml of the job gets lost/deleted randomnly on jenkins restart or saving the configuration after changing it

2016-10-05 Thread touseef yousuf
Im currently facing an issue where the config.xml of my created jobs gets 
deleted randomly on Jenkins restart and the job is no longer available on 
the view,even the job folder is present on file system *but without 
config.xml *.I have no idea what leads to this randomn disappearance of the 
config.xml file

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6205536d-53ad-4000-89c5-376c83f7e0c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.