Re: Files sourced on pipeline shell step

2020-06-16 Thread 'Kamil Dzierżanowski' via Jenkins Users
It looks like the "sh" step uses the same shell session that the Jenkins 
agent does when connecting a node to master. Therefore, any default shell 
configuration is determined in node settings, and changing it, or any of 
the dot files, requires reconnecting the node to reload them.

I would say it is a best practice to use a Jenkins Shared Library and 
define a custom step, which will use the "sh" step to run a specified 
command in a new "bash" login session. That way you can ensure the proper 
dot files, NVM etc. are always sourced fresh.

On Monday, June 15, 2020 at 9:18:58 PM UTC+2, Martin Baillie wrote:
>
>  I'm experiencing a similar issue, did you find a solution?
>
> On Wednesday, 9 January 2019 09:19:25 UTC, Kamil Dzierżanowski wrote:
>>
>> Hello,
>>
>> I'm trying to determine, which (if any) files are sourced by the shell, 
>> in which commands specified in "sh" pipeline step are executed. I need to 
>> make sure the NVM (Node Version Manager) is sourced everytime this step is 
>> used.
>> I tried numerous dot-files for the user the Jenkins agent is using, as 
>> well as the /etc/profile, but none works. I'll be grateful for any hints or 
>> for pointing me to an existing answer (I failed to find any).
>>
>> Kamil
>>
>

-- 
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/53979b0c-41e1-43c1-a50b-450823380f45o%40googlegroups.com.


Anonymous access to plugin resources (SimplePageDecorator)

2019-05-02 Thread Kamil Dzierżanowski
Hi!

I've been experimenting with a recent extension point, the 
SimplePageDecorator. I'd like to have an image stored within the plugin, 
which would be loaded and displayed on the login page. However, right now 
any attempt to retrieve such resource results in a redirect to the login 
page, meaning it's not being loaded. For now, I've retreated to loading the 
image from external source. Is it possible to enable anonymous access to 
webapp resources?

Thanks,
Kamil

-- 
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/32d0ecda-6bcc-4f7d-9d56-aa387c4b6bee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom state elements in the Jenkins singleton

2019-02-27 Thread Kamil Dzierżanowski
In the init scripts, I'm using Grape to get 
com.bettercloud:vault-java-driver:4.0.0 
. It is then used by 
creating an instance of the Vault client, such as:

def vaultConfig = new VaultConfig()
  .address(vaultUrl)
  .token(vaultToken)
  .sslConfig(new SslConfig().build())
  .build()

Integer vaultEngineVersion = 1
def vault = new Vault(vaultConfig, vaultEngineVersion)

I'd like to *persist the vault *variable shown above across various init 
scripts that will be executed after this. Is there a mechanism to write 
custom objects as state of the Jenkins (or any other) singleton?

Thanks,
Kamil

-- 
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/7584eeab-a3fc-433d-8b75-b240f8042ebd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Files sourced on pipeline shell step

2019-01-09 Thread Kamil Dzierżanowski
Hello,

I'm trying to determine, which (if any) files are sourced by the shell, in 
which commands specified in "sh" pipeline step are executed. I need to make 
sure the NVM (Node Version Manager) is sourced everytime this step is used.
I tried numerous dot-files for the user the Jenkins agent is using, as well 
as the /etc/profile, but none works. I'll be grateful for any hints or for 
pointing me to an existing answer (I failed to find any).

Kamil

-- 
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/06048e11-c62e-4123-a67f-216d0e01d2b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'Messages' class in getter methods of Descriptors - where are they defined

2018-11-15 Thread Kamil Dzierżanowski
Awesome! Thank you very much Devin.

