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

Jib fails the build with long filenames (>100 bytes) #91

Closed
sgammon opened this issue Feb 12, 2018 · 3 comments
Closed

Jib fails the build with long filenames (>100 bytes) #91

sgammon opened this issue Feb 12, 2018 · 3 comments
Milestone

Comments

@sgammon
Copy link

sgammon commented Feb 12, 2018

Description of the issue:
When building with some long protobuf filenames, Jib breaks with an error that the filename is too long.

Expected behavior:
It should build anyways because we all know how long Java filenames can get, especially with paths included.

Steps to reproduce:

  1. have an app with deep proto import paths
  2. use a long name for a proto
  3. make sure the combined values are over 100 bytes
  4. ask Jib to build an image with them in it

Environment:
Jib: 0.1.1-SNAPSHOT

Maven:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"

IntelliJ:

IntelliJ IDEA 2018.1 EAP (Ultimate Edition)
Build #IU-181.3494.3, built on February 6, 2018
IntelliJ IDEA EAP User
Expiration date: March 8, 2018
JRE: 1.8.0_152-release-1136-b5 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.3

jib-maven-plugin Configuration:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.sample</groupId>
    <artifactId>java-sample</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <app.version>latest</app.version>
        <app.project>(redacted)</app.project>
        <app.repository>(redacted)</app.repository>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>4.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>24.0-jre</version>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>3.5.1</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty</artifactId>
            <version>1.9.0</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
            <version>1.9.0</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
            <version>1.9.0</version>
        </dependency>
    </dependencies>

    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.5.0.Final</version>
            </extension>
        </extensions>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.5.0</version>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
                    <pluginId>grpc-java</pluginId>
                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.9.0:exe:${os.detected.classifier}</pluginArtifact>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>compile-custom</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>0.1.1-SNAPSHOT</version>
                <configuration>
                    <registry>us.gcr.io</registry>
                    <repository>${app.project}/${app.repository}</repository>
                    <from>us.gcr.io/${app.project}/v2-java:${app.version}</from>
                    <jvmFlags>
                        <jvmFlag>-Xms512m</jvmFlag>
                    </jvmFlags>
                    <mainClass>(redacted)</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Log output:

...
[INFO] RUNNING	Pushing new image
[INFO] Pushing new image : 0.172 ms
[INFO] Building and pushing image : 9203.004 ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.573 s
[INFO] Finished at: 2018-02-12T14:17:09-08:00
[INFO] Final Memory: 34M/786M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.1.1-SNAPSHOT:build (default-cli) on project platform: Build image failed: file name 'app/classes/com/<really_long_path>/LocationIntegrationSettings$GenericDefaultEntryHolder.class' is too long ( > 100 bytes) -> [Help 1]
@coollog
Copy link
Contributor

coollog commented Feb 12, 2018

Ah, thanks for the find! Looks like we just need to use a POSIX long file mode when we are building the layers. Will be adding a fix for this soon to be also released in v0.1.1.

@coollog coollog self-assigned this Feb 12, 2018
@coollog coollog added this to the 0.1.1 milestone Feb 12, 2018
@sgammon
Copy link
Author

sgammon commented Feb 13, 2018

Thank you for the quick fix @coollog! You guys are lightning fast!

@coollog
Copy link
Contributor

coollog commented Feb 13, 2018

No problem, thanks for contributing!

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

No branches or pull requests

2 participants