Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gemPush failed even $HOME/.gem/credential setting properly. #141

Open
hiroyuki-sato opened this issue Sep 15, 2023 · 11 comments · Fixed by #144
Open

gemPush failed even $HOME/.gem/credential setting properly. #141

hiroyuki-sato opened this issue Sep 15, 2023 · 11 comments · Fixed by #144

Comments

@hiroyuki-sato
Copy link
Member

gradlew gemPush failed even $HOME/.gem/credential setting properly.

MRI gem worked properly even no setting changed.
(Ruby 3.2.2, gem 3.4.19)

I think It relates to JRuby issue.

environment

  • OS: macOS 13.5.2 (M1 mac)
  • Java: Zulu 1.8.0_362

log

ls -l /Users/user/.gem/credentials
-rw-------@ 1 user  staff  81 Sep 14 13:40 /Users/user/.gem/credentials
./gradlew gemPush
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :gem UP-TO-DATE

> Task :gemPush
Executing: `java org.jruby.Main -rjars/setup -S gem push /path/to/plugin/embulk-parser-jsonpath/build/gems/embulk-parser-jsonpath-0.4.1-java.gem --verbose`
    with working directory at: /path/to/plugin/embulk-parser-jsonpath/build/gems
    with classpath: [ /Users/user/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.2.7.0/308120bca38f617e7b275af8ce0cbd9f0be66218/jruby-complete-9.2.7.0.jar ]
ERROR:  Your gem push credentials file located at:

	/Users/user/.gem/credentials

has file permissions of 0644 but 0600 is required.

To fix this error run:

	chmod 0600 /Users/user/.gem/credentials

You should reset your credentials at:

	https://rubygems.org/profile/edit

if you believe they were disclosed to a third party.

> Task :gemPush FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gemPush'.
> Process 'command '/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 6s

4 actionable tasks: 1 executed, 3 up-to-date

log2.txt

@dmikurube
Copy link
Member

@hiroyuki-sato
Copy link
Member Author

@dmikurube Thank you for your reply

It caused Could not set unknown property 'jruby' for task ':gemPush' of type org.embulk.gradle.embulk_plugins.GemPush. What is missing?

plugins {
    id "java"
    id "checkstyle"
    id "maven-publish"
    id "org.embulk.embulk-plugins" version "0.5.5"
    id "signing"
}
// ...
gemPush {
//    host = "https://rubygems.org"
    host = "http://localhost:9292"
    jruby = "org.jruby:jruby-complete:9.2.21.0"
}

Do I need update gradle?

./gradlew gemPush

FAILURE: Build failed with an exception.

* Where:
Build file '/path/to/embulk-parser-jsonpath/build.gradle' line: 111

* What went wrong:
A problem occurred evaluating root project 'embulk-parser-jsonpath'.
> Could not set unknown property 'jruby' for task ':gemPush' of type org.embulk.gradle.embulk_plugins.GemPush.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 594ms

@dmikurube
Copy link
Member

@hiroyuki-sato
Copy link
Member Author

Yes. It still use old Gradle plugin. So, I changed the Gradle plugin version in my environment.

