You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run skaffold build -p $profile to execute a Jib build for my Gradle project, which consumes one or more "-SNAPSHOT" dependencies, Skaffold successfully uploads a "source archive" to GCS, downloads and unpacks that archive, and proceeds with the build as configured.
Actual behavior
With the following profile definition:
- name: dev
build:
googleCloudBuild:
projectId: $gcpProjectId
gradleImage: gradle:8.2.1-jdk17-alpine
artifacts:
- image: $destinationContainerRepo
jib:
type: gradle
project: service
skaffold build -p dev fails like so:
Pushing code to gs://my-cloudbuild-bucket/source/source-archive-prefix-<archive hash>.tar.gz
uploading source archive: uploading sources to google storage: Rel: can't make /Users/me/.gradle/caches/modules-2/files-2.1/my.org/my-shared-lib/0.0.1-SNAPSHOT/<archive hash>/my-shared-lib-0.0.1-SNAPSHOT.jar relative to .
If I add context: $absolutePathToProjectRoot to the build artifact in the above profile config, skaffold build -p dev fails like so:
Fetching storage object: gs://my-cloudbuild-bucket/source/source-archive-prefix-<archive hash>.tar.gz#$epochTimestampMicros
Copying gs://my-cloudbuild-bucket/source/source-archive-prefix-<archive hash>.tar.gz#$epochTimestampMicros...
/ [1 files][ 14.2 MiB/ 14.2 MiB]
Operation completed over 1 objects/14.2 MiB.
tar: Removing leading `../../../' from member names
tar: ../../../.gradle/caches/modules-2/files-2.1/my.org/my-shared-lib/0.0.1-SNAPSHOT/<archive hash>/my-shared-lib-0.0.1-SNAPSHOT.jar: Member name contains '..'
tar: Exiting with failure status due to previous errors
NOTE: the above failure modes occur only when my project is configured to consume a -SNAPSHOT version of the relevant dependency (since this prompts Skaffold/Jib to include a copy of the dependency in the sources archive). The build works fine if I change the Gradle dependency config to consume my-shared-lib:0.0.1 rather than my-shared-lib:0.0.1-SNAPSHOT.
I would suspect there is some way to configure Skaffold and/or Jib to work around this (aside from nuclear options such as running builds in the same directory as the Gradle cache or setting GRADLE_USER_HOME to force the creation of a brand new cache directory in the build directory)...but I'm not finding it.
Thanks in advance!
Information
Skaffold version: v2.9.0
Operating system: macOS 14.7
Installed via: Google Cloud SDK
Contents of skaffold.yaml: see snippet above (I think that should be sufficient here, but I'm happy to share more if it would be helpful...I'll just need to obfuscate the contents, which is a bit tedious)
The text was updated successfully, but these errors were encountered:
Expected behavior
When I run
skaffold build -p $profile
to execute a Jib build for my Gradle project, which consumes one or more "-SNAPSHOT" dependencies, Skaffold successfully uploads a "source archive" to GCS, downloads and unpacks that archive, and proceeds with the build as configured.Actual behavior
With the following profile definition:
skaffold build -p dev
fails like so:If I add
context: $absolutePathToProjectRoot
to the build artifact in the above profile config,skaffold build -p dev
fails like so:NOTE: the above failure modes occur only when my project is configured to consume a
-SNAPSHOT
version of the relevant dependency (since this prompts Skaffold/Jib to include a copy of the dependency in the sources archive). The build works fine if I change the Gradle dependency config to consumemy-shared-lib:0.0.1
rather thanmy-shared-lib:0.0.1-SNAPSHOT
.I would suspect there is some way to configure Skaffold and/or Jib to work around this (aside from nuclear options such as running builds in the same directory as the Gradle cache or setting
GRADLE_USER_HOME
to force the creation of a brand new cache directory in the build directory)...but I'm not finding it.Thanks in advance!
Information
v2.9.0
macOS 14.7
Google Cloud SDK
The text was updated successfully, but these errors were encountered: