Open NicolasRouquette opened 1 year ago
On Maven central, https://central.sonatype.com/artifact/org.jfrog.buildinfo/build-info-extractor-gradle/5.0.0/versions, I see this:
I was shocked that all of our projects that use the Artifactory plugin do not work unless I change the version from latest.release
to 4.33.1
.
I was pretty shocked to see this too, now all of our builds are broken as we're referencing latest.release
as well. It looks like this brand-new repo did published 5.0.0: https://github.com/jfrog/artifactory-gradle-plugin; it's not clear to me whether that was intentional.
@NicolasRouquette - Thank you for opening this Issue! I've been having this same issue on some new build servers, and I was pulling my hair out thinking it was an issue with the new servers.
@DanielJRutledge - Agreed. The release of 5.0.0
feels unintentional. As of writing this, https://plugins.gradle.org/plugin/com.jfrog.artifactory still shows 4.33.1
as the latest version despite 5.0.0
being deployed to Maven.
In case it helps others, as mentioned, the temp fix was to specify an explicit dependency upon 4.33.1
instead of latest.release
:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.33.1"
}
}
All - Versions 5 does include breaking changes. We used a major version for this release because it introduces breaking changes. This release is actually a complete rewrite of the plugin from Groovy to Java. This major change is a prerequisite for multiple upcoming improvements and new support for important Gradle features. Please use the latest 4 release for your builds.
@eyalbe4 All of us are using the latest.release
tag per Jfrog's recommendation. Would it be possible to make the 5.x releases pre-release so that we can elect to move over when appropriate?
@eyalbe4 Since the API-breaking changes are intentional in Version 5, shouldn't this be documented?
Until this happens, the current documentation for the plugin version, latest.release
, has become factually wrong.
@eyalbe4
Was there ever any communications about the upcoming breaking changes for 5.x
?
Why is the documentation for 5.x
still showing contextUrl
?
https://github.com/jfrog/artifactory-gradle-plugin/blob/7ab3e871096dbae82da6a5552ea5227de3103a33/README.md#%EF%B8%8F-artifactory-configuration
Where's the documentation on how to use the 5.x
version of the plugin?
Should the 5.x
version of the plugin not be used at this time? If not, why has it been published to Maven?
Does this pull request mean that contextUrl
will be usable for version 5.x
in the future?
https://github.com/jfrog/artifactory-gradle-plugin/pull/32
Without prior communication, it might sound like an easy switch to point at the latest 4.x
release, but it is tedious when organizations have hundreds/thousands of repos using this plugin, each with many feature branches.
All - We wrongly assumed people were using the latest 4 version (4+) as part of their Gradle scripts. Let us check internally the best way to move forward and share an update here.
What's the update here? It looks like the team is releasing 5.0.1 and is just plowing ahead. This is extremely destructive to users and builds as we weren't given any notice of required changes.
Hi @DanielJRutledge version 5.0.1 includes https://github.com/jfrog/artifactory-gradle-plugin/pull/32 which should help mitigating this issue. Do you still encounter issues in 5.0.1?
The new plugin still requires Gradle 6.9, which as others have noted on this thread, was a requirement rolled out without any notice.
@yahavi With 5.0.1, I still get the same errors as initially reported. This is with Java 17 and Gradle 7.5.1.
With Java 11, Gradle 7.4.1, and 5.0.1 of the Artifactory Gradle Plugin, I no longer get the Could not set unknown property 'contextUrl'
error immediately when executing my build.gradle
. But when the publish task (artifactoryPublish
) is executed I'm getting the following error now:
> startup failed:
build file '/my/path/build.gradle': 208: unable to resolve class org.jfrog.gradle.plugin.artifactory.extractor.GradleDeployDetails
@ line 208, column 11.
for (org.jfrog.gradle.plugin.artifactory.extractor.GradleDeployDetails details : deployDetailsSet) {
^
We wrongly assumed people were using the latest 4 version (4+) as part of their Gradle scripts. Let us check internally the best way to move forward and share an update here.
@eyalbe4 We need to know what the approach for this library is going to be; it doesn't seem like this was intended to be release in this fashion, and there are multiple known issues at this point. Do we plan to have latest.release
point to 4.x instead?
Hi @jessejcollins, We moved back some package and classes to their previous places to mitigating similar issues. version 5.0.2 includes jfrog/artifactory-gradle-plugin#36 which should help mitigating this. Do you still encounter issues in 5.0.2?
Hi @attiasas - I'm getting this error with 5.0.2:
Execution failed for task 'artifactoryPublish'.
> Could not get unknown property 'helperPublications' for task 'artifactoryPublish' of type org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask.
This error occurred after a few files were successfully published to Artifactory. These successfully published files were not occurring for 5.0.0 or 5.0.1, so there is some progress.
Hey @jessejcollins, Glad to see we have progress.
This inner class was removed in the major version, did you access 'helperPublications' manually in the build script?
can you share the error running the task with -stacktrace
/ -d
so I can get more context of this issue?
OK, you are right. This comes from the configuration in our build.gradle
file.
Our CI/CD pipeline injects code into the build.gradle
for a hook to the Artifactory plug-in using doLast
, and that injected code uses the helperPublications
class.
The usage of the helperPublications
class is to get the Artifactory repository where the artifact will be published (which is used later in the pipeline for other processing - e.g. checking Xray scan results after publication).
Here's a modified snippet of the injected Gradle task:
tasks.withType(org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask) {
doLast {
String artifactRepo = ""
HashSet deployDetailsSet = helperPublications.artifactDeployDetails
if (!deployDetailsSet.isEmpty()) {
for (org.jfrog.gradle.plugin.artifactory.extractor.GradleDeployDetails details : deployDetailsSet) {
artifactRepo = details.deployDetails.targetRepository
if (!artifactRepo.equals("")) {
break
}
}
}
println(artifactRepo)
}
}
Is there a new equivalent class/method for the 5.0.*
version of the Artifactory plug-in that contains similar artifact deployment details as helperPublications.artifactDeployDetails
?
ArtifactoryTask wil now directly return it usinggetDeployDetails()
(after the task took action)
So probably the following snippet is what you are looking for:
tasks.withType(org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask) {
doLast {
String artifactRepo = ""
HashSet deployDetailsSet = getDeployDetails()
if (!deployDetailsSet.isEmpty()) {
for (org.jfrog.gradle.plugin.artifactory.extractor.GradleDeployDetails details : deployDetailsSet) {
artifactRepo = details.deployDetails.targetRepository
if (!artifactRepo.equals("")) {
break
}
}
}
println(artifactRepo)
}
}
let us know if there are any other migration issues
Thank you @attiasas!
Using getDeployDetails()
worked great for the 5.* version of the plugin.
We've updated the injected code to the following so it works for both the 4. & 5. plugin:
tasks.withType(org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask) {
doLast {
String artifactRepo = ""
HashSet deployDetailsSet = null
try {
// ARTIFACTORY PLUGIN 4.0.0+
deployDetailsSet = helperPublications.artifactDeployDetails
} catch (Exception e) {
// ARTIFACTORY PLUGIN 5.0.0+
deployDetailsSet = getDeployDetails()
}
if (!deployDetailsSet.isEmpty()) {
for (org.jfrog.gradle.plugin.artifactory.extractor.GradleDeployDetails details : deployDetailsSet) {
artifactRepo = details.deployDetails.targetRepository
if (!artifactRepo.equals("")) {
break
}
}
}
println(artifactRepo)
}
}
It would be nicer if we did not rely on an exception to handle the different versions.
It looks like the conclusion is to keep 5.x as the latest. Is there any documentation on breaking changes besides the minimum Gradle verison?
Hi @DanielJRutledge, there is a section about it in the README.md at the overview section. You can also check out the configuration section for a full descriptions about the supported configuration options.
Describe the bug A clear and concise description of what the bug is.
The gradle-artifactory-plugin doc recommends using the plugin with the
latest.release
version like this:Further down the page, the doc shows a template for the plugin configuration that begins like this:
Since the publication of version 5.0.0 on 2023-06-29 (today), we now have a strange behavior with an error like this:
This occurs in a gradle script like this:
It seems that version 5.0.0 introduces an incompatible configuration paradigm that makes the current documentation based on version 4.x obsolete.
Furthermore, I cannot even find any source code corresponding to
org.jfrog.gradle.plugin.artifactory.config.ArtifactoryPluginConvention
To Reproduce Steps to reproduce the behavior
See above.
Expected behavior A clear and concise description of what you expected to happen.
Version 5.0.0 should be backwards compatible with previous versions of the gradle artifactory plugin.
Screenshots If applicable, add screenshots to help explain your problem.
Versions
Additional context Add any other context about the problem here.