--git a/build.gradle b/build.gradle
index d4e1f9f..482d98c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@ plugins {
     id "java"
     id "checkstyle"
     id "maven-publish"
-    id "org.embulk.embulk-plugins" version "0.4.2"
+    id "org.embulk.embulk-plugins" version "0.5.5"
     id "signing"
 }
 repositories {
@@ -106,7 +106,9 @@ gem {
 }

 gemPush {
-    host = "https://rubygems.org"
+//    host = "https://rubygems.org"
+    host = "http://localhost:9292"
+    jruby = "org.jruby:jruby-complete:9.2.21.0"
 }

 tasks.withType(JavaCompile) {

@dmikurube
Copy link
Member

Ah, got it. It may need to add the following in GemPush.java.

    /**
     * Property to configure a dependency notation for JRuby to run `gem build` and `gem push` commands.
     */
    @Internal
    public Property<Object> getJruby() {
        return this.jruby;
    }

@dmikurube
Copy link
Member

Created: #142

@dmikurube
Copy link
Member

@hiroyuki-sato
Copy link
Member Author

Thanks!

Local test results
#142 (comment)

JRuby Result
9.2.7.0 NG
9.2.21.0 OK

@dmikurube
Copy link
Member

Thanks for checking! Then we may want to upgrade the default JRuby for gem and gemPush...

@hiroyuki-sato
Copy link
Member Author

hiroyuki-sato commented Sep 19, 2023

9.2.21.0 may resolve this issue.

But, the current implementation have another issue. It prints You have enabled multi-factor authentication. Please enter OTP code.. But it doesn't show OTP prompt. As a result, gemPush failed.

check code

Executing: `java org.jruby.Main -rjars/setup -S gem push /path/to/embulk-filter-calc/build/gems/embulk-filter-calc-0.2.1.pretest-java.gediff --git a/build.gradle b/build.gradle
index fb41948..f03ff72 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,14 +4,14 @@ plugins {
     id "antlr"
     id "maven-publish"
     id "signing"
-    id "org.embulk.embulk-plugins" version "0.5.5"
+    id "org.embulk.embulk-plugins" version "0.6.0"
 }
 repositories {
     mavenCentral()
 }

 group = "io.github.hiroyuki-sato"
-version = "0.2.1-SNAPSHOT"
+version = "0.2.1.pretest"
 description = "Caculator filter plugin for Embulk"


@@ -189,6 +189,7 @@ gem {

 gemPush {
     host = "https://rubygems.org"
+    jruby = "org.jruby:jruby-complete:9.2.21.0"
 }

 tasks.withType(JavaCompile) {

Current behavior (JRuby 9.2.7.0)

./gradlew gemPush

> Task :gemPush
Executing: `java org.jruby.Main -rjars/setup -S gem push /path/to/embulk-filter-calc/build/gems/embulk-filter-calc-0.2.1.pretest-java.gem --verbose`
    with working directory at: /path/to/embulk-filter-calc/build/gems
    with classpath: [ /Users/user/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.2.7.0/308120bca38f617e7b275af8ce0cbd9f0be66218/jruby-complete-9.2.7.0.jar ]
ERROR:  Your gem push credentials file located at:

        /Users/user/.gem/credentials

has file permissions of 0644 but 0600 is required.

To fix this error run:

        chmod 0600 /Users/user/.gem/credentials

You should reset your credentials at:

        https://rubygems.org/profile/edit

if you believe they were disclosed to a third party.

> Task :gemPush FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gemPush'.
> Process 'command '/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 3s
5 actionable tasks: 1 executed, 4 up-to-date

9.2.21.0

./gradlew gemPush

> Task :gemPush
Executing: `java org.jruby.Main -rjars/setup -S gem push /path/to/embulk-filter-calc/build/gems/embulk-filter-calc-0.2.1.pretest-java.gem --verbose`
    with working directory at: /path/to/embulk-filter-calc/build/gems
    with classpath: [ /Users/user/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.2.21.0/d7be7522679da0a3f2aad68f8526927456ce906/jruby-complete-9.2.21.0.jar ]
GET https://rubygems.org/latest_specs.4.8.gz
304 Not Modified
Pushing gem to https://rubygems.org...
POST https://rubygems.org/api/v1/gems
401 Unauthorized
You have enabled multi-factor authentication. Please enter OTP code.
POST https://rubygems.org/api/v1/gems
401 Unauthorized
You have enabled multifactor authentication but no OTP code provided. Please fill it and retry.

> Task :gemPush FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gemPush'.
> Process 'command '/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6.2/userguide/command_line_interface.html#sec:command_line_warnings

@hiroyuki-sato
Copy link
Member Author

hiroyuki-sato commented Sep 19, 2023

JRuby 9.3.11.0 and 9.4.3.0 doesn't work too. But the problem relates to JRuby issue.
jruby/jruby#7938

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants