Re: How to add parameters to existing parameters list?

2020-08-04 Thread Stuart Rowe
You can configure the parameters for the current job (in a Scripted 
Pipeline) with:

def parameterList = [stringParam(name: 'Test', value: 'TestValue')]
properties(parameters(parameterList)

This will replace all parameters of your job with the contents of 
parameterList.


On Monday, 3 August 2020 23:03:39 UTC-7, Gajanan Mahajan wrote:
>
> I get all parameters of a build using -
>
> def myparams = 
> currentBuild.rawBuild.getAction(ParametersAction).getParameters()
>
> `myparams` is object of 
> `java.util.Collections$UnmodifiableRandomAccessList` hence if try  to add 
> another parameter to it like  -
>
> myparams.add([$class: 'StringParameterValue', name: 'Test', value: 
> "TestValue"])
>
> then it fails with error - 
>
> java.lang.UnsupportedOperationException
>
> Please guide how to add parameter to existing parameters.
>

-- 
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/723fed16-1561-4e23-b925-f3e01778f8bdo%40googlegroups.com.


Re: How to get owner of upstream build in downstream build without using parameter?

2020-08-04 Thread Krish S
You could try this :

def owner = currentBuild.getBuildCauses(‘hudson.model.Cause$UserIDCause’)
manager.addShortText(“${Approval.userId[0]} ${Approval.userName}”)


Thanks,

On Tue, Aug 4, 2020 at 2:04 AM Gajanan Mahajan 
wrote:

> I have upstream and downstream pipelines and in downstream pipeline, I
> want to store user, who started upstream build, in downstream build
> variable.
>
> I used following in downstream pipeline but it results into error -
> `java.lang.NullPointerException: Cannot invoke method getUserId() on null
> object`
>
> Owner = currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId()
>
> One way is to store it in a variable in upstream pipeline and pass it as
> param to downstream pipeline but that is additional handling and
> considering my parameters list, it is little tricky.
>
> Is there any way I can get user who started upstream build in downstream
> build without passing parameter?
>
> Similarly, `JOB_NAME` and `BUILD_NUMBER` of upstream to downstream.
>
> --
> 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/f4704e0d-5958-4075-bd00-e5666f2a127fo%40googlegroups.com
> 
> .
>

-- 
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/CAPhsgOZzs_Yp2a3eHwQDmrySt9n7JqPoURJX_L3Fm2Zezsm9%3DQ%40mail.gmail.com.


Re: Help required: jenkins SSH connectivity issue

2020-08-04 Thread jeremy mordkoff
You should start a new thread 

I cannot tell what is happening from this. You should also post the code 


On Tuesday, August 4, 2020 at 11:03:28 AM UTC-4, Sakshi Rathore wrote:
>
> yes thanks, it worked but after successful installation and execution of 
> script  i am getting status as Build failure: Could you please advise here.
>
> Below are the logs:
>
> Started by user Sakshi Rathore 
> Running as SYSTEM
> Building in workspace /var/lib/jenkins/workspace/test9
> No credentials specified
> Cloning the remote Git repository
> Cloning repository https://github.com/sakshirathorebgw/GitHubProjeckt.git
>  > git init /var/lib/jenkins/workspace/test9 # timeout=10
> Fetching upstream changes from 
> https://github.com/sakshirathorebgw/GitHubProjeckt.git
>  > git --version # timeout=10
>  > git fetch --tags --progress -- 
> https://github.com/sakshirathorebgw/GitHubProjeckt.git 
> +refs/heads/*:refs/remotes/origin/* # timeout=10
>  > git config remote.origin.url 
> https://github.com/sakshirathorebgw/GitHubProjeckt.git # timeout=10
>  > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # 
> timeout=10
>  > git config remote.origin.url 
> https://github.com/sakshirathorebgw/GitHubProjeckt.git # timeout=10
> Fetching upstream changes from 
> https://github.com/sakshirathorebgw/GitHubProjeckt.git
>  > git fetch --tags --progress -- 
> https://github.com/sakshirathorebgw/GitHubProjeckt.git 
> +refs/heads/*:refs/remotes/origin/* # timeout=10
>  > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
>  > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
> Checking out Revision 5dd43192426415f540b687697f6ef436acf60600 
> (refs/remotes/origin/master)
>  > git config core.sparsecheckout # timeout=10
>  > git checkout -f 5dd43192426415f540b687697f6ef436acf60600 # timeout=10
> Commit message: "added from server"
> First time build. Skipping changelog.
> [test9] $ /bin/sh -xe /tmp/jenkins4883353382832852402.sh
> + ./piecebypiece.sh
> ./test2-harbor.pfx is certpath
> test2-harbor is basename
> test2-harbor is new secret name for harbor
> this is password  start01
> ./test2-harbor.key key file generated
> ./test2-harbor.crt crt file generated
> key filename is test2-harbor.key
> crt filename is test2-harbor.crt
> address for certificate is : test2-harbor.tank.local
> core: core.harbor.domain
> core: test2-harbor.tank.local
> notary: notary.harbor.domain
> notary: test2-harbor.tank.local
> secretName:
> secretName: test2-harbor
> check1
> /home/ccpuser
> harbortest-master-gro-a7c3cedfab
> ccp_kibana_ingress_setup.sh
> cert_status1.sh
> check.sh
> docker
> harbor
> harbor_bkp
> jenkins-cli.jar
> jenkins-namespace.yaml
> jenkins-volume.yaml
> kibana_ingress.yaml
> new_server_cert.sh
> newharbortestkey
> old_server.sh
> piecebypiece.sh
> test2-harbor.crt
> test2-harbor.key
> test2-harbor.pfx
> test2-harbor123.crt
> test2-harbor123.key
> test2-harbor123.pfx
> test2-harbor12345.crt
> test2-harbor12345.key
> test2-harbor12345.pfx
> test2-harbor54321.crt
> test2-harbor54321.key
> test2-harbor54321.pfx
> value.yaml
> value1.yaml
> further run
> execute check.sh now
> namespace is harbor
>  harbor is NOT NULL
> ./test2-harbor54321.crt
> test2-harbor54321.crt
>  
> The certificate of
>
> expires on
>Thu Jun  3 07:54:16 UTC 2021
> which is in 302 days from now!
>  
> WARNING - Expiration date is near!
>  
> edit properties file and run the job to install the new cert
> mv: cannot move 'harbor' to 'harbor_bkp/harbor': Directory not empty
> namespace "harbor" deleted
>
> "harbor" has been added to your repositories
> total 232
> drwxr-xr-x 15 ccpuser ccpadmin  4096 Jul 30 11:00 templates
> drwxr-xr-x  2 ccpuser ccpadmin  4096 Jul 30 11:00 conf
> drwxr-xr-x  2 ccpuser ccpadmin  4096 Jul 30 11:00 cert
> -rw-r--r--  1 ccpuser ccpadmin 24523 Aug  4 14:58 values.yaml
> -rw-r--r--  1 ccpuser ccpadmin   561 Aug  4 14:58 Chart.yaml
> -rw-r--r--  1 ccpuser ccpadmin 83889 Aug  4 14:58 README.md
> -rw-r--r--  1 ccpuser ccpadmin 11357 Aug  4 14:58 LICENSE
> -rw-r--r--  1 ccpuser ccpadmin  5418 Aug  4 14:58 test2-harbor54321.pfx
> -rw-r--r--  1 ccpuser ccpadmin  7382 Aug  4 14:58 test2-harbor54321.key
> -rw-r--r--  1 ccpuser ccpadmin  5465 Aug  4 14:58 test2-harbor54321.crt
> -rw-r--r--  1 ccpuser ccpadmin  5418 Aug  4 14:58 test2-harbor12345.pfx
> -rw-r--r--  1 ccpuser ccpadmin  7382 Aug  4 14:58 test2-harbor12345.key
> -rw-r--r--  1 ccpuser ccpadmin  5465 Aug  4 14:58 test2-harbor12345.crt
> -rw-r--r--  1 ccpuser ccpadmin  5418 Aug  4 14:58 test2-harbor123.pfx
> -rw-r--r--  1 ccpuser ccpadmin  7382 Aug  4 14:58 test2-harbor123.key
> -rw-r--r--  1 ccpuser ccpadmin  5465 Aug  4 14:58 test2-harbor123.crt
> -rw-r--r--  1 ccpuser ccpadmin  5418 Aug  4 14:58 test2-harbor.pfx
> -rw-r--r--  1 ccpuser ccpadmin  7382 Aug  4 14:58 test2-harbor.key
> -rw-r--r--  1 ccpuser ccpadmin  5465 Aug  4 14:58 test2-harbor.crt
> namespace/harbor created
> 

Re: Help required: jenkins SSH connectivity issue

2020-08-04 Thread Sakshi Rathore
yes thanks, it worked but after successful installation and execution of
script  i am getting status as Build failure: Could you please advise here.

Below are the logs:

Started by user Sakshi Rathore 
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/test9
No credentials specified
Cloning the remote Git repository
Cloning repository https://github.com/sakshirathorebgw/GitHubProjeckt.git
 > git init /var/lib/jenkins/workspace/test9 # timeout=10
Fetching upstream changes from
https://github.com/sakshirathorebgw/GitHubProjeckt.git
 > git --version # timeout=10
 > git fetch --tags --progress --
https://github.com/sakshirathorebgw/GitHubProjeckt.git
+refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url
https://github.com/sakshirathorebgw/GitHubProjeckt.git # timeout=10
 > git config --add remote.origin.fetch
+refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url
https://github.com/sakshirathorebgw/GitHubProjeckt.git # timeout=10
Fetching upstream changes from
https://github.com/sakshirathorebgw/GitHubProjeckt.git
 > git fetch --tags --progress --
https://github.com/sakshirathorebgw/GitHubProjeckt.git
+refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 5dd43192426415f540b687697f6ef436acf60600
(refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 5dd43192426415f540b687697f6ef436acf60600 # timeout=10
Commit message: "added from server"
First time build. Skipping changelog.
[test9] $ /bin/sh -xe /tmp/jenkins4883353382832852402.sh
+ ./piecebypiece.sh
./test2-harbor.pfx is certpath
test2-harbor is basename
test2-harbor is new secret name for harbor
this is password  start01
./test2-harbor.key key file generated
./test2-harbor.crt crt file generated
key filename is test2-harbor.key
crt filename is test2-harbor.crt
address for certificate is : test2-harbor.tank.local
core: core.harbor.domain
core: test2-harbor.tank.local
notary: notary.harbor.domain
notary: test2-harbor.tank.local
secretName:
secretName: test2-harbor
check1
/home/ccpuser
harbortest-master-gro-a7c3cedfab
ccp_kibana_ingress_setup.sh
cert_status1.sh
check.sh
docker
harbor
harbor_bkp
jenkins-cli.jar
jenkins-namespace.yaml
jenkins-volume.yaml
kibana_ingress.yaml
new_server_cert.sh
newharbortestkey
old_server.sh
piecebypiece.sh
test2-harbor.crt
test2-harbor.key
test2-harbor.pfx
test2-harbor123.crt
test2-harbor123.key
test2-harbor123.pfx
test2-harbor12345.crt
test2-harbor12345.key
test2-harbor12345.pfx
test2-harbor54321.crt
test2-harbor54321.key
test2-harbor54321.pfx
value.yaml
value1.yaml
further run
execute check.sh now
namespace is harbor
 harbor is NOT NULL
./test2-harbor54321.crt
test2-harbor54321.crt

The certificate of

expires on
   Thu Jun  3 07:54:16 UTC 2021
which is in 302 days from now!

WARNING - Expiration date is near!

edit properties file and run the job to install the new cert
mv: cannot move 'harbor' to 'harbor_bkp/harbor': Directory not empty
namespace "harbor" deleted

"harbor" has been added to your repositories
total 232
drwxr-xr-x 15 ccpuser ccpadmin  4096 Jul 30 11:00 templates
drwxr-xr-x  2 ccpuser ccpadmin  4096 Jul 30 11:00 conf
drwxr-xr-x  2 ccpuser ccpadmin  4096 Jul 30 11:00 cert
-rw-r--r--  1 ccpuser ccpadmin 24523 Aug  4 14:58 values.yaml
-rw-r--r--  1 ccpuser ccpadmin   561 Aug  4 14:58 Chart.yaml
-rw-r--r--  1 ccpuser ccpadmin 83889 Aug  4 14:58 README.md
-rw-r--r--  1 ccpuser ccpadmin 11357 Aug  4 14:58 LICENSE
-rw-r--r--  1 ccpuser ccpadmin  5418 Aug  4 14:58 test2-harbor54321.pfx
-rw-r--r--  1 ccpuser ccpadmin  7382 Aug  4 14:58 test2-harbor54321.key
-rw-r--r--  1 ccpuser ccpadmin  5465 Aug  4 14:58 test2-harbor54321.crt
-rw-r--r--  1 ccpuser ccpadmin  5418 Aug  4 14:58 test2-harbor12345.pfx
-rw-r--r--  1 ccpuser ccpadmin  7382 Aug  4 14:58 test2-harbor12345.key
-rw-r--r--  1 ccpuser ccpadmin  5465 Aug  4 14:58 test2-harbor12345.crt
-rw-r--r--  1 ccpuser ccpadmin  5418 Aug  4 14:58 test2-harbor123.pfx
-rw-r--r--  1 ccpuser ccpadmin  7382 Aug  4 14:58 test2-harbor123.key
-rw-r--r--  1 ccpuser ccpadmin  5465 Aug  4 14:58 test2-harbor123.crt
-rw-r--r--  1 ccpuser ccpadmin  5418 Aug  4 14:58 test2-harbor.pfx
-rw-r--r--  1 ccpuser ccpadmin  7382 Aug  4 14:58 test2-harbor.key
-rw-r--r--  1 ccpuser ccpadmin  5465 Aug  4 14:58 test2-harbor.crt
namespace/harbor created
./test2-harbor54321.pfx is certpath
test2-harbor54321 is basename
test2-harbor54321 is new secret name for harbor
./test2-harbor54321.key key file generated
./test2-harbor54321.crt crt file generated
key filename is test2-harbor54321.key
crt filename is test2-harbor54321.crt
core: test2-harbor.tank.local
notary: test2-harbor.tank.local
secretName: test2-harbor54321
values.yaml is updated
secret/test2-harbor54321 created

NAME: harbor
LAST DEPLOYED: Tue Aug  4 

Re: Jenkins and HTTPS

2020-08-04 Thread 'Mansom, Ewout van' via Jenkins Users
You may want to look at setting up a reverse proxy in front of Jenkins, 
offloading TLS. 
https://www.jenkins.io/doc/book/system-administration/reverse-proxy-configuration-with-jenkins/
 On Mon, 2020-08-03 at 15:08 -0400, Gaiseric Vandal wrote:

Changed port to 8443.  That seems to have fixed it.


Thanks



On 7/24/2020 11:12 AM, Gianluca wrote:
Trying to guess:

" java.net.SocketException: Permission denied"

this smells of Java not running with enough privileges to open ports below 1024
Usually on Linux systems only root can open such ports.


On Friday, 24 July 2020 16:04:36 UTC+1, gaiseric.vandal wrote:

I am setting up jenkins on an CentOS 8 machine.  Currently have one running 
under Ubuntu 16.


On the new machine, I am unable to get HTTPS working, even tho the config seems 
the same as the other machine.


My partial config file is


# cat /etc/sysconfig/jenkins
#
JENKINS_HOME="/var/lib/jenkins"
JENKINS_JAVA_CMD=""
JENKINS_USER="jenkins"
#JENKINS_INSTALL_SKIP_CHOWN="false"
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
JENKINS_PORT="8080"
JENKINS_LISTEN_ADDRESS=""
JENKINS_HTTPS_PORT="443"
JENKINS_HTTPS_KEYSTORE="/etc/jenkins/jenkins.jks"
JENKINS_HTTPS_KEYSTORE_PASSWORD="xxx"
JENKINS_HTTPS_LISTEN_ADDRESS="0.0.0.0"
JENKINS_HTTP2_PORT=""
JENKINS_HTTP2_LISTEN_ADDRESS=""
JENKINS_DEBUG_LEVEL="5"
JENKINS_ENABLE_ACCESS_LOG="no"
JENKINS_HANDLER_MAX="100"

JENKINS_HANDLER_IDLE="20"
JENKINS_EXTRA_LIB_FOLDER=""
JENKINS_ARGS=""
#




I am quite certain I have the key store correct


I set up with

keytool -genkey -alias 
servername.mydomain.com   -keyalg RSA -keystore 
/etc/jenkins/jenkins.jks -keysize 2048


Then generated a CSR, had it signed by our internal CA.

Also imported the certificates for the CA's.






I have the following errors

$ cat /var/log/jenkins/jenkins.log
Running from: /usr/lib/jenkins/jenkins.war
Exception in thread "Jenkins initialization thread" 
java.lang.NoClassDefFoundError: hudson/util/HudsonFailedToLoad
at hudson.WebAppMain$3.run(WebAppMain.java:276)
Caused by: java.lang.ClassNotFoundException: 
hudson.util.HudsonFailedToLoad
at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at 
org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:543)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
java.io.IOException: Failed to start Jetty
at winstone.Launcher.(Launcher.java:184)
at winstone.Launcher.main(Launcher.java:355)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown 
Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:375)
at Main.main(Main.java:151)
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at 
org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:342)
at 
org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
at 
org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at 
org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:231)
at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.server.Server.doStart(Server.java:385)
at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at winstone.Launcher.(Launcher.java:182)
... 7 more
$


I also tried extracting the key and cert  and tried the following
 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized 
-Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar 
/usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log 
--webroot=/var/cache/jenkins/war --daemon 

How to get owner of upstream build in downstream build without using parameter?

2020-08-04 Thread Gajanan Mahajan
I have upstream and downstream pipelines and in downstream pipeline, I want 
to store user, who started upstream build, in downstream build variable.

I used following in downstream pipeline but it results into error - 
`java.lang.NullPointerException: Cannot invoke method getUserId() on null 
object`

Owner = currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId()

One way is to store it in a variable in upstream pipeline and pass it as 
param to downstream pipeline but that is additional handling and 
considering my parameters list, it is little tricky.

Is there any way I can get user who started upstream build in downstream 
build without passing parameter?

Similarly, `JOB_NAME` and `BUILD_NUMBER` of upstream to downstream.

-- 
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/f4704e0d-5958-4075-bd00-e5666f2a127fo%40googlegroups.com.


How to add parameters to existing parameters list?

2020-08-04 Thread Gajanan Mahajan
I get all parameters of a build using -

def myparams = 
currentBuild.rawBuild.getAction(ParametersAction).getParameters()

`myparams` is object of 
`java.util.Collections$UnmodifiableRandomAccessList` hence if try  to add 
another parameter to it like  -

myparams.add([$class: 'StringParameterValue', name: 'Test', value: 
"TestValue"])

then it fails with error - 

java.lang.UnsupportedOperationException

Please guide how to add parameter to existing parameters.

-- 
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/7f312f1a-7cf3-4c17-8ded-2ba3622b17d0o%40googlegroups.com.