On Thursday, November 15, 2018 at 4:08:52 PM UTC+1, Devin Nusbaum wrote:
>
> These classes are auto-generated from Messages.properties files in the 
> plugins' resource directories. If you run `mvn clean compile` from the 
> command line, everything should work correctly, but if you are using an IDE 
> you may need to manually mark target/generated-sources/localizer as 
> generated source code for them to be recognized correctly. You can find 
> more information at these links: 
> https://jenkins.io/doc/developer/internationalization/i18n-source-code/
>  and 
> *https://wiki.jenkins.io/display/JENKINS/Internationalization#Internationalization-GenerationofMessagesclasses
>  
> <https://wiki.jenkins.io/display/JENKINS/Internationalization#Internationalization-GenerationofMessagesclasses>.*
>
>
> On Nov 15, 2018, at 09:59, Kamil Dzierżanowski  > wrote:
>
> Hi!
>
> In most of the plugins' source code, I can find a 'Messages' class used in 
> the getters of the Descriptor. This class is not present in the source, and 
> is not pulled automatically as a dependency, so the plugins won't compile.
> I am probably missing some background on plugin development here, but I 
> don't really have time now to deep-dive into the topic, so I was hoping - 
> maybe there is a shorthand way to explain how this works. I will be 
> grateful for any clues.
>
> Best,
> Kamil
>
> -- 
> 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/6a55c589-bf85-4a6c-ab0e-bb8ce6c1cba7%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/6a55c589-bf85-4a6c-ab0e-bb8ce6c1cba7%40googlegroups.com?utm_medium=email_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/7dd05efb-273a-4722-adf7-78b9fbe74ea2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


'Messages' class in getter methods of Descriptors - where are they defined

2018-11-15 Thread Kamil Dzierżanowski
Hi!

In most of the plugins' source code, I can find a 'Messages' class used in 
the getters of the Descriptor. This class is not present in the source, and 
is not pulled automatically as a dependency, so the plugins won't compile.
I am probably missing some background on plugin development here, but I 
don't really have time now to deep-dive into the topic, so I was hoping - 
maybe there is a shorthand way to explain how this works. I will be 
grateful for any clues.

Best,
Kamil

-- 
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/6a55c589-bf85-4a6c-ab0e-bb8ce6c1cba7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Maven global configuration via Groovy init script

2018-11-15 Thread Kamil Dzierżanowski


Thanks for inspiration, Victor!

For the record, I was mentioning a part of "Configure Jenkins" page, which 
turns out to probably be a part of maven-plugin. Currently it's located 
right above the master node config (# of executors, etc.)

The YAML config for CasC should look similar to this:

# "Maven Project Configuration" section
mavenmoduleset:
  globalMavenOpts: "some opts"
  localRepository:
perJob:  # alternatives: default, perExecutor


Now I haven't yet successfully managet to get the plugin to work, but it is 
possible to do the same as Groovy init:

import hudson.maven.MavenModuleSet;
import hudson.maven.local_repo.*;

/*
 * Possible classes of the hudson.maven.local_repo package:
 * - DefaultLocalRepositoryLocator
 * - PerExecutorLocalRepositoryLocator
 * - PerJobLocalRepositoryLocator
 */

def mvnModuleSetDesc = MavenModuleSet.DESCRIPTOR;
mvnModuleSetDesc.setGlobalMavenOpts("Some options")
mvnModuleSetDesc.setLocalRepository(new PerJobLocalRepositoryLocator())

On Friday, November 9, 2018 at 8:15:20 PM UTC+1, Victor Martinez wrote:
>
> I'd rather suggest to look at:
> - https://github.com/jenkinsci/configuration-as-code-plugin
>
>
> I'm not sure where the "Maven Project Configuration" section is but 
> something like the below snippet might help to configure the maven tools 
> globally:
>
> tool:
>   maven: # (4)
> installations:
> - name: "maven"
>   properties:
>   - installSource:
>   installers:
>   - maven:
>   id: "3.5.4"
>
> Cheers
>

-- 
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/d87b2f20-9487-4039-bade-848b5944e5d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Maven global configuration via Groovy init script

2018-11-09 Thread Kamil Dzierżanowski
Greetings!

I am working to migrate an entire Jenkins configuration to code, so it is 
dynamically reproducible.
I haven't had problems with core config and plugins so far, but I cannot 
find any classes or methods that would allow me to configure the "Maven 
Project Configuration" section in code. There's the *jenkins.mvn* package, 
but the classess and methods aren't very helpful.

I would be very grateful for any clue how to achieve this.

Best,
Kamil

-- 
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/de8cba4c-8e16-4697-bdc6-6ec77b5c136c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.