GoogleContainerTools / jib

🏗 Build container images for your Java applications.
Apache License 2.0
13.67k stars 1.44k forks source link

can not push image in 0.9.8 but success in 0.9.7 #790

Closed qiankunli closed 6 years ago

qiankunli commented 6 years ago

plugin config

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>0.9.8</version>
    <configuration>
        <!--
        <allowInsecureRegistries>true</allowInsecureRegistries>
        -->
        <from>
            <image>harbor.test.xxx.com/test/jdk8</image>
        </from>
        <to>
            <image>harbor.test.xxx.com/test/jib-springboot-demo</image>
        </to>
        <container>
            <mainClass>com.xxx.springboot.demo.DockerSpringbootDemoApplication</mainClass>
        </container>

    </configuration>
</plugin>

maven settings.xml

<server>
    <id>harbor.test.xxx.com</id>
    <username>admin</username>
    <password>mypassword</password>
</server>

mvn package jib:build error log

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.8:build (default-cli) on project docker-springboot-demo: Build image failed, perhaps you should make sure your credentials for 'harbor.test.xxx.com' are set up correctly: Unauthorized for harbor.test.xxx.com/test/jib-springboot-demo: 401 Unauthorized
[ERROR] {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"test/jib-springboot-demo","Action":"pull"},{"Type":"repository","Class":"","Name":"test/jib-springboot-demo","Action":"push"},{"Type":"repository","Class":"","Name":"test/jdk8","Action":"pull"}]}]}
chanseokoh commented 6 years ago

Interesting. I guess at least you can keep using 0.9.7. In the meantime, could you test the following things in order with 0.9.8?

qiankunli commented 6 years ago

@chanseokoh

  1. there is no docker in my mac
  2. mvn help:effective-settings
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <localRepository xmlns="http://maven.apache.org/SETTINGS/1.1.0">/Users/nali/.m2/repository</localRepository>
  <servers xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <server>
      <username>admin</username>
      <password>***</password>
      <id>artifactory</id>
    </server>
    <server>
      <username>admin</username>
      <password>***</password>
      <id>harbor.test.xxx.com</id>
    </server>
  </servers>
  <profiles xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>artifactory-central</id>
          <url>http://artifactory.xxx.com/artifactory/repo</url>
        </repository>
        <repository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <id>artifactory-snapshots</id>
          <url>http://artifactory.xxx.com/artifactory/repo</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>artifactory-central</id>
          <url>http://artifactory.xxx.com/artifactory/plugins-releases</url>
        </pluginRepository>
        <pluginRepository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <id>artifactory-snapshots</id>
          <url>http://artifactory.xxx.com/artifactory/plugins-snapshots</url>
        </pluginRepository>
        <pluginRepository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <id>artifactory-central-snapshots</id>
          <url>http://artifactory.xxx.com/artifactory/plugins-snapshots-local/</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>artifactory-central-releases</id>
          <url>http://artifactory.xxx.com/artifactory/plugins-releases-local/</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
    <profile>
      <repositories>
        <repository>
          <id>objectweb</id>
          <name>objectweb Repository</name>
          <url>http://maven.ow2.org/maven2/</url>
        </repository>
        <repository>
          <id>ibiblio</id>
          <url>http://mirrors.ibiblio.org/pub/mirrors/maven/</url>
        </repository>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <url>http://repo1.maven.org/maven2/</url>
        </repository>
        <repository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <id>snapshots</id>
          <url>http://repo1.maven.org/maven2/</url>
        </repository>
        <repository>
          <id>sonatype</id>
          <url>http://repository.sonatype.org/</url>
        </repository>
        <repository>
          <id>codehaus</id>
          <url>http://repository.codehaus.org/</url>
        </repository>
        <repository>
          <id>org.springframework.maven.milestone</id>
          <name>Spring Maven Milestone Repository</name>
          <url>http://maven.springframework.org/milestone</url>
        </repository>
        <repository>
          <snapshots />
          <id>spring-maven-snapshot</id>
          <name>Springframework Maven SNAPSHOT Repository</name>
          <url>http://maven.springframework.org/snapshot</url>
        </repository>
        <repository>
          <id>springsource.repository</id>
          <url>http://repository.springsource.com/maven/bundles/release</url>
        </repository>
        <repository>
          <id>cedarsoft-thirdparty</id>
          <url>http://maven.cedarsoft.com/content/repositories/thirdparty/</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <url>http://repo1.maven.org/maven2/</url>
        </pluginRepository>
        <pluginRepository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <id>snapshots</id>
          <url>http://repo1.maven.org/maven2/</url>
        </pluginRepository>
        <pluginRepository>
          <id>sonatype</id>
          <url>http://repository.sonatype.org</url>
        </pluginRepository>
        <pluginRepository>
          <id>objectweb</id>
          <url>http://maven.ow2.org/maven2/</url>
        </pluginRepository>
      </pluginRepositories>
      <id>m2repo</id>
    </profile>
  </profiles>
  <activeProfiles xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
  <pluginGroups xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <pluginGroup>org.apache.maven.plugins</pluginGroup>
    <pluginGroup>org.codehaus.mojo</pluginGroup>
  </pluginGroups>
</settings>

I remove the auth in settings.xml and run mvn -U -Djib.to.auth.username=<username> -Djib.to.auth.password=<password> clean compile jib:build

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.8:build (default-cli) on project docker-springboot-demo: Build image failed, perhaps you should make sure your credentials for 'harbor.test.xxx.com' are set up correctly: Unauthorized for harbor.test.xxx.com/test/jib-springboot-demo: 401 Unauthorized
[ERROR] {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"test/jib-springboot-demo","Action":"pull"},{"Type":"repository","Class":"","Name":"test/jib-springboot-demo","Action":"push"},{"Type":"repository","Class":"","Name":"test/jdk8","Action":"pull"}]}]}
Justinmad commented 6 years ago

I have the same problem! jib-version : 0.9.8 Build image failed, perhaps you should make sure your credentials for 'registry.xxxx.com' are set up correctly: Unauthorized for registry.xxxx.com/jib-example: 401 Unauthorized

chanseokoh commented 6 years ago

@qiankunli from https://github.com/GoogleContainerTools/jib/issues/699#issue-343957843, I noticed that with 0.9.7, you were connecting through the plain HTTP (not HTTPS) by setting allowInsecureRegistries to true. (And I'm sure you were passing your password with -DsendCredentialsOverHttp.) Is this still the case, or harbor.test.xxx.com is now a full-fledged HTTPS registry?

@Justinmad likewise, with 0.9.7, were you setting allowInsecureRegistries to true to connect to an HTTP (not HTTPS) registry?

chanseokoh commented 6 years ago

@qiankunli can you give us an update (https://github.com/GoogleContainerTools/jib/issues/790#issuecomment-410565750)?

coollog commented 6 years ago

I believe this is the same issue as https://github.com/GoogleContainerTools/jib/issues/808#issuecomment-411457622

qiankunli commented 6 years ago

@coollog @chanseokoh it works in 0.9.9, thanks!

briandealwis commented 6 years ago

Thanks for confirming! Duplicate of #808