diff --git a/build.gradle b/build.gradle index 08f89fee9..c73cdb7af 100644 --- a/build.gradle +++ b/build.gradle @@ -121,7 +121,7 @@ jacocoTestReport { } } -String version = '6.4.4' +String version = '6.4.5' task updateVersion { doLast { diff --git a/tests/jenkins/TestPublishToRubyGems.groovy b/tests/jenkins/TestPublishToRubyGems.groovy index 8986974b7..8c089f035 100644 --- a/tests/jenkins/TestPublishToRubyGems.groovy +++ b/tests/jenkins/TestPublishToRubyGems.groovy @@ -28,7 +28,7 @@ class TestPublishToRubyGems extends BuildPipelineTest { assertThat(curlCommands, hasItem( "cd /tmp/workspace/dist && curl --fail --data-binary @`ls *.gem` -H 'Authorization:API_KEY' -H 'Content-Type: application/octet-stream' https://rubygems.org/api/v1/gems".toString() )) - assertThat(gemCommands, hasItem("#!/bin/bash\n gem cert --add /tmp/workspace/certs/opensearch-rubygems.pem\n source ~/.rvm/scripts/rvm && rvm use 2.6.0 && ruby --version\n cd /tmp/workspace/dist && gemNameWithVersion=\$(ls *.gem)\n gem install \$gemNameWithVersion\n gemName=\$(echo \$gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem\$)//g')\n gem uninstall \$gemName\n gem install \$gemNameWithVersion -P MediumSecurity\n gem uninstall \$gemName\n gem install \$gemNameWithVersion -P HighSecurity\n ")) + assertThat(gemCommands, hasItem("#!/bin/bash\n source ~/.rvm/scripts/rvm && rvm use 2.6.0 && ruby --version\n gem cert --add /tmp/workspace/certs/opensearch-rubygems.pem\n cd /tmp/workspace/dist && gemNameWithVersion=\$(ls *.gem)\n gem install \$gemNameWithVersion\n gemName=\$(echo \$gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem\$)//g')\n gem uninstall \$gemName\n gem install \$gemNameWithVersion -P MediumSecurity\n gem uninstall \$gemName\n gem install \$gemNameWithVersion -P HighSecurity\n ")) } @Test @@ -40,7 +40,7 @@ class TestPublishToRubyGems extends BuildPipelineTest { def gemCommands = getCommands('sh', 'gem') assertThat(curlCommands, hasItem( "cd /tmp/workspace/test && curl --fail --data-binary @`ls *.gem` -H 'Authorization:API_KEY' -H 'Content-Type: application/octet-stream' https://rubygems.org/api/v1/gems".toString())) - assertThat(gemCommands, hasItem("#!/bin/bash\n gem cert --add /tmp/workspace/certificate/path\n source ~/.rvm/scripts/rvm && rvm use jruby-9.3.0.0 && ruby --version\n cd /tmp/workspace/test && gemNameWithVersion=\$(ls *.gem)\n gem install \$gemNameWithVersion\n gemName=\$(echo \$gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem\$)//g')\n gem uninstall \$gemName\n gem install \$gemNameWithVersion -P MediumSecurity\n gem uninstall \$gemName\n gem install \$gemNameWithVersion -P HighSecurity\n ")) + assertThat(gemCommands, hasItem("#!/bin/bash\n source ~/.rvm/scripts/rvm && rvm use jruby-9.3.0.0 && ruby --version\n gem cert --add /tmp/workspace/certificate/path\n cd /tmp/workspace/test && gemNameWithVersion=\$(ls *.gem)\n gem install \$gemNameWithVersion\n gemName=\$(echo \$gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem\$)//g')\n gem uninstall \$gemName\n gem install \$gemNameWithVersion -P MediumSecurity\n gem uninstall \$gemName\n gem install \$gemNameWithVersion -P HighSecurity\n ")) } def getCommands(method, text) { diff --git a/tests/jenkins/jobs/PublishToRubyGemWithArgs_Jenkinsfile.txt b/tests/jenkins/jobs/PublishToRubyGemWithArgs_Jenkinsfile.txt index 6fa1d78e2..11c4b0fce 100644 --- a/tests/jenkins/jobs/PublishToRubyGemWithArgs_Jenkinsfile.txt +++ b/tests/jenkins/jobs/PublishToRubyGemWithArgs_Jenkinsfile.txt @@ -5,8 +5,8 @@ PublishToRubyGemWithArgs_Jenkinsfile.script(groovy.lang.Closure) PublishToRubyGemWithArgs_Jenkinsfile.publishToRubyGems({apiKeyCredentialId=ruby-api-key, gemsDir=test, publicCertPath=certificate/path, rubyVersion=jruby-9.3.0.0}) publishToRubyGems.sh(#!/bin/bash - gem cert --add /tmp/workspace/certificate/path source ~/.rvm/scripts/rvm && rvm use jruby-9.3.0.0 && ruby --version + gem cert --add /tmp/workspace/certificate/path cd /tmp/workspace/test && gemNameWithVersion=$(ls *.gem) gem install $gemNameWithVersion gemName=$(echo $gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem$)//g') diff --git a/tests/jenkins/jobs/PublishToRubyGems_JenkinsFile.txt b/tests/jenkins/jobs/PublishToRubyGems_JenkinsFile.txt index 45fad0462..c55b56c3e 100644 --- a/tests/jenkins/jobs/PublishToRubyGems_JenkinsFile.txt +++ b/tests/jenkins/jobs/PublishToRubyGems_JenkinsFile.txt @@ -5,8 +5,8 @@ PublishToRubyGems_JenkinsFile.script(groovy.lang.Closure) PublishToRubyGems_JenkinsFile.publishToRubyGems({apiKeyCredentialId=ruby-api-key}) publishToRubyGems.sh(#!/bin/bash - gem cert --add /tmp/workspace/certs/opensearch-rubygems.pem source ~/.rvm/scripts/rvm && rvm use 2.6.0 && ruby --version + gem cert --add /tmp/workspace/certs/opensearch-rubygems.pem cd /tmp/workspace/dist && gemNameWithVersion=$(ls *.gem) gem install $gemNameWithVersion gemName=$(echo $gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem$)//g') diff --git a/vars/publishToRubyGems.groovy b/vars/publishToRubyGems.groovy index 47a99a749..e0f2596be 100644 --- a/vars/publishToRubyGems.groovy +++ b/vars/publishToRubyGems.groovy @@ -23,8 +23,8 @@ void call(Map args = [:]) { String rubyVersion = args.rubyVersion ?: '2.6.0' sh """#!/bin/bash - gem cert --add ${certPath} source ~/.rvm/scripts/rvm && rvm use ${rubyVersion} && ruby --version + gem cert --add ${certPath} cd ${releaseArtifactsDir} && gemNameWithVersion=\$(ls *.gem) gem install \$gemNameWithVersion gemName=\$(echo \$gemNameWithVersion | sed -E 's/(-[0-9.]+-*[a-z]*.gem\$)//g')