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

Cannot add trusted certificate with assembly layer #3672

Open
tdiesler opened this issue Feb 17, 2025 · 0 comments
Open

Cannot add trusted certificate with assembly layer #3672

tdiesler opened this issue Feb 17, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@tdiesler
Copy link

Describe the bug

I have a plugin configuration like this ...

            <plugin>
                <groupId>org.eclipse.jkube</groupId>
                <artifactId>kubernetes-maven-plugin</artifactId>
                <version>1.18.1</version>
                <configuration>
                    <buildStrategy>docker</buildStrategy>
                    <images>
                        <image>
                            <build>
                                <from>eclipse-temurin:17</from>
                                <entryPoint>
                                    <exec>
                                        <arg>__cacert_entrypoint.sh</arg>
                                        <arg>java</arg>
                                        <arg>-jar</arg>
                                        <arg>/maven/${project.artifactId}-${project.version}.jar</arg>
                                    </exec>
                                </entryPoint>
                                <assembly>
                                    <layers>
                                        <layer>
                                            <id>trusted-certs</id>
                                            <fileSets>
                                                <fileSet>
                                                    <directory>src/main/certs</directory>
                                                    <outputDirectory>/tmp</outputDirectory>
                                                    <includes>
                                                        <include>*crt</include>
                                                    </includes>
                                                </fileSet>
                                            </fileSets>
                                        </layer>
                                    </layers>
                                </assembly>
                            </build>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                            <goal>resource</goal>
                            <goal>push</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>

and get

[INFO] k8s: [examples/platform-http-oauth:1.0.0]: Created docker-build.tar in 86 milliseconds
[INFO] k8s: Step 1/4 : FROM eclipse-temurin:17
[INFO] k8s: 
[INFO] k8s: ---> 1e83e0efd1de
[INFO] k8s: Step 2/4 : COPY /trusted-certs/maven /maven/
[INFO] k8s: 
[ERROR] k8s: Failed to execute the build [Error while trying to build the image: Unable to build image [examples/platform-http-oauth:1.0.0] : "COPY failed: file not found in build context or excluded by .dockerignore: stat trusted-certs/maven: file does not exist" ]

or

[ERROR] k8s: Failed to execute the build [Error while trying to build the image: Cannot create directory '/certificates'.]

when outputDirectory=/certificates

Eclipse JKube version

1.18.1

Component

Kubernetes Maven Plugin

Apache Maven version

other (please specify in additional context)

Gradle version

None

Steps to reproduce

Build an image from eclipse-temurin:17 with an trusted cert that can get picked up by the temurin provided entrypoint __cacert_entrypoint.sh

Expected behavior

cert gets added to the image at the predefined location i.e. /certificates/mycert.crt

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3

Environment

macOS

Eclipse JKube Logs

Sample Reproducer Project

No response

Additional context

No response

@tdiesler tdiesler added the bug Something isn't working label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant