GoogleContainerTools / GoogleContainerTools/jib
Applying next tag for Maven SNAPSHOT builds
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Environment**:
- *Jib version:* 3.4.4
- *Build tool:* Maven
- *OS:* MacOS
**Description**:
I'm attempting to define a `phase` tag that indicates the type of release for the image.
- `next` for `SNAPSHOT` builds
- `latest` for release builds
I haven't found any explicit configrations in the Jib documentation that allows for this, so I'm hoping to use a Maven profile or some other mechanism to set the `jib.phase.tag` property based on the project version.
All of my attempts to do this have failed. I'm wondering if this might be a feature request for Jib to support conditional tags based on the project version type.
**Attempted Configrations**:
Main plugin configuration in `pom.xml`:
```xml
yyyyMMdd-HHmmss-SSS
latest
**redacted**/${project.artifactId}:${jib.phase.tag}
com.google.cloud.tools
jib-maven-plugin
3.4.4
package
build
eclipse-temurin:21
${jib.image}
${project.version}-${maven.build.timestamp}
${project.version}
-XX:MaxRAMPercentage=80.0
-XX:MinRAMPercentage=80.0
```
I haven't found a way to do this with standard maven profiles because you can't use wildcard/regex patterns to detect `-SNAPSHOT` in the `project.version`:
```xml
snapshot-build
project.version
.*-SNAPSHOT
next
```
I've also tried the `build-helper-maven-plugin` to set the property but the tag always ends up as `latest`:
```xml
org.codehaus.mojo
build-helper-maven-plugin
set-jib-phase-tag-for-snapshot
regex-property
jib.phase.tag
${project.version}
.*-SNAPSHOT
next
false
```
**Value**
While the `latest` tag is usually used to indicate the latest stable release, `next` (npm naming convention) is used to indicate the latest development release.
It seems like maybe this would be a nice feature for Jib to support with a configuration option.
Contributor guide
Assessment
This issue has not been assessed yet.