Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39193

Unable to use rbenv plugin together with ruby environment plugin

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • job-dsl-plugin
    • None

      Hi,

      I am trying to use a simple rbenv wrapper, the settings will be set in config.xml of the job, but neither the UI is picking them up, nor the build itself.

      This is the code I am using:

              job.wrappers {
                  rbenv(rubyVersion) {
                      ignoreLocalVersion()
                      gems('bundler', 'rake')
                  }
              }
      

      The settings will be transferred into the config.xml of the job:

      <buildWrappers>
      <ruby-proxy-object>
      <ruby-object ruby-class="Jenkins::Tasks::BuildWrapperProxy" pluginid="rbenv">
      <pluginid ruby-class="String" pluginid="rbenv">rbenv</pluginid>
      <object ruby-class="RbenvWrapper" pluginid="rbenv">
      <version ruby-class="String" pluginid="rbenv">1.9.3-p551</version>
      <ignore__local__version ruby-class="String" pluginid="rbenv">true</ignore__local__version>
      <gem__list ruby-class="String" pluginid="rbenv">bundler,rake</gem__list>
      <rbenv__root ruby-class="String" pluginid="rbenv">$HOME/.rbenv</rbenv__root>
      <rbenv__repository ruby-class="String" pluginid="rbenv">https://github.com/sstephenson/rbenv.git</rbenv__repository>
      <rbenv__revision ruby-class="String" pluginid="rbenv">master</rbenv__revision>
      <ruby__build__repository ruby-class="String" pluginid="rbenv">https://github.com/sstephenson/ruby-build.git</ruby__build__repository>
      <ruby__build__revision ruby-class="String" pluginid="rbenv">master</ruby__build__revision>
      </object>
      </ruby-object>
      </ruby-proxy-object>
      </buildWrappers>
      

      But the UI is not picking them up (the checkbox for rbenv build wrapper is unchecked) and the settings are not transferred into the block.

      When I manually setup the wrapper the xml looks like this:

      <buildWrappers>
      <ruby-proxy-object>
      <ruby-object ruby-class="Jenkins::Tasks::BuildWrapperProxy" pluginid="rbenv">
      <pluginid ruby-class="String" pluginid="rbenv">rbenv</pluginid>
      <object ruby-class="RbenvWrapper" pluginid="rbenv">
      <version ruby-class="String" pluginid="rbenv">1.9.3-p551</version>
      <ignore__local__version ruby-class="String" pluginid="rbenv">true</ignore__local__version>
      <gem__list ruby-class="String" pluginid="rbenv">bundler,rake</gem__list>
      <rbenv__root ruby-class="String" pluginid="rbenv">$HOME/.rbenv</rbenv__root>
      <rbenv__repository ruby-class="String" pluginid="rbenv">https://github.com/sstephenson/rbenv.git</rbenv__repository>
      <rbenv__revision ruby-class="String" pluginid="rbenv">master</rbenv__revision>
      <ruby__build__repository ruby-class="String" pluginid="rbenv">https://github.com/sstephenson/ruby-build.git</ruby__build__repository>
      <ruby__build__revision ruby-class="String" pluginid="rbenv">master</ruby__build__revision>
      </object>
      </ruby-object>
      </ruby-proxy-object>
      </buildWrappers>
      

      I cannot stop the difference. The error goes away when using ruby env 0.12.

          [JENKINS-39193] Unable to use rbenv plugin together with ruby environment plugin

          Support for ruby-environment plugin versions older than 0.13 is deprecated since Job DSL version 1.51.

          Daniel Spilker added a comment - Support for ruby-environment plugin versions older than 0.13 is deprecated since Job DSL version 1.51.

          This is exactly what I am trying The rbenv build wrapper works with ruby-environment 0.12 but does NOT work with ruby-environment 0.13.

          Björn Häuser added a comment - This is exactly what I am trying The rbenv build wrapper works with ruby-environment 0.12 but does NOT work with ruby-environment 0.13.

          I am not able to re-open the issue, sorry for generating noise when trying.

          Björn Häuser added a comment - I am not able to re-open the issue, sorry for generating noise when trying.

          The interesting thing is, that even when I try to generate the rbenv plugin via configure block it still does not work:

          job.configure { it ->
                      it / 'buildWrappers' << 'ruby-proxy-object' {
                          'ruby-object'('ruby-class': 'Jenkins::Tasks::BuildWrapperProxy', pluginid: 'rbenv') {
                              object('ruby-class': 'RbenvWrapper', pluginid: 'rbenv') {
                                  ruby__build__repository('https://github.com/sstephenson/ruby-build.git', [pluginid: 'rbenv', 'ruby-class': 'String'])
                                  ruby__build__revision('master', [pluginid: 'rbenv', 'ruby-class': 'String'])
                                  rbenv__root('$HOME/.rbenv', [pluginid: 'rbenv', 'ruby-class': 'String'])
                                  rbenv__revision('master', [pluginid: 'rbenv', 'ruby-class': 'String'])
                                  ruby__configure__opts([pluginid: 'rbenv', 'ruby-class': 'String'])
                                  rbenv__repository('https://github.com/sstephenson/rbenv.git', [pluginid: 'rbenv', 'ruby-class': 'String'])
                                  version(rubyVersion, [pluginid: 'rbenv', 'ruby-class': 'String'])
                                  gem__list(['bundler', 'rake'].join(','), [pluginid: 'rbenv', 'ruby-class': 'String'])
                                  configure__opts('', [pluginid: 'rbenv', 'ruby-class<span class="code-quote">': 'String'])
                                  ignore__local__version(['ruby-class': 'FalseClass', pluginid: 'rbenv'])
                              }
                              pluginid('rbenv', [pluginid: 'rbenv', 'ruby-class': 'String'])
                          }
                      }
                  }
          

          Björn Häuser added a comment - The interesting thing is, that even when I try to generate the rbenv plugin via configure block it still does not work: job.configure { it -> it / 'buildWrappers' << 'ruby-proxy-object' { 'ruby-object' ( 'ruby-class' : 'Jenkins::Tasks::BuildWrapperProxy' , pluginid: 'rbenv' ) { object( 'ruby-class' : 'RbenvWrapper' , pluginid: 'rbenv' ) { ruby__build__repository( 'https: //github.com/sstephenson/ruby-build.git' , [pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) ruby__build__revision( 'master' , [pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) rbenv__root( '$HOME/.rbenv' , [pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) rbenv__revision( 'master' , [pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) ruby__configure__opts([pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) rbenv__repository( 'https: //github.com/sstephenson/rbenv.git' , [pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) version(rubyVersion, [pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) gem__list([ 'bundler' , 'rake' ].join( ',' ), [pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) configure__opts( '', [pluginid: ' rbenv ', ' ruby- class span class="code-quote">': ' String ']) ignore__local__version([ 'ruby-class' : 'FalseClass' , pluginid: 'rbenv' ]) } pluginid( 'rbenv' , [pluginid: 'rbenv' , 'ruby-class' : ' String ' ]) } } }

          Looks like a duplicate from JENKINS-37422, right?

          Björn Häuser added a comment - Looks like a duplicate from JENKINS-37422 , right?

          Or totally different problem, same as in JENKINS-38145 :/ i am lost here :/

          Björn Häuser added a comment - Or totally different problem, same as in JENKINS-38145 :/ i am lost here :/

          Yes, this is a total mess. I linked all related issues. This does not seem to be a Job DSL issue because even reloading config from disc does not seem to work reliable from what I saw in the related tickets. I assume that other XML based API for creating and updating jobs are affected as well, e.g. CLI and REST.

          I tried to fix this a few days ago but I found no reliable solution. There is a PR (https://github.com/jenkinsci/job-dsl-plugin/pull/965) but that did not work for me either. If we can't find a reliably working configure block, there will not be a reliable built-in version.

          If no one finds a working solution, I will deprecate support for all Ruby based plugins with the next release for the time being.

          Daniel Spilker added a comment - Yes, this is a total mess. I linked all related issues. This does not seem to be a Job DSL issue because even reloading config from disc does not seem to work reliable from what I saw in the related tickets. I assume that other XML based API for creating and updating jobs are affected as well, e.g. CLI and REST. I tried to fix this a few days ago but I found no reliable solution. There is a PR ( https://github.com/jenkinsci/job-dsl-plugin/pull/965 ) but that did not work for me either. If we can't find a reliably working configure block, there will not be a reliable built-in version. If no one finds a working solution, I will deprecate support for all Ruby based plugins with the next release for the time being.

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          docs/Migration.md
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContextSpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/a4599275bb0026b9307eda4be3ab701f9a6c21a5
          Log:
          Merge remote-tracking branch 'stelligent/master'

          • fixed compatibility issue with Ruby Runtime Plugin
          • version 0.12 of the Ruby Runtime Plugin is no longer deprecated
          • support for the older versions of the Rbenv Plugin is deprecated

          [FIXES JENKINS-39193]
          [FIXES JENKINS-39807]

          Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/f909b558ba74...a4599275bb00

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md docs/Migration.md job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContextSpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/a4599275bb0026b9307eda4be3ab701f9a6c21a5 Log: Merge remote-tracking branch 'stelligent/master' fixed compatibility issue with Ruby Runtime Plugin version 0.12 of the Ruby Runtime Plugin is no longer deprecated support for the older versions of the Rbenv Plugin is deprecated [FIXES JENKINS-39193] [FIXES JENKINS-39807] Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/f909b558ba74...a4599275bb00

            daspilker Daniel Spilker
            bjoernhaeuser Björn Häuser
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: