Re: Scripts in environment stage
Thanks a lot Yves. I also saw this in some samples. But, I have a Shared Library step, written to read a Yaml file from URL and return a Yaml Object. However, it is not returning the Yaml object when I call the step, although it is not throwing any error. Regards, Venkatesh On Wed, Dec 9, 2020 at 1:07 AM Yves Schumann wrote: > Hi Ven > > Am 08.12.2020 um 18:56 schrieb Ven H: > > Can we have script block or credential block to perform some logic > > inside the environment stage in Jenkinsfile? > > I'm doing such things without issues. Some examples: > > GIT_COMMIT_SHORT = sh( > script: "printf \$(git rev-parse --short ${GIT_COMMIT})", > returnStdout: true > ) > CURRENT_DATE = sh( > script: "printf \"\$(date '+%F %T')\"", > returnStdout: true > ) > > Kind regards, > Yves > > -- > 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/0afaf8c1-57b9-a329-eac4-5f9510a77897%40wayland > . > -- 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/CAPp28ereZ0RnVCv0eOABJDC-uySJJE1QJF96cVSo5qB8QnTLAg%40mail.gmail.com.
Re: Default Admin API Token
> On 1. Dec 2020, at 11:40, Shahbaz Subedar wrote: > > -Djenkins.install.runSetupWizard="false" > > -Djenkins.install.SetupWizard.ADMIN_INITIAL_API_TOKEN=11b9b3fafe25923768621ca1b64d44bfd1 > You're disabling the setup wizard, and then set an option that is > only used before/during the Setup Wizard -- 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/760455B1-FE07-470F-BC54-3A63CAF45671%40beckweb.net.
Re: Scripts in environment stage
Hi Ven Am 08.12.2020 um 18:56 schrieb Ven H: Can we have script block or credential block to perform some logic inside the environment stage in Jenkinsfile? I'm doing such things without issues. Some examples: GIT_COMMIT_SHORT = sh( script: "printf \$(git rev-parse --short ${GIT_COMMIT})", returnStdout: true ) CURRENT_DATE = sh( script: "printf \"\$(date '+%F %T')\"", returnStdout: true ) Kind regards, Yves -- 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/0afaf8c1-57b9-a329-eac4-5f9510a77897%40wayland.
Scripts in environment stage
Can we have script block or credential block to perform some logic inside the environment stage in Jenkinsfile? When I tried, it kept throwing errors saying only variable=value kind of expressions are allowed inside the environment stage. I want to read a Yaml file inside the environment stage since it is at the very beginning, to get some variable values. Please help. Regards, Venkatesh -- 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/CAPp28eqAKiOCd%2BN5nYnkMCtytQVXCyo1KFg8KJ2Q-mtuWQkENA%40mail.gmail.com.
Jenkins Pipeline - wait for non-job items (ComputedFolder, Multibranch Pipeline Project)
I'm using multibranch pipelines projects in Jenkins. I let Jenkins index new branches. I need Jenkins to wait until indexing of a multibranch pipeline project is complete. This is my current code: def triggerScanMultibranchPipeline(projectDir, repo) { def multibranchProject = Jenkins.instance.getItemByFullName "$projectDir/$repo" multibranchProject.scheduleBuild() while (multibranchProject == null || multibranchProject.isDisabled()) { sleep 1000 //1000 milliseconds = 1 second } sleep time: 1, unit: 'SECONDS' } Already tried: * change (second) sleep to 30 seconds This increases duration of the build each time `triggerScanMultibranchPipeline` is called. I cannot use `"wait: true"` for the indexing to complete, because waiting for non-job items is not supported. See https://github.com/jenkinsci/pipeline-build-step-plugin/blob/pipeline-build-step-2.13/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepExecution.java#L80 How can I let Jenkins wait until the branch indexing of the Multibranch Pipeline Project is complete? -- 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/c1131785-c31d-427d-b0e7-b16e7873d2e7n%40googlegroups.com.
Re: Default Admin API Token
Can you please reply to this ? If someone has tried to implement the same On Tuesday, December 1, 2020 at 5:20:48 PM UTC+5:30 Shahbaz Subedar wrote: > Hello Team, > > I have been trying to implement the functionality of having default Admin > API token at the time of deployment of Jenkins. I have been following the > below link. > https://github.com/jenkinsci/jenkins/pull/4027/commits > > As per the instruction, I have setup the system properties with fixed > token, but still not able to use the same token to access the API. > > I have been using Helm chart to deploy the jenkins with version as = 2.261. > > > Here are some details of my values.yaml file. > > global: > hosts: > domain: ${domain} > master: > resources: > requests: > cpu: 512m > memory: 512Mi > javaOpts: >- > -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self' > 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' data:;" > -Dcasc.jenkins.config="/var/jenkins_home/casc_configs" > -Djenkins.install.runSetupWizard="false" > > -Djenkins.install.SetupWizard.ADMIN_INITIAL_API_TOKEN=11b9b3fafe25923768621ca1b64d44bfd1 > -Djenkins.security.ApiTokenProperty.adminCanGenerateNewTokens="true" > -Djenkins.security.ApiTokenProperty.showTokenToAdmins="true" > tag: 2.261 > useSecurity: true > adminUser: "shahbaz" > adminInitialApiToken: "true" > JCasC: > enabled: true > defaultConfig: false > > configScripts: > jenkins-settings: | > jenkins: > authorizationStrategy: > loggedInUsersCanDoAnything: > allowAnonymousRead: false > securityRealm: > %{if persistence == true } > keycloak > %{ else } > local: > allowsSignup: false > users: > - id: "admin" > -- 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/ad8f54d7-1a26-4bd8-be06-789a816ba939n%40googlegroups.com.